Calculator KB-44
ADC calculator
What analogRead actually measures and what code you'll get for your voltage.
Result
In brief: Microcontroller ADC calculations: resolution in millivolts, code value for a given voltage, voltage divider for measuring higher voltages, and theoretical signal-to-noise ratio. Example: Least significant bit value: 4.883 mV.
Calculation example
| Resolution | 10 bit |
|---|---|
| Reference voltage | 5 V |
| Measured voltage | 3.3 V |
| Least significant bit value | 4.883 mV |
|---|---|
| ADC code | 675 |
| At the ADC input | 3.3 V |
| Can measure up to | 5 V |
| Step size including divider | 4.883 mV |
| Theoretical signal-to-noise ratio | 62 dB |
How it is calculated
N = U / LSB
SNR = 6,02 · n + 1,76 dB
The ADC divides the range from zero to the reference voltage into 2ⁿ steps and outputs the step number. Accuracy is often determined not by the resolution, but by the stability of the reference voltage and power supply noise.
What to look for
- The ADC input voltage must not exceed the reference voltage or the supply voltage: doing so can damage the pin.
- The ESP32 ADC is noticeably nonlinear, especially near the ends of its range. Calibration is needed for accurate measurements.
Frequently asked questions
How many volts per ADC count on an Arduino Uno?
10 bits with a 5 V reference: 5 / 1024 = 4.883 mV per count. An input of 3.3 V gives a reading of 675.
How do you measure 12 V with an ADC using a 3.3 V reference?
Use a voltage divider: 10 kΩ and 2.2 kΩ reduce 12 V to 2.16 V, extending the measurement range to 18.3 V. One step of a 12-bit ADC then corresponds to about 4.5 mV at the input.
Why are ESP32 ADC readings inaccurate?
Its response is nonlinear, especially near the ends of the range, and the reference voltage varies between chips. Calibration is needed; for accurate measurements, use an external ADC such as the ADS1115.
