10
\$\begingroup\$

I am making an application using the DIY Force Sensitive Resistor (FSR) taken from this instructable. The resistance of this sensor typycally ranges from 20kOhm when at rest to 9kOhm when pressed.

How would I convert these resistance values to a signal where 0v corresponds to the rest condition and 5v corresponds to the "pressed" condition so that I can read it with an Arduino?

\$\endgroup\$
14
\$\begingroup\$

You want a signal range from 0V to 5V. Don't we all :-)? Let's go for a different approach and see where that gets us.

Starting point: cheapest and most simple solution.

That would be a series resistor to create a voltage divider. That's the absolute minimum. I've noticed that people don't give that resistor much thought, the just pick a nice round value like 10k\$\Omega\$. But I found that there's an optimal value for this.

enter image description here

The curve shows the voltage difference between the minimum and maximum reading (9k\$\Omega\$ and 20k\$\Omega\$ resp.) as a function of the series resistor (in k\$\Omega\$). See, it indeed has a maximum. That's easy to find if you remember that

\$ \left(\dfrac{f(x)}{g(x)}\right)' = \dfrac{f'(x)\cdot g(x) - f(x) \cdot g'(x)}{g^2(x)} \$

The difference \$V_{MAX}\$- \$V_{MIN}\$ has an extremum for

\$ \dfrac{d}{d R_X} \left(\dfrac{R_{MAX}}{R_{MAX} + R_X} - \dfrac{R_{MIN}}{R_{MIN} + R_X}\right) = 0 \$

Solving for \$R_X\$ gives

\$ R_X = \sqrt{R_{MIN} \cdot R_{MAX}} \$

A beauty!

So in our case the series resistor will be 13.42k\$\Omega\$, you can check this on the graph. Placing the resistors between 0V and +5V this will give us an output range of [2V, 3V]. That's the maximum range you can get with 1 resistor(*).

Is it enough? The Arduino has a 10-bit ADC, so this range will give you a range of 200 discrete levels. That should give a sufficient accuracy for a DIY sensor. So no other components like opamps needed.


(*) The accepted answer gives a 1.9V range, but it has the wrong equations. It's impossible to get a higher range than 1V with 1 resistor and only a +5V supply.

\$\endgroup\$
  • 2
    \$\begingroup\$ +1. This should get more upvotes. Everybody needs a resistor divider for a variable resistor every now and then, and then why not use the optimum range instead of that silly 10k series resistor? \$\endgroup\$ – Federico Russo Jun 7 '12 at 7:38
5
\$\begingroup\$

You need a negative voltage to be able to make a resistor voltage divider going to 0V. I'll assume you have +5V and -5V available.
Place your variable resistor \$R_X\$ between +5V and GND. Now you need to find the value for a pull-down resistor between GND and -5V. Now that's easy; you want 0V out when the variable resistor is 20k\$\Omega\$, so the pull-down also has to be 20k\$\Omega\$ because the whole thing is symmetrical.
Next we have to find out what the output voltage of the divider will be when \$R_X\$ is 9k\$\Omega\$. We note that the current through \$R_X\$ is the same current as the current through the pull-down resistor, so

\$ \dfrac{5V - V_O}{9k\Omega} = \dfrac{V_O - (-5V)}{20k\Omega} \$

Working this out gives us \$ V_O = 1.9V \$. Now all that remains to be done is scale the 0V..1.9V to 0V..5V. For this we use an RRIO (Rail-to-Rail I/O) opamp as a non-inverting amplifier

enter image description here

If you select \$R1 = 18k\Omega \$ and \$R2 = 47k\Omega\$ you'll get an output voltage range of 0V..5V for \$R_X\$ of 20k\$\Omega\$..9k\$\Omega\$.

\$\endgroup\$
1
\$\begingroup\$

I think the simplest way would be a voltage divider that gives you 5V at 9k and decreases as the resistance increases. You can play with various resistor combinations in this voltage divider calculator. It's going to be a linear progression, however.

\$\endgroup\$
  • 2
    \$\begingroup\$ You can't make a divider that gives you 5V if all you have is 5V. \$\endgroup\$ – Federico Russo Jun 6 '12 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.