Arduino Setup & Flexing the ExBow
Installing Software (USB Stick) Install Arduino https://www.arduino.cc/en/Guide/HomePage Install Ardublock http://www.hummingbirdkit.com/learning/setting-arduino-environment-hummingbird- duo
Blink Program Begin by setting up the circuit as shown to the right The positive end (long leg) of the LED must be connected to the resistor The negative end (short leg) of the LED must be connected to ground Digital Pin 13 (D13) 1000 Ohm Resistor Long leg Short leg LED Ground https://www.arduino.cc/en/tutorial/blink
Physical Circuit
Code Initialize pin 13 as an output pin - we will output a signal to tell the LED what to do For us, wherever it says LED_BUILTIN write 13 Turn the LED on Turn the LED off
Completed Code For us, wherever it says LED_BUILTIN write 13
Output When you’re done, it should look like this
Voltage Divider “A simple circuit which turns a large voltage into a proportionally smaller one” By changing R1 and R2, we can make Vout be a fraction of Vin Try R1=1000 Ohms and R2=1000 Ohms What should you get? What about is R2 is really high? For the Exbow, R2 will be our “flex” sensor
Code
Output To see printed outputs, go to the Arduino Program and click on Tools > Serial Monitor (Text Display) or Serial Plotter (Plot Display) You should see one constant line The analog input 0-5V is converted to 0-1023 value
Voltage Divider with Flex https://learn.sparkfun.com/tutorials/sik-experiment-guide-for- arduino---v32/experiment-9-using-a-flex-sensor Voltage Divider with Flex Now we integrate the flex sensor into the voltage divider circuit
Physical Circuit
Code
Output Use Serial Plotter As you move the flex sensor back and forth you should see something to the right
Min - Max Function Range of outputs for person using the flex sensor differs Use a formula to find bounds Initiate high minimum and every time the flex sensor has a lower value, the minimum becomes that Initiate low maximum and every time the flex sensor has a higher value, the maximum becomes that
Code
Output As the flex value grows, so does the maximum As the flex value shrinks, so does the minimum Blue = actual output red=max green = min Label axis
Finding the angle Now that we have the flex values and the range of values, we can convert them to angles Find the proportional value of the flex from the MAX and MIN and multiply by 180 deg Example:
Code The left side of the equation maps the Flex value to a value between a new range of 0 to 1 (min to max) The right side then multiplies that into an angle from 0 to 180
Output Use the Serial Monitor: Tools > Serial Monitor As you move the flex sensor back and forth you should see something to the right yellow is the angle now
Servo Motor Sweep https://www.arduino.cc/en/Tutorial/Sweep
Circuit
Code
Output Use the Serial Monitor: Tools > Serial Monitor As the servo moves the arm back and forth you should see something to the right Try increasing the Max Angle to see how the arm moves
Putting it all together