Voltage divider and ADC scaling

Output voltage, ADC code, source impedance, and standard E12/E24/E96 resistor pairs.

How to use it

  1. Type the input voltage and the two resistors (R1 at the top, R2 at the bottom).
  2. Set the ADC reference and its bits to see the output, the ADC code, the current and the source impedance the ADC sees.
  3. Pick an E12, E24 or E96 series to get standard resistor pairs for the ratio you need, best first.

Questions

How do I scale a battery voltage (KL30) into an ADC?

Type the highest voltage the input can reach as the input voltage and choose R1 and R2 so the output stays under the ADC reference; the output turns red when it does not. The firmware scale (volts per count) converts the ADC reading back.

Why does the source impedance matter?

The ADC’s sampling capacitor charges through the divider. Above the impedance the microcontroller’s datasheet allows, readings come out low unless you lengthen the sampling time or add a capacitor at the pin.

What can I type?

Values take engineering prefixes: 4k7 or 4.7k, 100n, 2.2u, 1M. The inputs are kept in the address, so “Copy link” shares the result.

Related tools

Lessons that explain it

Also useful for: resistor divider, e24, e96, battery voltage, kl30, vref.