Stretch Sensor made by Merlin
The Stretch Sensor is a flexible cylindrical cord with spade electrical fixings at each end.
The sensor behaves like a variable resistor, the more you stretch it the higher the resistance.
As the length of the Stretch Sensor alters so does it's resistance. For each centimeter of length change there is a resistance change of around 400 Ohms/cm.
With the code below and a 10K resister parallel with the sensor, range reads form 530- 380 in ascii on PicBasicPro , and then works fine with keyboard emulator to control computer
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 20 ' Set sampling time in uS
SensorValue var word
tx var portc.6
rx var portc.7
n9600 con 16468
' Set PORTA to all input
TRISA = %11111111
' Set up ADCON1
ADCON1 = %10000010
'adding pull-down resistors tightens the range.
ADCin 0, sensorValue
if SensorValue < 500 then ' 500 is when you strecth a bit but not much.....since our user may just be able to move a bit
serout2 tx, n9600, [Dec sensorValue, 13,10 ] 'the only diff btwn this and
pause 50 'the other code is DEC
try to parallel with a 10K pot...if preset the pot at 600, it gives the greatest value difference btw loose and way tight.
then try different fixed resisters..
10K - 250 - 500
22K - 280 - 690 (the best difference)
33K - 380 - 780
47K - 470 - 820
then tried to build the bridge thing to see if we can see an even greater difference
(sorry about the quality...)
ans don't know what went wrong..... it keep reading 1023.... thought might be out of the range... but then tried a photocell and same thing happened...
Question about stretch sensor and LM358 amp
1.) How durable is stretch sensor? Would like get a fresh one and find out.
2.) The way to stratch sensor makes the reading a bit different. Maybe worth to take a look depends the occasion to use it.
3.) LM358 has double sets of input/output....When do we need both? something like color sensor that has more then one value?