Reference
MCP4725
12-bit DAC analog output.
- Connects over
- I²C
- Address
- 0x60 (or 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67)
- Made by
- Microchip
- Datasheet
- ww1.microchip.com
Use it
hardware {
device mcp4725: MCP4725
}
every 1s {
mcp4725.write(1)
}
On its own, the declaration puts the MCP4725 on the first I²C bus (SDA 21, SCL 22 on the ESP32) at 0x60. To choose the pins or the address, declare the bus and attach the device: device mcp4725: MCP4725 on i2c0 at 0x61 with i2c i2c0(sda: 21, scl: 22).
Methods
-
mcp4725.write(value: int)
Set DAC value 0-4095
-
mcp4725.set_voltage(voltage: float, vref: float)
Set output voltage
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
GND | Ground |
SDA | Pull-up to VCC (often on breakout board) |
SCL | Pull-up to VCC |
OUT | Analog output (0V to VCC) |
A0 | Address LSB: 0x60 (GND) or 0x61 (VCC) |
Specifications
- Voltage
- 2.7V – 5.5V
- Current
- 210 μA active, 60 nA powerdown
- Resolution
- 12-bit (4096 steps)
- Output
- Rail-to-rail (VCC defines max output)
- Interface speed
- I²C up to 3.4 MHz
Tips
- EEPROM stores last value — survives power cycle if you write to EEPROM (slower).
- Output impedance is ~1 Ω — drives loads down to ~1 kΩ without a buffer.
- For audio: writing samples at 22 kHz works but isn't an audio DAC — it's a slow control DAC.
Alternatives worth knowing:
- MCP4922: Dual 12-bit SPI version — two outputs in one chip.