# What is the purpose of a voltage divider in a flex sensor?

I've been following this flex-sensor-arduino tutorial on setting up a simple flex sensor with Arduino, and I got confused on this part:

The flex sensor changes its resistance when flexed so we can measure that change using one of the Arduino’s analog pins. But to do that we need a fixed resistor (not changing) that we can use for that comparison (We are using a 22K resistor). This is called a voltage divider and divides the 5v between the flex sensor and the resistor.

Why exactly did I need to add the second resistor? Couldn't the Arduino just get the voltage change from a single variable resistor that is the flex sensor? I'm very new to electronics, so an explanation in simple terms would be great.

This is called voltage divider. To to be able to discover the unknown resistance you put it into a combination with a known resistance and apply the formula.

You can connect a fixed current source to the unknown resistance, to measure voltage drop over it. A fixed current source is a bit more tedious to implement though.

I'd suggest you go and read about it, experment with it on a breadboard. You'll need two multimeters - one for voltage, another for current. Learn your Ohms law amen.

If you have a good voltage source (you do) and you apply it across the flex sensor, the voltage will not change. The current will change as a result of the changing resistance of the flex sensor.

So if you measure the voltage across the flex sensor, it will never change. By forming a voltage divider, you can get an equation that relates the resistance (partially as a result of flex) of the flex sensor to the voltage read across it.

This in turn lets you read the amount of flex! Remember: V=IR. If V is always 5 volts, as R goes up and down, I will change to make the equation hold.

The Arduino cannot measure resistance directly...it can only measure voltage. So, you have to have a way of converting the changing resistance to a changing voltage. According to Ohm's theory, we can do that by forcing a current to flow through the varying resistor. You could connect the varying resistor to the ADC input and to ground, but no (or very little) current would flow through it so you wouldn't get any significant voltage. Likewise, if you connect the varying resistor between ground and +5V the voltage across the resistor will always be 5V (even though the current will be changing).

The most convenient way of producing a varying voltage from a varying resistance is with a voltage divider composed of the varying resistance and a fixed resistance. By observing the voltage at the circuit node where the two resistors are connected together we can see a varying voltage, and with a little math we can back out the corresponding change in resistance.