DAC Fundamentals: Turning Digital Numbers into Analog Voltages

2026-04-30

Every time your microcontroller needs to produce a true analog voltage — driving an audio speaker, setting a control voltage for a VCO, or commanding an analog actuator — you need a digital-to-analog converter (DAC). Let's look at how they actually work at the circuit level.

The R-2R Ladder: The Simplest Practical DAC

The most elegant DAC topology you can build on a breadboard is the R-2R resistor ladder. It uses only two resistor values: R and 2R. Each digital bit drives a node through a 2R resistor, and successive nodes are connected through R resistors to ground. The network exploits superposition — each bit contributes a binary-weighted fraction of the reference voltage to the output.

For an N-bit R-2R DAC with reference voltage Vref, the output voltage is:

Vout = Vref × (D / 2N)

where D is the decimal value of the digital input. An 8-bit DAC with a 3.3V reference and digital input of 128 (midscale) gives: 3.3 × 128/256 = 1.65V. The smallest voltage step (1 LSB) is 3.3/256 ≈ 12.9 mV.

Real-World Example: Audio Output from a Microcontroller

Many hobbyists use an 8-bit R-2R ladder on GPIO pins to generate audio waveforms. Using 10kΩ and 20kΩ resistors (or two 10kΩ in series for 2R), you wire 8 GPIO pins through the ladder and buffer the output with an op-amp voltage follower. At a 44.1 kHz update rate, this produces audible waveforms — crude but functional for tones and simple sound effects.

Critical Practical Considerations

Rule of thumb: If you need more than 8 bits of accuracy, stop building discrete ladders and use a dedicated DAC IC like the MCP4921 (12-bit, SPI, under $2). The matched internal resistors and built-in output buffer will outperform anything you can achieve with off-the-shelf discretes.

See it in action: Check out Basics of Testing Data Converters by Professor Jennifer Hasler's Circuit Lectures to see this theory applied.
Key Takeaway: An R-2R ladder is a practical way to build a basic DAC from two resistor values, but resistor tolerance limits you to about 8 bits before a dedicated DAC IC becomes the smarter choice.

All newsletters