Electronics & Circuits · Study deck

DAC and PWM: Output Foundations

A digital pin cannot produce every analog voltage on its own.

Voltage Vera is your guide for this deck.

analogdigitaloutput
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 DAC Operation: Describe how digital-to-analog converters translate binary values into proportional voltages
  • Apply DAC Formulas: Calculate output voltage from digital input using the DAC transfer equation
  • Implement PWM Output: Generate pulse width modulation signals as pseudo-analog output for actuator control
  • Design RC Filters: Compute component values for low-pass filters that convert PWM to smooth analog voltage
iotclass.org

Major section

Start Simple

The computer holds a number, but the lamp needs voltage, current, and safe timing.

  • The path between them decides whether the physical result matches the command.
  • An analog-to-digital converter means a circuit that turns a voltage into a number; it is called an ADC.
  • Modulation means changing a signal to carry or control information.

Key terms

Pulse-width modulation
Pulse-width modulation means control made by changing how long a signal stays on; it is called PWM.
iotclass.org

Major section

Start Simple (continued)

A digital-to-analog converter (DAC) means a circuit that turns a number into a voltage or current.

  • Pulse-width modulation means control made by changing how long a signal stays on; it is called PWM.
  • An actuator means a part that creates a physical action.
  • This runway does not size a driver or prove smooth motion.
iotclass.org

Major section

Phoebe's Field Notes: Why PWM Can Behave Like a DAC

The mathematical gist.: An 8-bit endpoint DAC on 5 V has step $q=5/255=19.6$ mV and code 153 gives 3.00 V.

  • PWM instead gives $V_{avg}=DV_{high}$.

Numbers to remember

3.00 Vcode 153 gives 3.00 V.
75%At 75% duty that is 3.75 V
3.75 VAt 75% duty that is 3.75 V
iotclass.org

Major section

Digital-to-Analog Converters (DAC)

The drawing communicates dAC conversion contract from bounded digital code through reference and transfer function to measured analog output.

  • For digital-to-analog converters (dac), these labels identify the boundary where an assumption must become a calculation or measurement.
DAC conversion contract from bounded digital code through reference and transfer function to measured analog output
DAC conversion contract from bounded digital code through reference and transfer function to measured analog output
iotclass.org

Major section

Putting Numbers to It

For an 8-bit DAC with $V_{ref} = 5$ V, the step size (resolution) is $V_{step} = V_{ref} / (2^n: 1) = 5 / 255 = 19.6$ mV.

  • To output 3.0V, you need digital value $D = \lfloor V_{out} \times (2^n: 1) / V_{ref} \rfloor = \lfloor 3.0 \times 255 / 5 \rfloor = 153$.
  • Actual output is $V_{actual} = 153 \times 5 / 255 = 3.0$ V exactly.
  • With a 12-bit DAC ($2^{12}: 1 = 4095$), step size shrinks to $5 / 4095 = 1.22$ mV -- 16× finer than 8-bit, enabling smooth audio waveforms where 8-bit would sound grainy.
iotclass.org

Major section

Quantization Error in DAC

Quantization appears because an N-bit DAC can produce only one of $2^N$ code levels.

  • Increasing bit depth reduces that vertical step; increasing update rate reduces the time between code changes but does not create new voltage levels.
  • A low-pass filter can attenuate step edges and PWM carrier energy, yet it also changes bandwidth, settling time, and load response.
  • Problem:: DAC output is not truly analog - it's discrete steps.
iotclass.org

Deck summary

Key takeaways

The computer holds a number, but the lamp needs voltage, current, and safe timing.

  • A digital-to-analog converter (DAC) means a circuit that turns a number into a voltage or current.
  • The mathematical gist.: An 8-bit endpoint DAC on 5 V has step $q=5/255=19.6$ mV and code 153 gives 3.00 V.
  • The drawing communicates dAC conversion contract from bounded digital code through reference and transfer function to measured analog output.
  • For an 8-bit DAC with $V_{ref} = 5$ V, the step size (resolution) is $V_{step} = V_{ref} / (2^n: 1) = 5 / 255 = 19.6$ mV.
iotclass.org

Retrieval practice

Recall check 1 of 2

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

Q1A plant lamp receives a PWM command. What should the designer examine to predict its physical output?

AThe ADC resolution as the output-drive capability
BThe software value without testing supply changes
CDuty cycle, load response, ripple, and timing
DThe command number as a measured output voltage
Show answer

Answer: C PWM creates pulses that the load or filter averages; the load’s response matters.

iotclass.org

Retrieval practice

Recall check 2 of 2

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

Q2A design smooths PWM pulses into an analog-like control signal. What choice does the chapter ask the learner to evaluate?

AWhether a digital command removes analog constraints
BPWM smoothing versus a true DAC for the load
CWhether sensing alone completes the control system
DWhether more input samples supply load current
Show answer

Answer: B The chapter compares output methods and the trade-off introduced by filtering pulses.

iotclass.org

Print reference

Answers

Answer key.

  1. C · PWM creates pulses that the load or filter averages; the load’s response matters.
  2. B · The chapter compares output methods and the trade-off introduced by filtering pulses.
iotclass.org