1. Home
2. Knowledge Base
3. Tutorials
4. Circuit Basics
5. Circuit Basics – The Voltage Divider Circuit

# Circuit Basics - The Voltage Divider Circuit

The voltage divider circuit is a passive circuit that reduces a voltage to a fraction of the original voltage. This circuit is commonly used in voltage regulators and when reading high voltages with low voltage devices  (e.g. measuring solar panel voltage with an MCU).

## How Do I Use the Voltage Divider Circuit?

When using the voltage divider circuit, you have to pay attention to the ratio of the two resistors and the amount of current flowing through the circuit.

The ratio of the resistance of R1 and R2 determines the ratio between Vin and Vout. This relationship is given by the equation below:

$\frac{R_1}{R2} = \frac{V_{in}}{V_{out}} - 1$

Now, knowing your Vin and Vout, you can calculate the resistance ratio that you need. Then you can either choose one resistance arbitrarily, and calculate the other, or you can use our resistor calculator page to find the best pair of resistors to create your ratio.

When using a voltage divider circuit, we have to pay attention to how much current flows out of Vout. The resistor divider equation assumes that the same about of current flows through R1 and R2. Any current that leaves the circuit through Vout will make the ratio less accurate. A general rule-of-thumb used to manage this issue is that the current flowing through R1 and R2 should be at least 100 times the amount of current flowing out of Vout. We can find the current flowing through R1 and R2 with this equation:

$I = \frac{V_{in}}{R_1 + R_2}$

We can rearrange this equation to calculate the maximum total resistance (R1 + R2) of the voltage divider to maintain the minimum required current.

$R_{total\_max} = R_1 + R_2 = \frac{V_{in}}{100 \cdot I_{V_{out}}}$

Measuring the Voltage of a Solar Panel with an MCU

Let’s suppose that you have a 12V solar panel and you want to measure the solar panel’s voltage with a 5V microcontroller (MCU), like an Arduino board. First we have to consider the maximum voltage of the solar panel and the maximum measurement range of the MCU.

While the solar panel is nominally 12V, the voltage of the solar panel is most often 17.5V and it can go as high as 22V. All of this considered, we will make our readable solar panel voltage range go up to 25V to make sure the panel’s voltage is never out of range.

The 5V MCU is able to measure upto its operating voltage of 5V, but what is really important is the positive reference voltage of the MCU’s ADC module. It could be the 5V operating voltage (which could fluctuate a little) or you could use the 1.1V internal voltage reference (in the case of an ATmega328P). In this example, we are going to use the 1.1V internal reference, because it will be stable regardless of how the MCU is powered.

Now, we know that when the solar panels voltage is equal to 25V, we want the MCU to see 1.1V. We can use the voltage divider equation to calculate our required resistance ratio.

$\frac{R_1}{R_2} = \frac{V_1}{V_2} - 1 = \frac{25V}{1.1V} - 1 = 21. \overline{7272}$

Now that we know the ratio, we could arbitraily choose R2 as 1kΩ and multiply it by the ratio to find R1.

$R_1 = R_2 \cdot \frac{R_1}{R_2} = 1k \cdot 21.\overline{7272} = 21727\Omega$

Then we find that the correct value of R1 is 21727 ohms. These two resistor values will perfectly scale 25V down to 1.1V. However, they do not manufacture resistors in every imaginable value. The closest available value (E12 or E24 series) is 22k. If we were to use the 22k resistor with the 1k resistor it would give us an actual resistor ratio of 22 instead of our ideal 21.7272. In this case, we could probably live with that, because it would only mean that the top of our readable voltage range will be 25.3V instead of 25V.

$V_{in} = V_{out} (\frac{R_1}{R_2} + 1) = 1.1V \cdot (\frac{22k}{1k} + 1) = 25.3V$

If we want the ratio to be more accurate we should use the NightShade Resistor Calculator, which finds the pair of real resistor values that best matches the desired value. In the calculator, we choose the resistor series that we have available for prototyping (E12 or E24, most likely). Then we input our desired resistor ratio and the calculator finds the resistor combination (R1 and R2) that is closest to the desired ratio. The calculator matches our ratio by using a 390k and an 18k resistor for an actual ratio of 21.67. This ratio has only 0.28% error from our ideal ratio of 21.73. Our first try with the ratio of 22 has 1.26% error from the ideal ratio, so we were able to reduce the error by 78% using the calculator!

Finally, we have to consider the amount of current that we need to have flowing through our voltage divider to out-weigh the current leaving the circuit through Vout. If the microcontroller draws 1uA (0.000001A) from Vout, then we need to make sure that 100 times that amount of current flows through the divider continually. First, we check how much current will flow through our divider now. I am just going to calculate the current in our circuit at 25V, because we are really just interesting in the order of magnitude (10, 100, 1000, etc.).

$I = \frac{V}{R} = \frac{25V}{390k\Omega + 18k \Omega} = 0.000061A = 61 \mu A$

Here, we have calculated that there are only 61uA flowing through our resistor divider. This is less than the minimum 100uA (100*1uA) that we need. So, we need to reduce the resistance of our voltage divider, but we don’t want to mess up our ratio. Something neat about resistors is that every resistor value is available in every decade. For example, the 390k resistor is also available as 39k, 3.9k, 390, 39, and 3.9Ω. We can scal the top and bottom resistor by the same amount without changing the ratio of the voltage divider. So, instead of using the 390k and the 18k resistors, we will use a 39k and 1.8k resistors. By reducing the resistances by a factor of 10, we have increased the current flowing by a factor of 10.

$I = \frac{V}{R} = \frac{25V}{39k\Omega + 1.8k \Omega} = 0.000613A = 613 \mu A$

This gives us 610uA of current flowing through the divider, which is well over the 100uA minimum that we need.

## Try It Yourself!

In this example, the first two circuits are voltage dividers with ratios of 1 and 4. These create voltage reductions of 1/2 and 1/5. The third circuit is a very simple, adjustable voltage regulator. The regulator adjusts its output so that it sees 0.5V on its feedback pin. So, we adjust the voltage by creating a voltage divider that puts 0.5V on the feedback pin (Vout) when the output voltage is what we want. Here, we achieved an output voltage of 12V with a 1/24 voltage reduction. Now, there is 0.5V on the feedback pin with the voltage output is 12V.