Wednesday, October 30, 2013

DRAFT ----- Design Project ------ DRAFT

THIS IS A DRAFT VERSION. THE FINAL VERSION OF THE DESIGN PROJECT DESCRIPTION WILL BE AVAILABLE ON SUNDAY NOV 3RD.

Problem Statement

As a team of 3 to 4 students design a mechanism that can be animated and controlled via an Arduino based interface. The mechanism should include some parts that have been design to be fabricated using a 3D printer and other parts that have been designed to be laser cut from 1/8" acrylic sheet. The mechanism can include other components that are purchased or fabricated out of other types of material such as cardboard, foamcore, wooden dowels, string, wire, rubberbands, etc... As explained below, a supply of Lego connectors and axles will be available.

Project Schedule

The following are key dates that need to be met by each project team. Failure to meet these dates will have a detrimental effect on the team project grade and may result in the team mechanism not being fabricated.

Week of Nov 4

  • It is very important that you attend lecture this week. The lecture will provide introductions/demonstrations to many of the web services you will be required to use during the completion of this project. In particular lecture will introduce how to set up a blog and how to use Github to host your code, and how to check the amount of material required to print your 3D parts.
  • Team formation - All members of a team must be registered for the same lab section. You are required to have a team formed by the end of your lab session and need to have filled out a team contract and submit it to your instructor. The team contract will require you to indicate at least two designated meeting times when the team can get together and act as a design group each week.
  • Your team should establish its name and create a blog where it can post its progress and its final project description. I will suggest that the team use the Blogger interface, but you are free to use other platforms.

Week of Nov 11

  • You should note that the Monday and Tuesday lab sections do not meet this week.
  • You team needs to have decided upon the type of mechanism that it is planning on designing and should post a description of the mechanism and initial sketches and.or pictures of how the mechanism is expected to work.
  • Initial work should be conducted on the Arduino control system - this system needs to include a means to control the mechanism using some combination of an analog sensor and a digital input device such as a push button - the control system should also provide information to the user via LED indicator lights and an LCD. The code and video of the system should be posted to the blog. The code should be posted using Github. Also the code should be well commented and the blog post should include a description of what the control system is intended to accomplish.

Week of Nov 18

  • Initial solid models of individual parts should be completed and a test assembly should be created from them.
  • It is important at this stage to have well thought out the types of connections that you plan to use to connect individual components of the assembly together. Your assembly should include these components.
  • You design should also include solid models of the type of motor that you are planning on using and your intended method of connecting the motor to the assembly. 
  • In order to facilitate this process, Lego pin connectors, axles and bushings will be available for you to use as part of the assembly as well as screws that fit the servo motor that came with the SIK.
  • You will be provided with solid models that show the correct dimensions for using the Lego connectors and the hole requirements for the screws to connect the Servo motor.

Week of Nov 25


  • The part files for the parts that your team are requesting to be fabricated must be submitted by 5 PM on Nov 27th. The submission should also include a request for the required number of Lego connectors and servo motor screws.
  • The parts that are to be 3D printed should have been checked that in total they do not exceed  4 cubic inches of model material.
  • Also by Nov 27th - a more fine-tuned version of the Arduino based control system should be presented. Again a description of the control system, the code and a video of the system should be included in the post.

Week of Dec 2


  • The parts will be fabricated this week. Your team will receive notification of when the parts are completed and where they may be picked up.
  • The team should work on assembly and fine tuning of the mechanism. This is where you find out what is wrong and if it can be fixed...
  • Your team should document this process on the blog.
  • You team can submit redesigned parts to be fabricated to correct errors, however, there is no guarantee that it will be possible to fabricate these "modified" parts. 

Week of Dec 9th

  • The final assemblies will be put on display in Kitson 309 and the school of engineering will be invited to look at the projects. 
  • Your team needs to prepare a 3-4 page project summary to accompany the physical project. A number of power supply jacks will be available to provide power to the projects for hands-on demonstrations.
  • Each individual student will also be required to review a set number of project blogs. The review will be in the form of an assessment sheet. These reviews will be used in a portion of the grading process.

Blog Posts 

  • Your team blog should include posts that contain descriptions of your team meetings. Team meeting posts should include a list of team members who where in attendance and what was accomplished during the meeting.
  • There should be one posts each week that includes the following:
    • An overall description of what the team has accomplished
    • A description of the contribution of each team member - the description should include the number of hours each team member devoted to the project.
  • The blog will also be used to document the actual mechanism design. Each part that is designed should include an image of its solid model and an image of its part drawing. These posts should include links to the actual part models and drawing. 
  • Each team also needs to document the actual assembly by presenting images of the assembly. At least one of these images should include an exploded view of the assembly. A motion study of the assembly needs to be performed and the motion should be outputted as an *.avi video file. The video should be posted on YouTube and the video should be embedded in your blog.
  • Your blog posts should also include images of the individual components that are fabricated using the rapid prototyping processes. 
  • The final blog post for the project should include pictures of the completed assembly, a video of the mechanism in action, a description of the final assembly and an assessment as to how well it works and what improvements/changes the team would make based on the performance of the assembly. The improvement suggestions should include examples of redesigned parts.

Connector Options

The following Lego parts will be available for each team to act as connectors...

Motion Options

In order to create motion for you assembly you must used one or more of the following:

  • A servo motor
  • A dc motor - note that if you plan to use the dc motor you will need to account for its speed of rotation and its torque requirements
  • A stepper motor
  • A linear actuator

Tuesday, October 29, 2013

A short list of Arduino Key Words

A short list of Arduino C Keywords

The following list is based upon the keywords found in the more commonly used Arduino Example Sketches.

Variable Types

·         int

·         float

·         long

Variable Type Modifier

·         const

·         unsigned

Serial Library

·         Serial.begin( … )

·         Serial.print( … )

·         Serial.println( … )

Sevo Library

·         #include <Servo.h>             (must be placed at beginning of sketch)

·         Servo servoName                (each servo must be given a unique identifier)

·         servoName.attach( … )      (must be attached to a PWM pin)

·         servoName.write(val)       (val must be between 0 and 180)

Modes

·         INPUT

·         OUTPUT

·         HIGH

·         LOW

·         INPUT_PULLUP

Defined Functions

·         setup()

·         loop()

·         analogRead( …   )

·         analogWrite( …   )

·         delay( … )

·         digitalWrite( … )

·         digitalRead( … )

·         millis( … )

·         pinMode( … )

Conditionals

·         if

if (someVariable > 50)

{

  // do something here

}

 

·         if  /  else

if (someVariable > 50)

{

  // action A

}

else

{

  // action B

}

 

·         while

var = 0;

while(var < 200)
{

  // do something repetitive 200 times

  var++;

}

 

·         for

for (int i=0; i <= 255; i++)

{

    Serial.println(i);

}

 

Comparison Operators

·         x == y      (x is equal to y)

·         x != y       (x is not equal to y)

·         x <  y        (x is less than y) 

·         x >  y        (x is greater than y)

·         x <= y      (x is less than or equal to y)

·         x >= y      (x is greater than or equal to y)

Boolean Operators

·         &&           and

·         ||             or

·         !                not

 

Special Items

·         void – this is only used in function declarations. It indicates that the function is expected to return no information to the function from which it was called.

Arrays

·         An array is a collection of variables that are accessed with an index number.

·         Declaring an array

int myArray[] = {2, 4, 8, 3, 6};

·         Accessing an array

myArray[0]      contains 2

myArray[4]      contains 6

myArray[5]      is invalid and will return random information

 

 

 

Arduino Uno - Digital Output

The digital I/O pin

The Arduino Uno can supply a digital output signal on its 14 digital input/output (I/O) pins. In most instances, the pins used to provide these signals are pins 2 through 12. Pins 0 and 1 are also used by the Uno to effect serial communication and it is good practice to not use these pins in a project unless absolutely necessary. The output of Pin 13 is connected to an on-board LED and a current limiting resistor - this pin is usually held in reserve for debugging purposes and again it is good practice to not use this pin in a project unless absolutely necessary.

The digital I/O pins 3, 5, 6, 9, 10 and 11 can be used as I/O pins but can also provide PWM output using the analogWrite() function.

The digital I/O pins 2, 4, 7, 8, 12 can be considered the most basic type of digital pin. In the most generic sense, digital I/O pins can be thought of as the output of a switch that can can be toggled between two terminals where one of the terminals is held at positive five volts (+5V) and zero volts, also referred to as ground (GND). This digital "switch" is then controlled via software, which is to say, the pin does what the program (or sketch in Arduino speak) tells it what to do. This concept of the digital pin as a switch is shown in the figure below.



The digital pins on the Arduino can be used in two modes: they can provide a digital signal - this is the OUTPUT mode, or they can be used to receive a digital signal, this is the INPUT mode. In order to use a pin, the mode of operation must be specified in the sketch - typically this is done within the setup( ) function using the defined function called pinMode( ).

As an example, the following line of code sets the digital I/O pin number 3 to OUTPUT mode.

pinMode( 3, OUTPUT);

Once the mode is set to OUTPUT, the boolean value of the digital pin can be set using the predefined function digitalWrite( ). The pin value can be set to HIGH (+5V) or LOW (GND). The following are examples of the code usage and the figures show the resulting "physical" process. Again, pin 3 is used.

digitalWrite( 3, HIGH);


digitalWrite( 3, LOW);



Using digital output

Digital pins are typically used in two ways. The first is to send digital information to another device and the second is to act as a combination power source and switch to a limited set of components such as LEDs.

Sending digital information

The Arduino is often used to control different types of motors. This is commonly done through the use of a motor control board such as the Pololu Qik 2s9v1 Dual Serial Motor Controller or the EasyDriver Stepper Motor Driver. In a typical arrangement a number of the Arduino digital I/O pins are use to send signals to the motor driver boards. The signal requirements are different for each board and are commonly controlled via libraries that are meant to be used with the boards. Nonetheless, the Arduino sketch will use the digitalWrite function with the HIGH and LOW modes to provide the required digital signal to the board. This concept is shown in the following figure.


Controlling components

The second use for the digital pins is to provide current to operate a component such as an LED. When used in this manner, the Arduino documentation states that no pin should be allowed to source more than 40 mA of current and the recommended steady current is around 20 mA.There is also a specified upper limit of 200 mA for the entire Arduino board. Thus one must be very careful when using the Arduino to provide operating current to more than a few simple components. For instance - using the Arduino to control 10 LEDs can easily exceed the 200 mA limit of the board.

When using components that draw current it is important to calculate the possible current drawn and use an in series resistor to limit the maximum current draw - this is sometimes referred to as a current limiting resistor. The typical setup for using a digital output pin to control an LED is shown in the figure below. Note that the figure explicitly shows that the Arduino requires power from an outside source which can either be a USB cable connected to a PC or some other DC power source (7-15 V) that is connected to the Arduino input power jack. The ground line of the power source is connected to the Arduino and the figure notes that this is the same ground that is used by the LED circuit.



Code example

The following complete code is an example of the use of digital output. Digital pin 3 is given a descriptive name "redLedPin", its mode is set to output and its state is toggled from high to low repeatedly in a loop. A video of the circuit setup and running is provided below the sketch

Sketch



Video