Electronics & Circuits · Study deck
DAC and PWM: Loads, Filters, and Code
A PWM waveform may look smooth until the load draws current.
Voltage Vera is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: An 8-bit DAC has 12.9 mV steps at 3.3V, but typical INL of +/-1 LSB means actual output can deviate by +/-12.9 mV from the ideal.
- Explain: A common 0.22uF capacitor with 10k ohm resistance gives about 72 Hz cutoff, which is still low enough to smooth a 1 kHz PWM signal but responds more slowly.
- Explain: the microcontroller had a new challenge. "I know the motor needs to spin at 50% speed, and I can think in numbers like 128 out of 255.
Major section
Load Experience with PWM/DAC
Switch to PWM + RC filter, then increase capacitance; the output gets smoother but responds more slowly.
- Lower PWM frequency below the filter cutoff; the ripple warning should appear.
Major section
PWM to Analog Conversion (RC Filter)
Result:: The ideal 100 Hz design gives 0.159uF.
- A common 0.22uF capacitor with 10k ohm resistance gives about 72 Hz cutoff, which is still low enough to smooth a 1 kHz PWM signal but responds more slowly.
- f_cutoff should be 10-20x below PWM frequency.
- Settling time = 5 x RC (to reach 99% of target).
Major section
DAC Resolution vs Accuracy
An 8-bit DAC has 12.9 mV steps at 3.3V, but typical INL of +/-1 LSB means actual output can deviate by +/-12.9 mV from the ideal.
- For precision applications, use a higher-resolution DAC (12-bit or 16-bit) and calibrate against a known reference voltage.
- ESP32 built-in DAC has approximately +/-1% accuracy without calibration.
- Rule of Thumb: Usable accuracy is typically 2-3 bits fewer than advertised resolution once all error sources are combined.
Major section
For Kids: Meet the Sensor Squad!
I want to glow at half brightness, but I need a smooth amount of power, not a number!".
- DACs are like translators who speak the language of motors and lights!
- the battery was impressed. "So you are a reverse translator!".
- Danny pointed to his friend PWM Pete. "Pete has a clever trick!
Major section
For Kids: Meet the Sensor Squad! (continued)
the microcontroller had a new challenge. "I know the motor needs to spin at 50% speed, and I can think in numbers like 128 out of 255.
- When Max says 128, I convert that into 1.65 volts -- just the right amount to make Lila glow at half brightness.".
- But Temperature Terry noticed something. "Wait, Danny, you are not on every microcontroller.
- Lila blinked. "I had no idea!
Major section
DAC/PWM Actuator Control
DAC Resolution (8-bit) -> ADC Resolution: Both use the same $2^n$ idea.
- An 8-bit DAC has 256 output levels, while a 12-bit ADC has 4,096 input levels.
- PWM Duty Cycle -> Motor Speed Control: Average voltage is $V_{high} \times duty\_cycle$, so motors respond to the average energy delivered, not each individual pulse.
- Cross-module connection: PWM Actuator Control: Explains how DC motors respond to PWM average voltage via back-EMF and inductance.
Deck summary
Key takeaways
Switch to PWM + RC filter, then increase capacitance; the output gets smoother but responds more slowly.
- Result:: The ideal 100 Hz design gives 0.159uF.
- An 8-bit DAC has 12.9 mV steps at 3.3V, but typical INL of +/-1 LSB means actual output can deviate by +/-12.9 mV from the ideal.
- I want to glow at half brightness, but I need a smooth amount of power, not a number!".
- the microcontroller had a new challenge. "I know the motor needs to spin at 50% speed, and I can think in numbers like 128 out of 255.
Retrieval practice
Recall check 1 of 2

Voltage Vera says: answer from memory, then check your reasoning.
Q1A PWM signal at 5V with a 75% duty cycle produces what average voltage?
Show answer
Answer: B
Q2An ESP32 DAC channel outputs a value of 200 with a 3.3V reference. What is the approximate output voltage?
Show answer
Answer: C V_out = V_ref x (Digital Input / (2^n - 1)) = 3.3V x (200 / 255) = 3.3V x 0.784 = 2.59V. The ESP32 has an 8-bit DAC, so the maximum digital input is 255.
Retrieval practice
Recall check 2 of 2

Voltage Vera says: answer from memory, then check your reasoning.
Q3You're dimming 10 LEDs to 50% brightness. Your ESP32 has 2 DAC pins and 16 PWM-capable GPIOs. What's the best approach?
Show answer
Answer: B PWM at 1kHz is imperceptible to the human eye (critical flicker frequency ~60-100Hz).
Print reference
Answers
Answer key.
- B
- C · V_out = V_ref x (Digital Input / (2^n - 1)) = 3.3V x (200 / 255) = 3.3V x 0.784 = 2.59V. The ESP32 has an 8-bit DAC, so the maximum digital input is 255.
- B · PWM at 1kHz is imperceptible to the human eye (critical flicker frequency ~60-100Hz).