Arduino driver for the Microchip MCP4725 12-bit DAC.
The MCP4725 provides a high-resolution analog voltage output using a digital I²C interface, making it ideal for signal generation, calibration, and analog control applications.
-
12-bit DAC output (0–4095)
-
Fast mode
-
EEPROM write mode
-
Power-down modes support
The MCP4725 communicates using I²C interface.
| MCP4725 Pin | MCU Pin | Notes |
|---|---|---|
| VCC | 3.3V / 5V | Supply voltage |
| GND | GND | Common ground |
| SDA | SDA | I²C data |
| SCL | SCL | I²C clock |
| A0 | GND / VCC | Address select |
-
Default I²C address:
0x62 -
Supported bus speeds:
- 100 kHz
- 400 kHz (recommended)
-
Arduino Library Manager
- Open Arduino IDE
- Go to Library Manager
- Search for 7Semi MCP4725
- Click Install
-
Manual Installation
- Download this repository as ZIP
- Arduino IDE → Sketch → Include Library → Add .ZIP Library
dac.setVoltage(2.5);- Sets DAC output in volts
dac.setAnalogOut(2048);- Range: 0 → 4095
float voltage;
dac.getVoltage(voltage);- Returns current output voltage
dac.setVRef(3.3);- Must match actual supply voltage for accuracy
uint64_t serial;
dac.setMode(MCP4725_FAST_MODE);- MCP4725_FAST_MODE → Fast update (volatile)
- MCP4725_WRITE_DAC_EEPROM → Persistent output
uint16_t value;
dac.readEEPROM(value);uint16_t value;
dac.readEEPROM(value);dac.setPowerDown(1);- 0 → Normal operation
- 1 → 1kΩ pull-down
- 2 → 100kΩ pull-down
- 3 → 500kΩ pull-down