An ADC value-to-voltage calculator converts a digital analog-to-digital converter reading into an estimated input voltage. Enter the ADC code, the converter’s bit depth, and its reference voltage to get the voltage represented by that reading.
Formula
This calculator uses the common endpoint-scaled conversion formula:
Voltage = ADC code × reference voltage ÷ (2n − 1)
- ADC code is the integer output from the converter, from 0 through 2n − 1.
- n is ADC resolution in bits. An n-bit ADC has 2n possible codes.
- Reference voltage (Vref) is the voltage that defines the ADC’s full-scale range, in volts.
- Voltage is the estimated input voltage, in volts, for a unipolar ADC whose range starts at 0 V and ends at Vref.
The second output is the ADC code as a percentage of the maximum code. The calculator restricts the code to 0–1023, which is suitable for a 10-bit example; if using another resolution, adjust the code limit and bit-depth setting to match your ADC. The formula’s denominator changes with the bit depth.
Worked Example
With the calculator’s defaults, the code is 512, the resolution is 10 bits, and Vref is 5 V.
- Calculate the maximum code: 210 − 1 = 1023.
- Multiply the code by the reference voltage: 512 × 5 V = 2560 V.
- Divide by the maximum code: 2560 ÷ 1023 = 2.5024 V, rounded to four decimal places.
- Calculate full-scale percentage: 512 ÷ 1023 × 100 = 50.05%, rounded to two decimal places.
The estimated voltage is 2.5024 V, and the code is 50.05% of the maximum code.
How ADC Values Represent Voltage
An ADC samples an analog signal and encodes the result as a number. For an n-bit converter, the output has 2n possible code values. A 10-bit ADC therefore has 1024 codes, numbered 0 through 1023. More bits provide smaller code steps across the converter’s input range, although the actual accuracy also depends on the converter and circuit.
The code is not a perfectly precise measurement of the original voltage. Each digital code corresponds to a small voltage interval, often described as one least significant bit (LSB). The conversion formula assigns a single representative voltage to the code. The actual analog input may lie somewhat above or below that estimate within the code’s interval.
For a 10-bit ADC with a 5 V range, one ideal step is approximately 5 V ÷ 1024, or 4.883 mV. The endpoint formula maps code 1023 to exactly 5 V; consequently, the spacing between the displayed endpoint estimates is 5 V ÷ 1023, about 4.888 mV. These are related conventions, not contradictory measurements: one describes quantization-bin width, while the other scales the first and last code values to the range endpoints.
Choosing the Right Inputs
- ADC code: Use the raw integer code from the conversion result, not a percentage or a voltage already calculated by software. Check the ADC documentation for its output range and whether the result is left- or right-aligned in a register.
- Resolution: Enter the number of effective output bits used for the code. A 12-bit result has 4096 codes, from 0 to 4095; a 16-bit result has 65,536 codes, from 0 to 65,535.
- Reference voltage: Use the reference actually applied to the ADC, not automatically the supply voltage. Some devices use an internal reference or a separate external reference. If the reference varies, the voltage estimate varies with it.
- Input range: This calculator assumes a unipolar range of 0 V to Vref. A bipolar ADC, differential input, offset-binary output, or signed two’s-complement result needs its own transfer function and code interpretation.
The code limit in this calculator is set for 10 bits. For higher resolutions, raise the permitted code maximum to 2n − 1 before entering the reading. A code beyond that maximum cannot be a valid result at the selected resolution.
When This Conversion Is Useful
Converting a code back to volts helps interpret sensor measurements, check data logs, compare readings with a circuit’s expected signal, and estimate whether a signal is near the ADC’s full-scale limit. It is also useful when a program records raw ADC counts but a later analysis needs approximate engineering units such as volts.
Keep the signal path in mind. If a resistor divider, amplifier, attenuator, or sensor conditioning circuit changes the voltage before it reaches the ADC, this result is the voltage at the ADC input. To estimate the original signal, reverse the external circuit’s transfer relationship as a separate calculation. For example, a divider that halves a signal means the source voltage is about twice the ADC-pin voltage, assuming the divider and loading behave as expected.
Common Mistakes and Limitations
- Using the wrong reference: A mismatch between the entered Vref and the ADC’s actual reference creates a proportional error in the calculated voltage.
- Confusing bit depth with maximum code: A 10-bit ADC has 1024 possible values, but its largest code is 1023. Do not enter 1024 as a valid 10-bit code.
- Mixing volts and millivolts: Enter 3.3 for a 3.3 V reference, not 3300. Convert millivolts to volts by dividing by 1000.
- Assuming the result is exact: ADC quantization, reference tolerance, electrical noise, offset and gain errors, and nonlinearity can all affect a real measurement. The calculator applies an idealized conversion and does not correct those errors.
- Rounding too early: Keep the full code and reference precision through the calculation, then round the final display. Extra displayed decimal places do not mean the hardware measurement has that accuracy.
Some datasheets and software libraries use a denominator of 2n instead of 2n − 1. That convention treats each code as a quantization interval and is appropriate for certain interpretations of ADC output. Follow the specific converter’s documentation when matching its specified transfer function; the endpoint-scaled formula here is a convenient estimate that maps the lowest and highest codes to the stated range endpoints.
Frequently Asked Questions
How do I convert a 10-bit ADC value to voltage?
For a unipolar ADC, multiply the code by Vref and divide by 1023. For example, code 512 with a 5 V reference gives about 2.5024 V using endpoint scaling.
Why do some formulas divide by 1024 instead of 1023?
A 10-bit ADC has 1024 quantization levels, so some formulas use 1024 to calculate an ideal step or interval. The 1023 denominator maps code 0 to 0 V and code 1023 to Vref. Use the convention specified for your application or device.
Can an ADC reading equal the reference voltage?
The endpoint-scaled estimate assigns the maximum code to Vref. In a physical ADC, the highest code represents the top input range or a saturation region; the exact transition behavior depends on the device’s transfer specification.
What if my ADC reads a negative voltage?
This calculator does not handle negative or bipolar input ranges. Determine whether the ADC uses a differential input, offset-binary coding, or signed output, then use its documented range and code mapping.
Does ADC resolution tell me the measurement accuracy?
No. Resolution gives the number of digital codes, not the total measurement accuracy. Reference accuracy, noise, offset, gain error, linearity, and circuit design also influence how close a voltage estimate is to the true input.
Related
Formula used
in code | ADC code | - | 512 | 0 | 1023 in bits | ADC resolution | bits | 10 | 1 | 32 in vref | Reference voltage | V | 5 | 0.000001 out voltage | Estimated input voltage | V | code * vref / (2 ^ bits - 1) | 4 out percent | Fraction of full scale | % | code * 100 / (2 ^ bits - 1) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Philips DST7060/20 7000 Series Iron: Specs & Fit
- Coal Fueled Jet Aircraft: Could It Work?675 L
- Remote Desktop on Raspberry Pi: How to Enable It
- Word Select Last Line in Paragraph?
- Google Assistant IFTTT Recipes: 7 Useful Automations
- OLED TVs in Dark Rooms: Why They Look Better and When They Don’t