Voltage Divider Calculator: Output Voltage, or the Best E24 Resistor Pair for a Target Voltage
A voltage divider uses two resistors to scale a voltage down: reading a battery voltage with an ADC, dropping a 5 V signal to 3.3 V, or making a reference voltage. This calculator works both ways: known resistors → output voltage, or target voltage → the closest pairs of standard E24 resistors.
The formula
R1 sits between the input and the output, and R2 between the output and ground:
Vout = Vin × R2 ÷ (R1 + R2)
Example: Vin = 5 V, R1 = 10 kΩ, R2 = 20 kΩ gives Vout = 5 × 20 ÷ 30 ≈ 3.33 V, with about 0.17 mA flowing through the divider all the time.
In "pick resistors" mode, the calculator tries every E24 value for R2, works out the R1 that would be needed, rounds it to the nearest E24 value, and lists the three pairs with the smallest output error. Pairs that give the same ratio are listed once, and ties go to a total resistance near 20 kΩ.
How big should the resistors be?
- Too small wastes current, which matters on battery power.
- Too large makes the output sensitive to whatever it's connected to, and to noise. Microcontroller ADCs want a fairly low source impedance: the ATmega328P (Arduino Uno) datasheet recommends 10 kΩ or less. If you need higher values, a small capacitor (for example 0.1 µF) from the ADC pin to ground helps stabilize readings.
- Loads pull the voltage down. Anything connected to the output is effectively in parallel with R2. A divider is fine for signals, but if the load draws real current, use a regulator instead.
Common uses
- Measuring a battery: two 18650 cells in series reach about 8.4 V when full, which has to be scaled below 5 V before an Arduino analog pin can read it. My mecanum-wheel robot runs on three 18650 cells, the kind of pack where this is useful.
- 5 V to 3.3 V logic (one-way, low speed): R1 = 10 kΩ and R2 = 20 kΩ turn a 5 V output into about 3.3 V for an ESP32 input. For fast or bidirectional signals such as I²C, use a proper level-shifter module.
Worked examples
Example 1: reading a 12 V battery with an ESP32
Say the battery can reach 14.4 V while charging, and you want about 2.5 V at the ADC when the battery is at 12 V. R1 goes from the battery to the measurement node, R2 from the node to ground. Pick R2 = 10 kΩ; rearranging Vout = Vin × R2 ÷ (R1 + R2) gives R1 = 10 × (12 ÷ 2.5 − 1) = 38 kΩ. The nearest E24 value is 39 kΩ.
Checking: at 12 V, Vout = 12 × 10 ÷ 49 = 2.449 V (−2.0% from target), and the divider draws 12 ÷ 49 kΩ = 0.245 mA. At the 14.4 V maximum, Vout = 14.4 × 10 ÷ 49 = 2.939 V and the current is 0.294 mA. Power at the maximum is about 3.4 mW in R1 and 0.86 mW in R2, so any 1/8 W resistor is fine.
Still check the usable range for your ESP32 model and ADC attenuation setting, and include resistor tolerance when you check the worst-case output. A 3.3 V supply doesn't mean the ADC is accurate all the way to 3.3 V.
Example 2: bringing a 5 V signal down to about 3.3 V
Vin = 5 V, target 3.3 V, using E24 values R1 = 5.1 kΩ and R2 = 10 kΩ. Total resistance is 15.1 kΩ, so Vout = 5 × 10 ÷ 15.1 = 3.311 V, +0.34% from target.
The current is 5 ÷ 15.1 kΩ = 0.331 mA, with about 0.56 mW in R1 and 1.1 mW in R2. This assumes the receiving input draws negligible current. The two boards must share ground, and you should confirm the receiver's input voltage limits and logic thresholds.
Common mistakes
- Swapping R1 and R2: the numerator is the ground-side resistor, R2. Swap them and the ratio changes completely.
- Using only the nominal battery voltage: check the input limit at the highest voltage the source can reach.
- Using a divider as a power supply: any load sits in parallel with R2 and pulls the output down. Dividers are for signals, not for powering modules.
- Making the resistors huge to save power: a very high source impedance can upset ADC sampling, and it won't work for fast or bidirectional signals.
Comments
Post a Comment