Electronics & Circuits · Study deck

ADC and DAC: Interactive Design Calculators

An ADC turns an input voltage into a digital count; a DAC turns a digital count into an output voltage.

Voltage Vera is your guide for this deck.

analogdigitalesp32
Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: This page turns those examples into a measurement contract: each count must map to a physical unit, and the chosen reference and bit depth must match the sensor's real range and accuracy.
  • Explain: More converter bits help only when one code step is smaller than the physical change the decision must detect and the rest of the measurement path is good enough.
  • Explain: ADC resolution matters only if one code step is smaller than the change the product needs to detect, and accuracy still depends on the sensor, reference, noise, and calibration.
iotclass.org

Major section

Reference: ESP32 Pinout, Power, and Signal Formula Cheat Sheet

A correct equation cannot rescue a pin that is wired to the wrong function or outside its safe range.

  • An analog-to-digital converter is a circuit that turns a voltage into a number.
  • ADC is its short name.
  • DAC means a digital-to-analog converter that turns a number into a voltage.

Key terms

I2C
I2C is a shared two-wire link for nearby parts.
iotclass.org

Major section

Reference: ESP32 Pinout, Power, and Signal Formula Cheat Sheet (continued)

I2C is a shared two-wire link for nearby parts.

  • SPI is a clocked link with separate data paths.
  • UART is a simple serial link that sends timed bits between two endpoints.
  • This runway does not certify a board, radio link, or battery life.
  • DHT22: 1-wire digital protocol (needs any GPIO).
iotclass.org

Major section

Reference: ESP32 Pinout, Power, and Signal Formula Cheat Sheet (continued)

The cards below provide compact calculations and pin facts; the surrounding chapters explain tolerances, loading, timing, protection, and field measurement.

  • SF7 sensitivity is -123 dBm → link margin = −77.2−(−123)=45.8 dB-77.2 - (-123) = 45.8\,\text{dB}−77.2−(−123)=45.8dB → SF7 works comfortably.
  • OLED: I2C interface (needs SDA + SCL).
  • Battery voltage: Analog input (needs ADC).
ADC resolution comparison for a 0 to 3.3 volt analog signal showing 8-bit, 12-bit, and 16-bit converters with their value counts, voltage step sizes, and speed-power-accuracy tradeoff.
ADC resolution comparison for a 0 to 3.3 volt analog signal showing 8-bit, 12-bit, and 16-bit converters with their value counts, voltage step sizes, and speed-power-accuracy tradeoff.
iotclass.org

Major section

ADC Resolution and Vref Contracts

More converter bits help only when one code step is smaller than the physical change the decision must detect and the rest of the measurement path is good enough.

  • An analog-to-digital converter is a circuit that turns a measured voltage into a number; ADC is its short name.

Key terms

Pulse-width modulation
Pulse-width modulation is rapid on-off switching that varies average drive; PWM is its short name.

Why it matters

Each increase enlarges the codebook and reduces the ideal voltage step, but it can also demand more conversion time, power, and analogue quality.

Oscilloscope in a real physical setting
Oscilloscope in a real physical setting
iotclass.org

Major section

ADC Resolution and Vref Contracts (continued)

A digital-to-analog converter is a circuit that turns a number into an output level; DAC is its short name.

  • Pulse-width modulation is rapid on-off switching that varies average drive; PWM is its short name.
  • This runway does not prove accuracy from resolution alone.
  • ADC resolution matters only if one code step is smaller than the change the product needs to detect, and accuracy still depends on the sensor, reference, noise, and calibration.
iotclass.org

Major section

ADC Resolution and Vref Contracts (continued)

ADC/DAC Worked Examples teaches the formula-by-formula workflow for converter calculations, sampling, DAC output, PWM approximation, and verification.

  • This page turns those examples into a measurement contract: each count must map to a physical unit, and the chosen reference and bit depth must match the sensor's real range and accuracy.
  • The mathematical gist: An ideal NNN-bit ADC has step q=Vref/2Nq=V_{ref}/2^Nq=Vref​/2N, peak rounding error q/2q/2q/2, RMS quantisation noise q/12q/\sqrt{12}q/12​, and ideal ceiling 6.02N+1.766.02N+1.766.02N+1.76 dB.
  • That order connects a headline bit count to the physical resolution the measurement chain can actually defend.
iotclass.org

Major section

Component Tolerance Matters

Resistors have tolerances (typically +-1% to +-5%).

  • A 10 kohm 5% resistor may be 9.5-10.5 kohm.
  • For a voltage divider, the output error depends on the tolerance and ratio of both resistors, rather than automatically equalling either resistor’s ±5% tolerance.
  • For precision circuits (ADC references, calibration circuits), use 1% or 0.1% tolerance resistors and verify the circuit's sensitivity to component variations.
iotclass.org

Deck summary

Key takeaways

A correct equation cannot rescue a pin that is wired to the wrong function or outside its safe range.

  • I2C is a shared two-wire link for nearby parts.
  • The cards below provide compact calculations and pin facts; the surrounding chapters explain tolerances, loading, timing, protection, and field measurement.
  • More converter bits help only when one code step is smaller than the physical change the decision must detect and the rest of the measurement path is good enough.
  • A digital-to-analog converter is a circuit that turns a number into an output level; DAC is its short name.
iotclass.org

Retrieval practice

Recall check 1 of 5

Voltage Vera says: answer from memory, then check your reasoning.

Q1What continuous sensor voltage is presented to the converter before sampling?

ASample and hold
BAnalog input
CSAR conversion engine
DDigital output
Show answer

Answer: B The continuous sensor voltage is the evidence presented to the converter.

Q2According to the Formula Cards reference in this chapter, roughly how much free-space path loss should a link expect at 1 km and 868 MHz?

AAbout 9.13 dB after misplacing a decimal in the logarithm terms
BAbout 147.55 dB by treating the formula's constant as its result
CAbout 913 dB after shifting the correct path-loss decimal
DAbout 91.3 dB of path loss for the 1 km, 868 MHz link
Show answer

Answer: D see answers page

iotclass.org

Retrieval practice

Recall check 2 of 5

Voltage Vera says: answer from memory, then check your reasoning.

Q3In this chapter's 5-year LoRaWAN battery-life example, why does the 'Key insight' say TX current dominates battery life, even though each transmit burst lasts only 40 ms?

ABecause the chapter's battery formula omits TX current and counts only sleep current.
BBecause 30 mA is smaller than 1 µA after the chapter converts its radio-current units.
CBecause 30 mA over 5.76 s/day adds about 2 µA average, versus about 1 µA from sleep.
DBecause the EU868 duty-cycle limit caps TX current at 1 µA rather than TX time.
Show answer

Answer: C The worked example transmits for only 40 ms per message at 6 messages/hour, so the radio is active for a tiny fraction of each hour and asleep for nearly all of it.

iotclass.org

Retrieval practice

Recall check 3 of 5

Voltage Vera says: answer from memory, then check your reasoning.

Q4A 12-bit ADC with Vref = 3.3 V reads an LM35 temperature sensor (10 mV/degC). What temperature does one ADC step (1 LSB) correspond to?

AAbout 10 degC, equal to the sensor's 10 mV/degC number.
BAbout 0.08 degC, because LSB = 3.3 / 4096 = 0.806 mV.
CAbout 0.806 degC, equal to the LSB in millivolts.
DIt cannot be found without the sample rate.
Show answer

Answer: B LSB = 3.3 / 4096 = 0.806 mV; dividing that by the 10 mV/degC sensitivity gives about 0.0806 degC per step.

iotclass.org

Retrieval practice

Recall check 4 of 5

Voltage Vera says: answer from memory, then check your reasoning.

Q5Keeping a 12-bit ADC but switching the reference from 3.3 V to 1.1 V for an LM35 reading changes what?

AResolution and span both improve, with no downside.
BNothing changes, because resolution depends only on the 12 bits.
CEach step becomes ~3x finer (0.081 -> 0.027 degC).
DThe sensor's sensitivity changes from 10 mV/degC to 3 mV/degC.
Show answer

Answer: C LSB = Vref / 4096 scales with Vref, so a smaller reference gives finer steps and a proportionally smaller span; choose the smallest reference that still covers your range.

iotclass.org

Retrieval practice

Recall check 5 of 5

Voltage Vera says: answer from memory, then check your reasoning.

Q6Your LM35 reading uses a 12-bit ADC (~0.08 degC per step). Someone proposes a 16-bit ADC to get ~0.005 degC steps. The LM35 is accurate to about +/-0.5 degC. Is this worthwhile?

AYes: finer 0.005 °C codes must make the LM35 reading closer to true temperature.
BYes: a 16-bit ADC removes the LM35's inherent ±0.5 °C tolerance.
CNo meaningful accuracy gain: 0.005 °C steps are far below the LM35's ±0.5 °C error.
DNo: input noise automatically makes a 16-bit conversion less accurate.
Show answer

Answer: C Resolution below the sensor's accuracy band is wasted; the extra bits report changes smaller than the sensor's own error.

iotclass.org

Print reference

Answers 1 of 3

Answer key.

  1. B · The continuous sensor voltage is the evidence presented to the converter.
  2. D · The chapter's Formula Cards give FSPL(dB) = 20log10(d) + 20log10(f) - 147.55 and state the worked value directly: at 1 km and 868 MHz, path loss is about 91.3 dB. Recomputing: 20log10(1000) + 20log10(868,000,000) - 147.55 = 60 + 178.8 - 147.55 = about 91.3 dB.
iotclass.org

Print reference

Answers 2 of 3

Answer key.

  1. C · The worked example transmits for only 40 ms per message at 6 messages/hour, so the radio is active for a tiny fraction of each hour and asleep for nearly all of it.
  2. B · LSB = 3.3 / 4096 = 0.806 mV; dividing that by the 10 mV/degC sensitivity gives about 0.0806 degC per step.
  3. C · LSB = Vref / 4096 scales with Vref, so a smaller reference gives finer steps and a proportionally smaller span; choose the smallest reference that still covers your range.
iotclass.org

Print reference

Answers 3 of 3

Answer key.

  1. C · Resolution below the sensor's accuracy band is wasted; the extra bits report changes smaller than the sensor's own error.
iotclass.org