PROJECTS/PRJ_02

4-bit R-2R Ladder DAC

Analog output from digital GPIO
COMPLETED3 weeks · 2025 Q2
ArduinoR-2R LadderAltiumBreadboardAnalog
4-bit R-2R Ladder DAC
// PRJ_02
// OVERVIEW

Project Overview

A 4-bit digital-to-analog converter built from an R-2R resistor ladder driven by an Arduino. Sweeps through all 16 binary combinations and produces evenly spaced analog voltage steps that were verified with a multimeter and scope.

Problem Statement

Understand DAC fundamentals — resolution, monotonicity, linearity — by building one from discrete components rather than using an on-chip peripheral.

Objectives
  • ›Design an R-2R ladder network with matched resistors
  • ›Drive the ladder from four GPIO pins in sequence
  • ›Verify 16 discrete output levels with lab instrumentation
  • ›Document non-idealities: source impedance, GPIO voltage drop
// ARCHITECTURE

System Architecture

Architecture

Four GPIO outputs feed an R-2R ladder whose Thevenin equivalent produces V_out = V_ref × N / 16. A small buffer stage isolates the ladder from downstream load.

Working Principle

Each GPIO contributes a weighted current into the ladder node. Summed via superposition, the node voltage encodes the 4-bit input as a fraction of V_ref.

// HARDWARE

Hardware Components

  • ▹Arduino Uno
  • ▹Precision 1% resistors (R and 2R pairs)
  • ▹Breadboard + jumper wires
  • ▹Digital multimeter, oscilloscope
// SOFTWARE

Software Stack

  • ▹Arduino IDE sketch cycling 0..15 on 4 GPIOs
// JOURNEY

Development Journey

Built the ladder on breadboard, characterised the output against theory, then documented deviations caused by GPIO drive strength and resistor tolerance.

// DECISION
R-2R over binary-weighted

R-2R uses only two resistor values → far easier to match and scales cleanly with resolution.

// CHALLENGES

Challenges & Solutions

// CHALLENGE
Non-linear steps at low codes
// SOLUTION

Traced to GPIO logic-low not being a true 0 V. Documented as a source-impedance effect rather than a design bug.

// RESULTS

Performance Results

// Resolution
4-bit / 16 levels
// Step size
≈ V_ref / 16
// Linearity
Monotonic across full sweep
// DOWNLOADS

Downloads

GitHub RepositoryProject Report (PDF)· pending
// FUTURE

Improvements & Lessons

Future Improvements
  • +Extend to 8-bit ladder for smoother output
  • +Add an op-amp output buffer with low output impedance
  • +Migrate the ladder to a proper PCB in Altium
Lessons Learned
  • ›GPIO voltage is not an ideal 0/3.3 V — real-world DACs must account for source impedance.
  • ›Component tolerance directly limits DAC linearity.