This instructable explains how to connect an analog sensor to the Arduino (in our case will use a Lilypad).
Material you will need:
- one Lilypad Arduino (www.sparkfun.com)
- one FTDI board (www.sparkfun.com)
- one USB A to mini B cable (www.sparkfun.com or Radio Shack)
- one analog textile press button or a stretch sensor (www.plugandwear.com)
- 4 crocodile cables (Radio Shack)
- a 10 kOhm resistor (Radio Shack)
- a 1 kOhm resistor (Radio Shack)
While DIGITAL sensors are able to detect only two levels (HIGH or LOW, ON or OFF, TRUE or FALSE, 0V or +5V), ANALOG sensors are used to detect physical quantities with different levels (i.e. a pressure sensor measuring weight from 0 Kg to 5 Kg).
At each variation of the pressure (sensor input), a proportional variation of its output will occour.
For our instructable we will use a textile resistive sensor that changes its resistance with applied mechanical pressure. The more weight we apply to the sensor, the lower its electrical resistance will be.
Lilypad is not able to read resistance, so we'll have to convert our variation of resistance into a variation of VOLTAGE, that is something the Lilypad can read. We'll do this using the circuit in the image.
This circuit is able to transform a RESISTANCE variation of VR1 (our sensor) into a VOLTAGE variation. You can verify by putting your multimeter on Ohm and read the voltage between 0V and the sensor output.
Step 1: Connect the sensor 1
Using one crocodile cable (RED if you have one, as RED is the color for positive) connect the '+' pad of your Lilypad to your sensor. Sensors are not polarized, so it does not matter on which side you connect it. This procedure is shown for an analog textile press button, but the same one could be applied for a stretch sensor.
Step 2: Connect the sensor 2
Then connect the output of the sensor to the analog input a0 of the Lilypad. You can choose a different input later in the sketch (the Lilypad program).