Regarding a stretch sensor by Tinkersphere
what value of pull-up resistor I need to use in order to read a continuous data between 0 and 1023 when stretching the sensor.
It written: " * Resistance: goes from approx 100K ohms when unstretched down to 40K ohms when stretched"
assuming those values - what question I need to ask in order to choose the right resistor value to read the voltage using that sensor?
You will never read from 0 to 1023 with that sensor no matter the value of the load resistor. The analog input is connected to the junction of 2 resistors in a voltage divider configuration. One resistor is the sensor, the other is a fixed load resistor. Use Ohm's law to calculate the output voltage for any combination of sensor resistance versus load resistance.
Here is your circuit (one of 2 ways to wire it). Do some simple calculations.
First calculate the current through the resistors;
I = Vcc / (R1 + R2)
Then calculate the voltage at the analog in referenced to ground
V = I / R2.
Pick a load resistor and calculate no stretch voltage.
Sensor no stretch I = 5 / (10K + 100K) = 4.5x10-5 * 100K = 4.54V
Sensor full stretch I = 5 / (10K + 40K) = 1.0x10-4 * 40K = 4.00V
So 10K is not going to give you the range of values that you want.
How about 100K load resistor?
I = 5 / (100K + 100K) = 2.5x10-5 * 100K = 2.5V no stretch
I = 5 \ (100K + 40K) = 3.57x10-5 * 40K = 1.43V full stretch
I will leave it to you to calculate the values for other load resistors.
You may want to investigate how wiring the sensor the other way (sensor for R1 and load resistor for R2) effects the resistor values.
Also, the output impedance of the voltage divider is over the recommended maximum for the analog input. A 0.1uF ceramic cap from the analog input to ground will lower the output impedance.
Yes, it is due to the resistance range of the sensor.
The only way you would get readings of 0 and 1023 is if the resistance of the sensor went from zero ohms right up to infinity ohms, which it clearly doesn't.
The optimum value of the resistor to use is roughly midway between the maximum and minimum resistance values of the sensor.
You don't have to read a value from 0 to 1023. If you take the average of a few samples, you get enough accuracy.
If this is an assignment from school then you might have to write down a schematic with a OpAmp. In real life, a OpAmp introduces noise and more complexity.
There are a number of ways to make a stretch sensor. I think this one is one solid material, probably a polymer. I don't know if carbon powder is enough, that would require a lot of carbon power which would make it weak. Perhaps there are other conductive parts in it.
I tried mixing silicone with carbon powder once, it did not work.
The resistance get lower when stretched ? How is that possible ? Is the description wrong ?
No sensor that is part of a voltage divider (LDR, FSR, etc.) can give the full range of ADC output values. For the reason stated by @JohnLincoln. Choosing the right load resistor you can maximize the range of values but you will never achieve perfection.
What is it that you are trying to measure? Why do you insist on values from 0 to 1023 (which is hard to accomplish in any case)?
I don't really need the full values from 0 to 1023. I want to have enough "head-room" that when I am pulling the sensor I will be able to change the amplitude of an audio file between 0 and 1
so if sensor is not stretched at all - output value is 0. if sensor is fully stretch - output value is 1 (and all the numbers between no stretch (0) and full stretch (1))
What are you going to make, mechanically ?
If you put it around your chest, then the volume is going up and down all the time. If you connect it to a pedal or a door, then there might be other sensors.