I'm on voltage dividers circuits for reading some sensors that changes their resistance (force sentive resistor).

With my tester (with input scale set on 200K ohms) I read 23 if sensor is not touched and 65 if the sensor is touched at maximum.

Now, I'm trying to read it with a microcontroller and with a 220 ohms resistor (red red brown) i read values from 7 (not touched) to 1 (touched). With a 1000 ohms (brown black red) i read values from 40 (not touched) to 15 ( touched).

I would like to get the best from this sensor and this microcontroller (it could read analog values from 0 to 1023) and I want to calculate the best resistor for get the best result and the biggest range of values i can.

Can someone point me out?


3 Answers 3


Ah, I once wrote an absolutely fantastic answer :-) for that!

I found that you get the maximum output range if the series resistor is equal to

\$ R_S = \sqrt{R_{MIN} \times R_{MAX}} \$

You'll have to admit that this just looks beautiful. So for your sensor that would be

\$ R_S = \sqrt{23 k\Omega \times 65 k\Omega} = 39 k\Omega\$

If you feed the resistive divider with the ADC's reference voltage you'll get readings of 380 and 640 for 23 kΩ and 65 kΩ, resp. That's a range of 260 discrete values, or a 0.4 % resolution. You can't get better than that without amplification or a higher voltage difference across the resistive divider.

Note that using the same supply for the divider and the ADC's reference the reading is completely independent of voltage variations!

  • \$\begingroup\$ yeah, i definitly have to admit it! :) \$\endgroup\$
    – nkint
    Commented Jul 23, 2012 at 16:52
  • \$\begingroup\$ @stevenvh, yea the equations are pretty, but my graphs are pretty nice too! :p \$\endgroup\$
    – vicatcu
    Commented Jul 23, 2012 at 17:02
  • \$\begingroup\$ @vicatcu - very thoughtful to make a version for Australia and one for the Northern Hemisphere :-) \$\endgroup\$
    – stevenvh
    Commented Jul 23, 2012 at 17:05
  • \$\begingroup\$ @stevenvh See? I knew that australia would come in handy! \$\endgroup\$
    – W5VO
    Commented Jul 23, 2012 at 18:06
  • \$\begingroup\$ @W5VO - Haha! Good one! \$\endgroup\$
    – stevenvh
    Commented Jul 23, 2012 at 18:11

The equation for a voltage divider with R1 connected to Vcc and R2 connected to GND, and R1 and R2 connected to each other is:

V_out = Vcc * R2 / (R1 + R2)

You could formulate this as an optimization problem and start taking derivatives and stuff, but I find the brute force graph approach to be more instructive.

You know the minimum value you read from your force sensor was 23kOhms and the maximum value you read from your force sensor was 65kOhms. Assuming your force sensor is R2, then the range of values you will get for Vout for a range of R1 looks like this at the high and low ends of R2:

enter image description here

... and likewise if you flip the divider around and vary R2 you get:

enter image description here

Long story short, your best bet is something around 40kOhms for the range of resistances you have empirically measured.


The resistive solution is the simplest, but it is not linear as the resistance varies:

Voltage Divider

The above is a simulation using a 5V supply, the 39k from Stevens answer as the top resistor and varying the bottom resistor (the sensor) from 23k to 65k. Note the graph is curved rather than straight. This may not matter for your application, but if it does you will need to compensate in the firmware.

Another way of doing things would be to use a current source in place of the top resistor:

Voltage Divider CC

Here are the results for the same sweep as before (supply still 5V):

Voltage Divider CC Sim

You can see the result is much more linear. This is only to illustrate the concept, Q1 can be any general purpose PNP, D1 and D2 can be just about any silicon diode, and you can alter R3 for your desired constant current:
I = (VD1+VD2-Vbe) / R3 -> (0.6 + 0.6 - 0.6) / 12k = ~50uA. This is pretty rough, so you may need to trim (you can use a trim pot for R3 if you wish)

If you want a very reliable current source, then you can use an opamp instead of the transistor:

Opamp current source

The idea is basically the same as the transistor, just using an opamp. Iout = V+ - Vref / R2.

  • \$\begingroup\$ You've got a point, iff the sensor has a linear characteristic. In this answer I show that a non-linear characteristic may be converted to a very good linear approximation (over a 30 °C range) by adding just that series resistor. In this case a current source will look bad. \$\endgroup\$
    – stevenvh
    Commented Jul 23, 2012 at 18:28
  • \$\begingroup\$ @Steven - Yes, that's another nice and simple option, but will be more sensitive to supply variations. Linearity should be better than the simple PNP source though (a cascode would be better) The opamp source would be best. \$\endgroup\$
    – Oli Glaser
    Commented Jul 23, 2012 at 18:45
  • \$\begingroup\$ Au contraire! If the divider uses the same supply as tha ADC's reference voltage it's completely insensitive to voltage variations! \$\endgroup\$
    – stevenvh
    Commented Jul 23, 2012 at 18:57
  • \$\begingroup\$ Good point, if it does share the supply and the ADC is not e.g. driven from a buffered reference. Also, depending on decoupling and layout, the (short term) variations may not be exactly the same, so I wouldn't say completely insensitive ;-) \$\endgroup\$
    – Oli Glaser
    Commented Jul 23, 2012 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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