Electronics & Circuits · Study deck
ADC and DAC: Conversion Calculations
An ADC turns a voltage into a digital count.
Voltage Vera is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Calculate ADC Output: Compute digital values from analog voltage inputs using the ADC conversion formula
- Select Reference Voltages: Evaluate and match Vref to sensor output ranges for maximum resolution
- Quantify Quantization Error: Derive measurement precision limits across different ADC resolutions
- Determine Nyquist Sampling Rates: Compute minimum and practical sampling frequencies for specific signal types
Major section
Start Simple
The test engineer must show how one known input becomes both outputs without hiding a reference value, scale factor, unit change, or rounding choice.
- Reverse the calculation to see whether the reported value can recover the original within the stated limit.
- A distant chart may show the result, but it cannot restore resolution lost at conversion.
- This opening does not cover every converter design.
Major section
Phoebe's Field Notes: Where the Converter Numbers Come From
The mathematical gist: A 10-bit, 3.3 V ADC has q=Vref/210=3.22 mV.
- At 1.65 V, the chapter's endpoint rule gives D=⌊(1.65/3.3)1023⌋=511, reconstructing 1.648 V within half an LSB.
Major section
ADC Conversion Formula
The visual is specifically about aDC conversion showing how continuous analog voltage is sampled and quantized into discrete digital steps.
- These visible labels explain aDC conversion showing how continuous analog voltage is sampled and quantized into discrete digital steps.
- They keep adc conversion formula tied to evidence that can be inspected on the schematic, part, or trace.
Major section
Quantization Error Example
Quantization error is the inherent inaccuracy introduced when converting continuous analog signals to discrete digital values.
- Where LSB (Least Significant Bit) is the smallest voltage change the ADC can detect.
- Under the floor rule above, 1.650 V gives code 511, while 1.653 V gives code 512.
- Effective bits increase by log2(N)/2.
Major section
ESP32 Soil Moisture Example
Scenario: A smart irrigation system uses a capacitive soil moisture sensor that outputs 1.2V (dry) to 2.8V (saturated).
- You need to determine optimal ADC configuration on an ESP32 to detect 1% moisture changes for water-efficient farming.
- Key Insight: Proper attenuation selection is critical.
- Using 0 dB attenuation (0-1.1V range) would clip the signal, while 11 dB provides headroom.
Major section
Ultrasonic Distance Example
Scenario: An autonomous robot uses an HC-SR04 ultrasonic sensor for obstacle detection.
- The echo pulse width (10us to 25 ms) must be measured accurately.
- You need to determine if ADC-based measurement or timer-based capture is appropriate.
- Key Insight: ADCs are for converting analog voltage levels to digital values.
Major section
For Kids: Meet the Sensor Squad!
Math helps the Sensor Squad turn real-world measurements into exact numbers!
- Temperature Terry was measuring the temperature of a fish tank. "It is 25 degrees Celsius!
- ADC Andy looked at the signal. "Okay, I need to turn that into a number Max can understand.
- One quarter of 1023 is about 255.
Major section
For Kids: Meet the Sensor Squad! (continued)
the microcontroller was curious. "How do you figure out which step number matches 0.250 volts?".
- So 0.250 volts is one quarter of the way.
- So I tell Max: the reading is 255!".
- the LED wanted to know more. "And how does Max turn 255 back into a temperature?".
Major section
For Kids: Meet the Sensor Squad! (continued)
That gives me about 25 degrees -- exactly what Sammy measured!".
- the battery chimed in. "But what if you only had 256 steps instead of 1024?".
- Andy nodded. "Then each step would be a bigger jump -- about 0.4 degrees instead of 0.1 degrees.
- I would be less precise.
Major section
ADC Input Impedance Pitfall
The upper path connects a weak source directly; the lower path inserts a buffer.
- The red cross marks the direct path, whose reading may be biased when the converter samples.
- In the lower path the added amplifier drives the converter input so it can settle.
- No 5–10% error can be inferred without acquisition timing.
Major section
ADC Input Impedance Pitfall (continued)
The high-resistance source may give an inaccurate reading if the ADC input does not settle during acquisition.
- The divider example below shows why source resistance matters even when the steady voltage looks right.
- The ESP32 ADC has an internal sample-and-hold capacitor that draws charging current during conversion.
- Acts as local charge reservoir.
Major section
ADC Input Impedance Pitfall (continued)
A 2 kΩ upper / 1 kΩ lower divider gives about 1.67 V from 5 V and 667 Ω source resistance.
- The Error: You use a 200 kΩ upper and 100 kΩ lower divider to bring a 5 V sensor output to about 1.67 V for an ESP32 ADC.
- High-impedance sources (like voltage dividers with large resistors) may not settle in the available acquisition time, biasing the reading toward a prior sample voltage when acquisition is too short.
- Dependence on the previous sample or acquisition time can reveal settling error; a consistently low value alone does not identify its cause.
Deck summary
Key takeaways
The test engineer must show how one known input becomes both outputs without hiding a reference value, scale factor, unit change, or rounding choice.
- The mathematical gist: A 10-bit, 3.3 V ADC has q=Vref/210=3.22 mV.
- The visual is specifically about aDC conversion showing how continuous analog voltage is sampled and quantized into discrete digital steps.
- Quantization error is the inherent inaccuracy introduced when converting continuous analog signals to discrete digital values.
- Scenario: A smart irrigation system uses a capacitive soil moisture sensor that outputs 1.2V (dry) to 2.8V (saturated).
Retrieval practice
Recall check 1 of 5

Voltage Vera says: answer from memory, then check your reasoning.
Q1A 10-bit ADC has a 5V reference voltage. What is the voltage resolution (step size)?
Show answer
Answer: A The ideal code step is V_ref / 2^bits = 5V / 1024 = 0.00488V = 4.88mV. Actual detectable changes also depend on input noise and converter error.
Retrieval practice
Recall check 2 of 5

Voltage Vera says: answer from memory, then check your reasoning.
Q2A sensor signal reaches three kilohertz. What is the theoretical minimum sample rate before allowing filter margin?
Show answer
Answer: B Sampling must be at least twice the highest signal frequency.
Retrieval practice
Recall check 3 of 5

Voltage Vera says: answer from memory, then check your reasoning.
Q3A dimmer should look evenly spaced to a person. How should its lookup table map desired brightness to output code?
Show answer
Answer: C The curve compensates for nonlinear brightness perception.
Retrieval practice
Recall check 4 of 5

Voltage Vera says: answer from memory, then check your reasoning.
Q4A 12-bit ADC with Vref = 3.3V measures 2.0V. What is the digital output?
Show answer
Answer: D Output = floor((2.0V / 3.3V) x (2^12 - 1)) = floor((2.0 / 3.3) x 4095) = floor(2481.8) = 2481. The 12-bit ADC divides the 0-3.3V range into 4096 steps (0-4095).
Retrieval practice
Recall check 5 of 5

Voltage Vera says: answer from memory, then check your reasoning.
Q5An 8-bit DAC with Vref = 3.3V receives digital input 192. What is the output voltage?
Show answer
Answer: D V_out = V_ref x (Digital_Input / (2^bits - 1)) = 3.3V x (192 / 255) = 3.3V x 0.753 = 2.48V. The 8-bit DAC can output 256 discrete voltage levels (0-255), and we scale the digital value proportionally.
Print reference
Answers 1 of 2
Answer key.
- A · The ideal code step is V_ref / 2^bits = 5V / 1024 = 0.00488V = 4.88mV. Actual detectable changes also depend on input noise and converter error.
- B · Sampling must be at least twice the highest signal frequency.
- C · The curve compensates for nonlinear brightness perception.
- D · Output = floor((2.0V / 3.3V) x (2^12 - 1)) = floor((2.0 / 3.3) x 4095) = floor(2481.8) = 2481. The 12-bit ADC divides the 0-3.3V range into 4096 steps (0-4095).
Print reference
Answers 2 of 2
Answer key.
- D · V_out = V_ref x (Digital_Input / (2^bits - 1)) = 3.3V x (192 / 255) = 3.3V x 0.753 = 2.48V. The 8-bit DAC can output 256 discrete voltage levels (0-255), and we scale the digital value proportionally.