Works on this device
Adc Voltage Calculator
An analog-to-digital converter (ADC) turns a voltage into a whole number, its code. This calculator turns a code back into the voltage it stands for, a voltage into the code an ideal converter gives, and a known voltage and its code into the reference voltage.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Calculate.
Your result
How it was worked out
How to use this calculator
- Choose the direction: code to voltage, voltage to code, or the reference voltage.
- Enter the number of bits and the input range. For 0 to 3.3 V, the top is 3.3 and the bottom 0. For −5 V to +5 V, the top is 5 and the bottom −5.
- Choose the code format: straight binary (0 at the bottom of the range) or two's complement (0 in the middle), and how the converter rounds.
- Type a code as a number (2048), a hexadecimal pattern (0x800) or a binary pattern (0b100000000000).
- Under More options, choose the step size: range ÷ 2^N (the usual definition) or range ÷ (2^N − 1).
The formulas
- Step size: LSB = (top − bottom) ÷ 2^N, or (top − bottom) ÷ (2^N − 1) if your data sheet or course uses that convention.
- Code to voltage: V = bottom + k × LSB, where k is the step number from the bottom of the range. For two's complement, k = code + 2^(N−1).
- Voltage to code: k = (V − bottom) ÷ LSB, rounded to the nearest whole number (halves go up), or rounded down for a converter that truncates. Inputs beyond the range give the first or the last code.
- Band of a code: with rounding, a code covers ½ LSB on each side of its voltage; with truncation, from its voltage up to one LSB above.
- Reference from a known input: Vref = V × 2^N ÷ code (or × (2^N − 1) ÷ code), for a range that starts at 0 V.
Worked examples
12 bits, 0 to 3.3 V, code 2048: LSB = 3.3 ÷ 4096 = 0.8057 mV, so the code stands for 2048 × 0.8057 mV = 1.65 V. With rounding it covers 1.64960 V to 1.65040 V.
2.71828 V into the same converter: 2.71828 ÷ 0.8057 mV = 3373.96, which rounds to code 3374 (0xD2E). That code stands for 2.71831 V.
Reference: a known 1.1 V input that reads 1365 on a 12-bit converter gives Vref = 1.1 × 4096 ÷ 1365 = 3.3008 V.
Limits you should know
- The converter is ideal: equal steps, no offset, gain or linearity error, and no noise. A real converter is off by a few LSB; its data sheet says by how much.
- Converters differ in how they round and which step size they use. The data sheet of your converter decides.
- For the step size, the dynamic range and the ideal SNR, use the Adc Resolution Calculator. To scale a sensor signal, see the 4 to 20 Ma Calculator.