Tuesday, June 24, 2008



One of the most important concepts when interfacing sensors is the concept of the voltage divider.

Consider the circuit we were looking at in the last section. If we were to take a look at the voltage at the high side of the resistor, we would measure approximately 5V. If we were to measure the voltage at the low side we'd see approximately 0V. What would we measure in the middle of the resistor? Presumably with half the resistive material above and half below we'd measure 2.5V.

Voltage drop in resistor

If we have two resistors, this desire to peek inside a resistor can be faked. This stems from the observation that when two resistors are connected in line (called in series) their resistances add linearly. Two 1000 (1k) resistors in series have a total resistance of 2k, for example. Thus the point p between the two resistors can be thought of as the midpoint of a 2k resistor.

Two Resistors

Here intuitively, it can be seen that there's a good case for suspecting that the voltage at point p is indeed 2.5V. We can actually prove this with some simple math and using Ohm's Law. If math's not your strong point you can skip lightly over the next paragraph or two.

So in our the circuit above, we have two resistors, of 1k each. Their total resistance is 2k, so, by Ohms law, the current running through them is

I = V / R

I = 5 / 2000

I = 0.0025A or 2.5mA

Using Ohm's Law, we can actually work out what that voltage will be. The trick is that now we know the current running through both of the resistors, we can apply Ohm's law to each individual one to see what the voltage across it is. Taking the bottom resistor,

V = IR

V = 0.0025 * 1000

V = 2.5V

This means that at the point p there will be a voltage of 2.5V. So our intuition is correct.

Using two resistances (of potentially various kinds and values) a voltage somewhere between the supplied voltage and zero can be obtained. If the high side resistor is converted into a smaller value than the low side resistor, the voltage at p will be higher. If the high side resistor is converted into a higher value than the low side resistor the voltage at p will be lower.

Now if you have a way of measuring voltages (like we do on a number of our Teleo modules) this can be a very useful thing. We can see how useful in the next few example circuits.

Firstly there is the potentiometer. The potentiometer the device that used to control the volume and other things on your stereo before everything became digital and microprocessor controlled. You turned it and things got louder or quieter. The potentiometer is just a voltage divider. It has a resistive strip arranged in a circle and an arm (called a wiper) that can tap onto it at any point on the circle. Power is applied to one end of the resistive strip and ground to the other. The wiper can slide to any point in between.

In the circuit below, when the wiper is close to the 5V the point p will be at a value close to 5V. When it's halfway, it will be around 2.5V and when it's close to the other end it will be close to 0V.


Another example of the usefulness of a voltage divider is in the use of a resistive sensor (like a photoresistor). The circuit below shows how this is wired. This time point p measures 2.5V only if the resistance of the photoresistor is almost exactly the same as the resistor below it (r). If the photoresistor's resistance falls (as happens when it is exposed to light) the voltage at p will rise. Conversely if the photoresistor's resistance rises (as happens when it is removed from the light), the voltage at p will fall. A device monitoring the voltage at line p will therefore be able to monitor the amount of light on the photoresistor.

Light Sensor

On final example to illustrate the usefulness of the voltage divider is the push button used as a digital input to electronics. The idea is to get a high voltage at p when the button is presses and a low one when it is not.

Push Button without a Voltage Divider

The first question to ask is why bother with a voltage divider at all? Without it, won't the push button connect p to 5V when it's pushed and leave it at 0V when un-pushed? This is true for the first part, but not true for the second part. In fact what happens is that the button does indeed connect p to 5V when it's pushed, but when it's released, the wire to p is actually unconnected (called floating). It is not getting pulled up to 5V, nor is it getting pulled down to 0V. Electrical noise from nearby wires and other devices will make the actual voltage on the wire fluctuate unpredictably. Sensitive electronics reading this voltage may get erroneous readings in this state.

The solution is to make a voltage divider. When the switch is open, its resistance is very very high compared to the resistor, so the voltage at p is very close to 0V. When the switch is closed, its resistance is close to zero: very low when compared to the resistor, so the point p reads a voltage close to 5V. In most modern digital circuits a fairly high value resistor (like 10k) can be used so that the current being wasted by flowing through the switch and through the resisitor is kept to a fairly low amount. (this can be calculated using Ohm's Law: I = V / R, I = 5 / 10000, I = 0.5mA).

Push ButtonVoltage Divider

When a resistor is used in this way - to make sure an input reads 0V when there is no circuitry driving the line either way - it is called a pull-down resistor. A resistor tied to +5v, for example, to make sure an input reads a positive voltage, when there is no driving circuitry is called a pull-up resistor.

No comments: