Electronics & Circuits · Study deck

ADC and DAC: Interactive Design Calculators

A converter setting changes counts, volts, and error at once.

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: The mathematical gist.: An ideal N-bit ADC has step q=V_{ref}/2^N, peak rounding error q/2, RMS quantisation noise q/√(12), and ideal ceiling 6.02N+1.76 dB.
  • 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.
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 = $-123 - (-77.2) = 45.8\,\text{dB}$ → SF7 works comfortably.
  • OLED: I2C interface (needs SDA + SCL).
  • Battery voltage: Analog input (needs ADC).
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.

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 (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 N-bit ADC has step q=V_{ref}/2^N, peak rounding error q/2, RMS quantisation noise q/√(12), and ideal ceiling 6.02N+1.76 dB.
  • That order connects a headline bit count to the physical resolution the measurement chain can actually defend.
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 6

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

Q1Place each ADC stage where it lives in the conversion path so you can explain whether an error entered during capture, comparison, or code delivery.

AAnalog input
BSample and hold
CSAR conversion engine
DDigital output
Show answer

Answer: A The conversion map separates holding the analogue evidence, resolving it against a reference, and exporting a code so you can locate quantisation and timing errors.

iotclass.org

Retrieval practice

Recall check 2 of 6

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

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 91.3 dB (using FSPL(dB) = 20log10(d) + 20log10(f) - 147.55)
BAbout 9.13 dB
CAbout 147.55 dB, because that is the constant subtracted in the formula
DAbout 913 dB
Show answer

Answer: A

iotclass.org

Retrieval practice

Recall check 3 of 6

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 sleep current dominates battery life, even though the transmit current (30 mA) is far higher than the sleep current (1 uA)?

ABecause each transmit burst lasts only 40 ms while the device sleeps for nearly all of the roughly 10-minute gap between messages, so the tiny sleep current accumulates over far more total time than the brief active pulses
BBecause the battery-life formula in this chapter ignores transmit current entirely
CBecause 30 mA is actually a smaller number than 1 uA in the units this chapter uses
DBecause EU868's 1% duty cycle rule caps the transmit current itself at 1 uA
Show answer

Answer: A 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 4 of 6

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 5 of 6

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 6 of 6

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, because reducing steps from ~0.08 degC to ~0.005 degC makes the reported value closer to the true temperature.
BYes, because 16-bit resolution eliminates the sensor's tolerance.
CNo, because the LM35 output noise would use the extra codes and make the 16-bit reading less accurate.
DNo meaningful gain: 0.005 degC steps are far finer than the sensor's +/-0.5 degC accuracy.
Show answer

Answer: D 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 2

Answer key.

  1. A · The conversion map separates holding the analogue evidence, resolving it against a reference, and exporting a code so you can locate quantisation and timing errors.
  2. A
  3. A · 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.
  4. 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

Print reference

Answers 2 of 2

Answer key.

  1. 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.
  2. D · Resolution below the sensor's accuracy band is wasted; the extra bits report changes smaller than the sensor's own error.
iotclass.org