# Voltage divider

The voltage divider circuit is so common when dealing with electronics, that it's worth memorizing.

from "Getting Started in Electronics" by Forrest Mims

What follows is a long-winded explanation.

## Contents

## What resistors can do for us

As you know, resistors do two useful things:

- resistors slow current (a la Ohm's law, which states that resistance and current are inversely proportional).
- resistors drop voltage (a la Kirchoff's voltage law, which says that the sum of all voltage sources and voltage drops around a circuit loop is zero).

it's the dropping voltage part that is useful to us when designing voltage divider circuits.

## Voltage drop is proportional to resistance

Let's say we have a 5V power in a circuit loop with a 1kΩ resistor (R1) in series with a 10kΩ resistor (R2).

The voltage divider formula tells us exactly how much of the voltage is dropped by each resistor. Here"s how it works:

R1 contains 1/11th of the total resistance in the circuit (1kΩ out of a total of 11kΩ), so it drops 1/11th of the total Voltage. So, R1 drops 5V * 1/11 = 0.5V.

R2 contains 10/11th of the total resistance in the circuit (10kΩ out of a total of 11kΩ), so it drops 10/11th of the total Voltage. So, R2 drops 5V * 10/11 = 4.5V.

Notice, that together, the two resistors drop the full 5V supplied to the circuit, thereby satisfying Kirchoff"s voltage law.

## What the Voltage Divider can do for us

The point of this is that we can use this phenomenon to our advantage.

As we've calculated, the voltage drop around R2 (between the top of R2 and ground) is 4.5V.

But, if we changed R2 to be 1kΩ, the Voltage Divider formula tells us that the voltage dropped by it would be half the total voltage. That"s because R2 would amount to half the total resistance, in this case (1kΩ out of 2kΩ total). So the voltage drop around R2 would be 1/2 * 5V = 2.5V.

And if we somehow could reduce the resistance of R2 altogether, so it effectively had 0Ω resistance, the voltage dropped by it would be 0V.

## Adding the microcontroller

If, instead of using a static 10kΩ, 1kΩ, or 0Ω resistor for R2, we had a variable resistor, such as a 10kΩ potentiometer ("or photoresistor" or thermistor), we'd be able to vary the resistance on the fly.

We know that the value of the resistors is what determines how much voltage is dropped by R2. A variable resistor then allows us to control how much voltage is supplied to an analog microcontroller pin.

Since microcontroller pins compare whatever voltage is supplied to their pins to ground (0V), a voltage divider with a variable resistor of some kind that causes variations in its voltage is a convenient mechanism for sending signals from the outside world into the microcontroller brains. Lots of sensors work this way.

If the potentiometer was turned all the way up to its max resistance (10kΩ), it would drop the maximum voltage (4.5V), and microcontroller would read the maximum analog value possible with this circuit.

If the potiometer was turned all the way down to its lowest resistance (0Ω), it would drop the minimum voltage (0V), and the microcontroller would read the lowest analog value possible with this circuit.

And there are all the values in between the maximum and minimum that we can achieve by partially turning the potentiometer.

This principle is used to get many different sensors as a way of feeding data into the microcontroller. In this way, the microcontroller "knows" what"s happening in the outside world, and can react accordingly.

## Try the Voltage Divider upside-down

An alternative version of the voltage divider has the variable resistor put in place of R1, while R2 is kept at a fixed value. The end result, if you do the calculations, is the opposite behavior. Try it out, and see how it differs.

## Questions

- Explain how the behavior of the "upside-down" version of the Voltage Divider circuit differs from the one described here.