Introduction: The "Mister Fantastic" Sensor
This project involves a flex sensor, a type of sensor that senses when it is flexed, or the Mr. Fantastic of all sensors much like the laser LED is the Cyclops of sensors. It basically a resistor that puts more resistance as it is flexed. This can be useful in many different ways, such as in toys when an arm is bent, it can make a sound. Or if a shoe is flexed, LED’s turn on. The possibilities are only limited by your own imagination.
Step 1: Materials
Things You Will Need: (And where to get them.)
Arduino Uno: https://www.sparkfun.com/search/results?term=ardu...
Flex Sensor: https://www.sparkfun.com/products/10264
1 22K Resistor: http://www.jameco.com/1/1/28314-cf1-2w223jrc-resi...
9 33o-630 Ohm Resistors: http://www.jameco.com/webapp/wcs/stores/servlet/P...
11 Jumper Wires: https://www.sparkfun.com/products/11026
Here is also some things that helped me in the process.
Resistor Color Code Calculator: http://www.robotroom.com/Calculators/Resistor/Resi...
Base Code and Function: http://arduinobasics.blogspot.com/2011/05/arduino-...
Step 2: Wiring the Flex Sensor
To start, plug a jumper wire to the analog pin 0 on the Arduino. Plug this jumper cable behind the left side of the flex sensor on the bread-board. Then, take another jumper wire and plug it into the 5v on the Arduino. This jumper will connect behind the other side of the flex sensor on the breadboard. Next, plug in the 22k resistor behind the same analog 0 jumper wire, and plug the other end 2 spaces apart. This will be where the ground wire will be. Plug another jumper cable into the ground on the Arduino and put the other end on the same rail as the other end of the resistor not connected to the flex sensor. The wiring for the flex sensor should now be done. Up next, the wiring for the LEDs!
Step 3: Wiring the LED's
On the opposite side of the breadboard, line up LED’s in a horizontal row, with the positive leg (longer leg) leading to the left. Then, plug in jumper cables from the 12, 11, 10, 9, 8, 7, 6, and 5 pins on the Arduino to the negative leg (shorter leg) on the Arduino. Following this, plug in those 330ohm resistors into the same rail as the long leg of the LEDs, while putting the other leg into the negative rail of the Arduino. The wiring for this project should be finished as of now. The end result should be that the flex sensor shuts off the LED's depending on the amount of flex used.
Step 4: Sample Code
Here is the sample code for the project. Feel free to adjust, use it, or do whatever you want with it to fit your needs.