What Is the DAC? Wiring and Errors (2026 Guide)
Share
What Is the DAC? Wiring and Errors (2026 Guide)
A DAC (Digital-to-Analog Converter) turns a number in your code into a true, smooth voltage on a pin — the opposite of an ADC, which reads a voltage and gives you a number. On an ESP32, dacWrite(25, 128) literally puts 1.65V on GPIO25, and sweeping the value from 0 to 255 gives you a clean ramp from 0V to 3.3V.
Quick answer: A DAC outputs a real continuous voltage from a number in code, unlike PWM, which only fakes an analog level with a switching square wave. The ESP32 DevKit has two 8-bit DAC channels on GPIO25 and GPIO26 (0–3.3V). A classic Arduino Uno R3 has no DAC at all — PWM only.
Proof of work: the explanation and code below are Soldr's actual answer to "What is the DAC and how do I use it?", asked through Compoden's AI build assistant on 11 August 2026. Published 11 August 2026 · Last updated 11 August 2026.
Why isn't PWM good enough when you need a real analog voltage?
PWM only fakes an analog level by switching a pin on and off very fast — fine for LEDs and motor speed, where your eye or a motor's inertia averages the pulses out. It's useless the moment you need a genuinely continuous signal: audio output, a waveform generator, or driving an analog meter or VCO. That's specifically the DAC's job — a real voltage on the pin, not an average of pulses.
| Board | DAC? | Notes |
|---|---|---|
| ESP32 DevKit (30-pin) | Yes — 2 channels | GPIO25 and GPIO26, 8-bit, 0–3.3V. Great for sweeps, tones, and lo-fi audio; not hi-fi territory |
| Arduino Uno R4 | Possibly — check your variant | The R4 line has a DAC on A0 (12-bit, 0–5V) on some variants, but it's not consistently listed in catalog data — verify against the datasheet before relying on it |
| Arduino Uno R3 (classic) | No | PWM only, no true DAC on this board |
How do you sweep a voltage out on an ESP32's DAC pin?
Wire a multimeter or an LED (with a current-limiting resistor) to GPIO25 and you'll watch the voltage glide up smoothly as the value ramps. This is the exact sketch from Soldr's session:
void setup() {
Serial.begin(115200);
Serial.println("[SOLDR] dac-demo | board:ESP32 | v1");
Serial.println("[INIT] DAC: OK (GPIO25/GPIO26)");
}
void loop() {
// ramp up 0-255 then down 255-0, ~5ms per step
for (int v = 0; v <= 255; v++) {
dacWrite(25, v);
Serial.print("[DATA] v="); Serial.println(v);
delay(5);
}
}
Captured verbatim from the session's Firmware tab. The comment describes a ramp up and down, but only the up-ramp loop was visible in the capture — the down-ramp (a mirrored loop counting 255 back to 0) follows the same pattern and was not independently re-created here to avoid presenting a guess as Soldr's own output.
Why does dacWrite not compile or do nothing on my board?
dacWrite() is an ESP32-specific function — it doesn't exist on the classic Arduino Uno R3 core at all, so the most common failure is simply targeting the wrong board with DAC code copied from an ESP32 tutorial. The second common issue is pin choice: only GPIO25 and GPIO26 are wired to DAC hardware on the ESP32, and calling dacWrite on any other pin will not produce the expected output.
What do you need to try this yourself?
An ESP32 30-Pin Development Board (CP2102, WiFi/Bluetooth) (Rs.400) gives you both DAC channels ready to go — no extra parts needed to watch GPIO25's voltage sweep on a multimeter.
Frequently asked questions
DAC aur PWM mein kya fark hai?
DAC ek real, continuous voltage output karta hai directly - koi switching nahi. PWM ek digital pin ko bahut fast on/off karke average voltage jaisa effect banata hai, jo LED dimming jaise kaamon ke liye kaafi hai lekin audio ya waveform jaise real analog signal ke liye kaam nahi karta.
Does the Arduino Uno have a built-in DAC?
The classic Uno R3 does not — it has PWM-capable pins but no true digital-to-analog converter. Some Arduino Uno R4 variants add a 12-bit DAC on pin A0, but this isn't consistently documented across catalog listings, so check your specific board's datasheet before building a project around it.
What is the price of an ESP32 board with a DAC in India?
The ESP32 30-Pin Development Board (CP2102, WiFi/Bluetooth) costs Rs.400 at Compoden, with cash on delivery available across India. It includes both DAC channels (GPIO25, GPIO26) with no extra parts needed. Prices checked 11 August 2026.
Is the ESP32's DAC good enough for audio?
It's 8-bit, which is enough for simple tones, sweeping control voltages, and lo-fi audio playback, but it's not hi-fi territory — an 8-bit DAC has noticeably more quantization noise than the 16-bit or better DACs used in dedicated audio hardware. For quality audio output, most projects add an external I2S DAC module instead.