Skip to content

Check: DAC/PWM load filtering-2

Knowledge check · self-test

Check: DAC/PWM load filtering-2

Matching Quiz: DAC and PWM Concepts. A DAC selects a finite level for each code. The matching activity uses “smooth continuous” as shorthand; real outputs have discrete levels and error. PWM switches, and a filter reduces but does not eliminate ripple. { "pairs": [ , , , , , ], "difficulty": "medium", "explanation": "DACs produce true analog voltage using resistor networks, while PWM approximates analog output by varying the on-time fraction of a digital signal. The ESP32 uniquely offers both true DAC (GPIO25/26) and PWM on suitable output-capable GPIO pins, whereas Arduino Uno only provides PWM via analogWrite()." } PWM to Analog Pipeline Quiz. A filtered PWM output starts with a duty setting and a switching pin. The resistor and capacitor reduce the pulses. The ordering activity calls the result steady DC, but the actual settled waveform still has ripple; five time constants describes approximate transient settling. { "question": "Arrange the steps in the correct order to convert a digital value into a smooth analog voltage using PWM with RC filtering.", "items": [ "Microcontroller sets desired digital output value (0-255)", "PWM timer generates square wave with calculated duty cycle", "Digital pin toggles between HIGH and LOW at PWM frequency", "RC low-pass filter integrates the square wave over time", "Capacitor charges and discharges to smooth the ripple", "Filtered output reaches steady-state analog voltage after 5 RC time constants" ], "difficulty": "medium", "explanation": "The PWM-to-analog pipeline begins with a digital value that configures the PWM timer's duty cycle. The timer drives a GPIO pin as a square wave, which the RC filter then integrates. The capacitor smooths the switching transients, and after approximately 5 RC time constants, the output settles to a stable DC voltage equal to V_high times the duty cycle." } Checkpoint: Choosing DAC or PWM. Choose an output from the load’s needs. Check its allowed error, response time, driver, and available pins before deciding. Compare DAC and filtered PWM against the noise, bandwidth, and error limits of the audio or reference circuit. LEDs, motors, and heaters can respond to switched power with a suitable driver. A typical hobby servo decodes pulse width as a command instead of averaging it. Check the exact controller’s available pins, timers, and channel limits before choosing an output. Knowledge Check: DAC and PWM. A DAC selects an output level for a code. PWM switches between levels; its duty cycle and the load determine the response. DAC vs PWM for LED Brightness. An LED needs current control. A PWM driver can vary on-time across several channels if its rate and the viewing conditions meet the design requirement. ESP32 DAC: Digital to 2.59V. A DAC maps a digital code to an output level. On a classic ESP32, dacWrite(25, 200) selects code 200 on GPIO25. For a simple endpoint-scaled 3.3 V model, 200 / 255 × 3.3 V is about 2.59 V. This is an estimate: measure the real pin under its intended load and consult the device data sheet. An R-2R resistor ladder is one generic DAC architecture; its switched resistor network weights bits to produce a level. This illustration does not establish the ESP32’s internal circuit. PWM instead switches between levels. A motor may respond to those pulses directly, and filtered PWM can also carry audio when its filter and performance meet the application. A DAC is another possible audio source, not a requirement.

Back to the chapter →

Matching Quiz: DAC and PWM Concepts. A DAC selects a finite level for each code. The matching activity uses “smooth continuous” as shorthand; real outputs have discrete levels and error. PWM switches, and a filter reduces but does not eliminate ripple. { "pairs": [ , , , , , ], "difficulty": "medium", "explanation": "DACs produce true analog voltage using resistor networks, while PWM approximates analog output by varying the on-time fraction of a digital signal. The ESP32 uniquely offers both true DAC (GPIO25/26) and PWM on suitable output-capable GPIO pins, whereas Arduino Uno only provides PWM via analogWrite()." } PWM to Analog Pipeline Quiz. A filtered PWM output starts with a duty setting and a switching pin. The resistor and capacitor reduce the pulses. The ordering activity calls the result steady DC, but the actual settled waveform still has ripple; five time constants describes approximate transient settling. { "question": "Arrange the steps in the correct order to convert a digital value into a smooth analog voltage using PWM with RC filtering.", "items": [ "Microcontroller sets desired digital output value (0-255)", "PWM timer generates square wave with calculated duty cycle", "Digital pin toggles between HIGH and LOW at PWM frequency", "RC low-pass filter integrates the square wave over time", "Capacitor charges and discharges to smooth the ripple", "Filtered output reaches steady-state analog voltage after 5 RC time constants" ], "difficulty": "medium", "explanation": "The PWM-to-analog pipeline begins with a digital value that configures the PWM timer's duty cycle. The timer drives a GPIO pin as a square wave, which the RC filter then integrates. The capacitor smooths the switching transients, and after approximately 5 RC time constants, the output settles to a stable DC voltage equal to V_high times the duty cycle." } Checkpoint: Choosing DAC or PWM. Choose an output from the load’s needs. Check its allowed error, response time, driver, and available pins before deciding. Compare DAC and filtered PWM against the noise, bandwidth, and error limits of the audio or reference circuit. LEDs, motors, and heaters can respond to switched power with a suitable driver. A typical hobby servo decodes pulse width as a command instead of averaging it. Check the exact controller’s available pins, timers, and channel limits before choosing an output. Knowledge Check: DAC and PWM. A DAC selects an output level for a code. PWM switches between levels; its duty cycle and the load determine the response. DAC vs PWM for LED Brightness. An LED needs current control. A PWM driver can vary on-time across several channels if its rate and the viewing conditions meet the design requirement. ESP32 DAC: Digital to 2.59V. A DAC maps a digital code to an output level. On a classic ESP32, dacWrite(25, 200) selects code 200 on GPIO25. For a simple endpoint-scaled 3.3 V model, 200 / 255 × 3.3 V is about 2.59 V. This is an estimate: measure the real pin under its intended load and consult the device data sheet. An R-2R resistor ladder is one generic DAC architecture; its switched resistor network weights bits to produce a level. This illustration does not establish the ESP32’s internal circuit. PWM instead switches between levels. A motor may respond to those pulses directly, and filtered PWM can also carry audio when its filter and performance meet the application. A DAC is another possible audio source, not a requirement.

Back to DAC and PWM: Loads, Filters, and Code: Explain the Choice From the Load