DevGizmo
Back to Blog
electronics·

DAC Explained: Converting Digital Values to Voltage

A Digital-to-Analogue Converter (DAC) turns binary numbers into precise voltages. Learn how DAC resolution, reference voltage, and output codes work — with practical worked examples and common chip comparisons.

dacdigital-to-analogueelectronicsembedded-systemssignal-generation

What Is a DAC?

A Digital-to-Analogue Converter (DAC) is the opposite of an ADC. Where an ADC reads a voltage and converts it to a digital number, a DAC takes a digital number and produces a proportional analogue voltage. DACs are essential wherever a digital system must interact with the analogue world:

  • Audio playback — MP3 files are digital data; your speakers need an analogue signal
  • Waveform generation — producing sine waves, ramps, or arbitrary signals from a microcontroller
  • Motor control — setting a voltage reference for a motor driver
  • Calibration outputs — generating precise reference voltages in test equipment
  • Display brightness control — producing an analogue voltage to drive a backlight

How a DAC Works

A DAC converts an n-bit digital input code into an analogue voltage according to:

Vout = (Code / 2ⁿ) × Vref

Where:

  • Code is the input value (0 to 2ⁿ − 1)
  • n is the number of bits (resolution)
  • Vref is the full-scale reference voltage

Worked Example: 8-bit DAC, Vref = 5V

Maximum code = 2⁸ − 1 = 255. Input code = 128:

Vout = (128 / 256) × 5V = 0.5 × 5V = 2.5V

Exactly half the reference voltage. Code 0 outputs 0V; code 255 outputs:

Vout = (255 / 256) × 5V ≈ 4.98V

Note: a DAC can never output exactly Vref — the maximum output is one LSB below it.

Worked Example: 12-bit DAC, Vref = 3.3V

Code = 2048 (mid-scale):

Vout = (2048 / 4096) × 3.3V = 0.5 × 3.3V = 1.65V

LSB Voltage: The Smallest Step

The voltage change per code increment (Least Significant Bit value) is:

LSB = Vref / 2ⁿ

This is the smallest voltage change the DAC can produce.

ResolutionVrefLSB size
8-bit5V19.53 mV
10-bit3.3V3.22 mV
12-bit3.3V0.806 mV
16-bit5V76.3 µV

Higher resolution allows smoother signal generation. For audio, 16-bit at 44.1kHz (CD quality) gives 65,536 voltage steps — smooth enough that step transitions are inaudible.

DAC Resolution: How Many Bits Do You Need?

The required resolution depends on the application:

  • PWM substitute (servo, LED dimming): 8–10 bits is usually enough
  • Audio output: 16-bit minimum for CD quality; 24-bit for studio work
  • Signal generation (function generator): 12–16 bits for clean waveforms
  • Precision voltage reference: 12–16 bits, often with external Vref
  • Calibration outputs: 16–24 bits for lab-grade accuracy

Types of DAC Architecture

R-2R Ladder DAC

Uses a resistor ladder network where each bit switches a resistor in or out. Inexpensive, easy to implement with discrete components, and widely used in low-to-medium resolution applications.

String DAC (Resistor String)

A chain of equal resistors forms a voltage divider; a multiplexer selects the tap point. Used in LCD drivers and lower-resolution applications where monotonicity is critical.

Sigma-Delta (ΔΣ) DAC

Oversamples at a much higher rate than required and uses noise shaping to achieve very high resolution. Used in audio DACs (PCM5102, CS4398) and precision instruments. High resolution (24-bit+) but lower maximum frequency.

Current Steering DAC

Switches binary-weighted current sources; the output current is converted to a voltage via a load resistor. Fast, used in RF applications and high-speed signal generation.

Common DAC Chips

ChipBitsInterfaceVrefNotes
MCP472512-bitI²CInternal/externalPopular, low cost, non-volatile register
DAC757112-bitI²CExternalTexas Instruments, rail-to-rail
MCP492112-bitSPIExternalSingle channel, buffered output
PCM510232-bitI²SInternalAudio DAC, used in HiFi projects
DAC855216-bitSPIExternalDual channel, precision
AD568516-bitSPIInternal/externalQuad channel, Analog Devices

DAC vs PWM: When to Use Which

Many microcontrollers use PWM (Pulse-Width Modulation) as a low-cost substitute for a true DAC. A filtered PWM signal approximates a DC voltage, but with limitations:

FeatureTrue DACPWM + filter
SpeedFast (µs)Slow (requires RC filter settling time)
NoiseLow (no switching)Switching noise from PWM frequency
Resolution12–24 bit8–16 bit (limited by timer)
CostRequires external ICFree (built into MCU)
ComplexitySimple to useRequires filter design

Use a true DAC when you need a stable, low-noise voltage or audio-quality output. PWM is fine for motor speed control, LED brightness, or servo positioning.

Practical Tips

  1. Buffer the DAC output — most DACs have a limited output current. Use an op-amp voltage follower to drive low-impedance loads.
  2. Decouple the supply — place 100nF and 10µF capacitors from VCC to GND close to the DAC.
  3. Use a precision external reference for critical applications — the internal Vref can drift ±0.1% or more with temperature.
  4. Account for glitches — when the input code changes, transient spikes can occur as internal switches transition. Deglitch circuits or sample-and-hold stages are used in professional systems.
  5. Check output settling time in the datasheet — this limits the maximum waveform frequency you can generate.

Use the DAC Calculator

The DAC Calculator on DevGizmo lets you enter bit depth, reference voltage, and input code to instantly calculate output voltage and LSB size. Presets for popular chips like the MCP4725 and DAC8552 are included.

Related Reading

Try it yourself

Put these concepts into practice with the free online tool on DevGizmo.