A research plot outside Potchefstroom logs its 12 V battery with an ESP32, and the charger pushes that battery to nearly 15 V on a sunny afternoon. The ADC pin takes 3.3 V at most, so two resistors bring the voltage down, sized for the highest voltage, not the label. This calculator works out the output from a pair, or the pair for a safe output. Sensors and their wiring are on Arduino sensors.
Two resistors and a ratio
The top resistor runs from the input to the output point and the bottom one from there to ground. The output is the input x bottom / (top + bottom), so only the ratio sets the voltage. The total sets the current, which flows all the time the input is there: low values waste a battery, very high ones leave the ADC reading drift because its input needs a fairly low source impedance. 10 kΩ to 100 kΩ in total suits most ADCs.
Worked example: 12 V through 30 kΩ and 10 kΩ
The first mode starts at 12 V with 30 kΩ on top and 10 kΩ below, read by a 12 bit ADC on a 3.3 V reference:
| Figure | Result |
|---|---|
| Output | 3.000 V, a ratio of 0.25 |
| Current | 0.3 mA |
| Power, top and bottom | 2.7 mW and 0.9 mW |
| One ADC count at the input | 3.22 mV |
| Full scale | 13.2 V in |
That pair is fine at 12 V, but at 15 V on charge it gives 3.75 V, over the pin's limit and past full scale. Hence the second mode.
Picking a pair from the highest voltage
Type the highest input, 15 V, the safe output, 3.3 V, and a total of 10 kΩ to 100 kΩ. The tool tries every E24 pair in that range and keeps the one with the highest output that stays at or under the target: 39 kΩ over 11 kΩ, exactly 3.300 V at 15 V and 0.3 mA. That sits right on the target, so use 1% parts or aim a little lower. The table runs common jobs: 5 V to 3.3 V is 4.7 kΩ over 9.1 kΩ, 24 V to 3.3 V is 27 kΩ over 4.3 kΩ, and 9 V to 5 V is 12 kΩ over 15 kΩ.
Signals only, and reading them well
A divider is for measuring, never for powering a board or a sensor: the output sags as soon as current is drawn from it. A small capacitor from the pin to ground steadies a high value divider. ESP32 ADCs are not linear near the ends of their range, so check the reading against a multimeter and correct it in code. Battery nodes are covered on ESP32.
Frequently asked questions
How do I bring a 5 V sensor signal down to 3.3 V?
For a slow signal such as an analogue output or an echo pin, a divider of about 4.7 kΩ over 9.1 kΩ does it. Fast two way lines such as I2C need a proper level shifter instead, because a divider only works in one direction.
Can I power my circuit from a voltage divider?
No. The output only holds while almost no current is drawn. Use a regulator or a buck converter for power and keep dividers for signals.
Which resistor values should I use?
Keep the total between about 10 kΩ and 100 kΩ for most ADC pins. Lower values waste current; above about 1 MΩ the reading drifts and lags. The microcontroller's datasheet gives the source impedance its ADC wants.
Who will quote me for sensor wiring or a measurement board in Potchefstroom?
Makers, embedded developers and electronics shops who work in and around Potchefstroom. Send the request on this page with the voltages and what you want to measure; we pass it on and they quote you directly. We design, build and sell nothing ourselves.
Read more
More tools
- Resistor colour codeFour, five or six colour bands, or a value, tolerance and band count: the resistance, its tolerance range, the bands in order and the nearest E12 and E24 values
- LED resistor calculatorSupply voltage, LED colour or forward voltage, current and LEDs in series: the exact resistor, the nearest E12 and E24 values, the current they give and the power rating
- Battery life calculatorBattery capacity, usable share, awake and sleep currents, awake time and wakes per hour, and an optional solar panel: average current, hours, days and whether the panel keeps up
- Stepper motor calculatorStep angle, microstepping, belt and pulley or lead screw, speed and motor current: steps per mm, resolution, step rate, rpm and the driver's reference voltage
- PCB trace width calculatorCurrent, copper weight, temperature rise, layer and trace length: the minimum width in mm and mil, the trace's resistance, voltage drop and power lost
- Board pickerLogic voltage, pins, analogue inputs, radio, camera, Linux, battery and the kind of job: a short list of three board families with a reason for each
- PLC I/O calculatorField devices, spare capacity and module sizes: digital and analogue I/O counts with spare, the modules to fit and the points left free
