I built a simple voltage divider circuit with a Stretch Sensor from Merlin Systems Corp. Ltd. The ultimate application for this sensor will be an assistive technology setting. We will attempt to make a video game controller for a wheelchair bound child with very limited movement. The stretch sensor, which is made of some kind of flexible rubber substance (most likely zoflex) will be strapped under the child's chin. The child will operate the game by opening and closing his mouth. The game, which was developed by Amit Pitaru during the Spring 2005 semester, is a modified version of Tetris. It includes a scanning interface which requires only one input.
I used a 15cm stretch sensor in a voltage divider circuit with a 10K ohm resistor. I attempted to re-write Tom's Processing code for serial input. My Processing skills are lacking, so it is not a terrific attempt. It is necessary to divide the variable 'sensorValue' by four in Processing because the pic is programmed to send out a 'word', while Processing is looking for just a 'byte' of information.
Here is my code:
In Serial Communicator it is possible to look at the value being sent out by the pic. When at rest the sensor sends out a value of about 390. When stretched to full length is sends out a value of about 355. When it is folded on itself the resistence of the sensor goes down and the pic sends out a value around 430. These numbers change slightly when you change the value of the resistor in the voltage divider circuit. The overall resistence of the circuit was reduced slightly with use. In other words, the resistence was higher when I started experiementing with the sensor, than when I finished.
The peak detection code did not work with this particular sensor because triggering the sensor yeilds a tough, not a peak. To remedy this we need to reverse the signal (by using an op amp), or reverse the code so that it is looking for a trough, rather than a peak.
For more detailed notes-My blog