Interactive ADC Resolution Calculator
Try Leave ADC Resolution (bits) at 12 and Reference Voltage (V) at 3.3, then drag Input Voltage (V) past 3.3 to cross the reference.
Observe The opening 2.0 V input produces code 2482 out of 4095. Above the reference, the warning appears and the code stops at the maximum.
Explain Reference Voltage (V) divided by the number of levels gives the step size; the input divided by that step is rounded down and capped.
Calculate ADC code
Reset
Technical boundaries. Conversion assumes an ideal floor quantizer with 1–24 bits and no noise or calibration error. Inputs above the reference are clamped before reconstruction error is calculated.
Interactive ADC Resolution Calculator
Use the sliders below to explore how bit depth, reference voltage, and input voltage affect ADC output values.
viewof adcBits = Inputs. range ([1 , 24 ], {value : 12 , step : 1 , label : "ADC Resolution (bits)" })
viewof adcVref = Inputs. range ([0.5 , 5.0 ], {value : 3.3 , step : 0.1 , label : "Reference Voltage (V)" })
viewof adcVin = Inputs. range ([0 , 5.0 ], {value : 2.0 , step : 0.01 , label : "Input Voltage (V)" })
adcLevels = Math . pow (2 , adcBits)
adcStepSize = adcVref / adcLevels
adcClampedVin = Math . min (adcVin, adcVref)
adcDigitalValue = Math . min (Math . floor (adcClampedVin / adcStepSize), adcLevels - 1 )
adcReconstructed = adcDigitalValue * adcStepSize
adcQuantError = adcClampedVin - adcReconstructed
adcMaxQuantError = adcStepSize
html `<div style="background: #f8f9fa; border: 2px solid #2C3E50; border-radius: 8px; padding: 1.2em; margin: 1em 0; font-family: Arial, sans-serif;">
<h4 class="depth-l1" style="margin-top:0; color: #2C3E50;">ADC Conversion Results</h4>
${ adcVin > adcVref ? html `<p style="color: #E74C3C; font-weight: bold;">Warning: Input voltage ( ${ adcVin. toFixed (2 )} V) exceeds Vref ( ${ adcVref. toFixed (1 )} V). Clamped to Vref.</p>` : "" }
<table style="width:100%; border-collapse: collapse; font-size: 0.95em;">
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #16A085;">Total Discrete Levels</td>
<td style="padding: 6px; text-align: right;"> ${ adcLevels. toLocaleString ()} </td>
</tr>
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #16A085;">Voltage Step Size (LSB)</td>
<td style="padding: 6px; text-align: right;"> ${ adcStepSize >= 0.001 ? (adcStepSize * 1000 ). toFixed (3 ) + " mV" : (adcStepSize * 1e6 ). toFixed (3 ) + " uV" } </td>
</tr>
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #E67E22;">Digital Output Value</td>
<td style="padding: 6px; text-align: right;"> ${ adcDigitalValue} / ${ adcLevels - 1 } </td>
</tr>
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #E67E22;">Binary Output</td>
<td style="padding: 6px; text-align: right; font-family: monospace;"> ${ adcDigitalValue. toString (2 ). padStart (adcBits, '0' )} </td>
</tr>
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #3498DB;">Reconstructed Voltage</td>
<td style="padding: 6px; text-align: right;"> ${ adcReconstructed. toFixed (4 )} V</td>
</tr>
<tr style="border-bottom: 1px solid #ddd;">
<td style="padding: 6px; font-weight: bold; color: #3498DB;">Quantization Error</td>
<td style="padding: 6px; text-align: right;"> ${ (adcQuantError * 1000 ). toFixed (3 )} mV</td>
</tr>
<tr>
<td style="padding: 6px; font-weight: bold; color: #9B59B6;">Maximum floor-model quantization error (0 to <1 LSB)</td>
<td style="padding: 6px; text-align: right;"> ${ adcMaxQuantError >= 0.001 ? (adcMaxQuantError * 1000 ). toFixed (3 ) + " mV" : (adcMaxQuantError * 1e6 ). toFixed (3 ) + " uV" } </td>
</tr>
</table>
<p style="margin-bottom:0; font-size: 0.85em; color: #7F8C8D;">Formula: Digital Value = floor(Vin / (Vref / 2^n)) | Step Size = Vref / 2^n</p>
</div>`
Back to the chapter