Tuesday, July 19, 2011

How to connect Flex Sensor to Arduino

I have been working on my new artproject in which I will use Flex Sensor as "a switch" to change the track of a Mp3 player. Flex Sensor and the MP3 player are both connected to the arduino, that controls the action.

Flex sensors are sensors that change in resistance depending how much the sensor is bend. Sensors convert the change in bend to electrical resistance - the more the sensor bend, the higher is the resistance value.

Using the Flex Sensor is very easy. There are couple of different manufacturers in the market.
I used the 4.5" long from SpectraSymbol. Their datasheet is very clear and informative (http://www.sparkfun.com/datasheets/Sensors/Flex/FLEXSENSOR(REVA1).pdf).

Datasheet instructs you to use operational amplifier (opamps). That may be useful if you plan to use flex sensor as stand-alone device (without any microcontroller). Because I am using arduino, I skipped all OpAmps and made a very simple circuit with only one additional resistor.

Varying the value of the resistor will results different readings. With 22k Ohm resisor I will get values between 300-700. This works fine for me. In my code I assume that all values under 400 mean that the sensor is bend. All values above 600 mean that sensor is nor bend. Note that Flex sensor give reliable readingsONLY if you bend it on the specific direction (usually towards on the text side of the sensor).

I have not yet integrated the sensor to final artwork, so I do not have any world of warnings of my own. I have played with the sensor in the protoboard without any problems. (Legs of the connectors fit nicely to protoboard.)

The most fragile part of the sensor seems to be near the connector legs. I think it would be wise try to avoid any substantial bend on that area. I might protect that area with some sort of plastic encasing.

No comments:

Post a Comment