MCP4725 I²C DAC Sine Generator

A 12-bit DAC on the I²C bus turns an Arduino into a function generator — pump out clean sines, ramps, or arbitrary waveforms.

Difficulty: Breadboard. Estimated build time: about 45 minutes. Estimated parts cost: about US$3.80. 4-line bill of materials. Compare supplier offers when available. A simple function generator built around the MCP4725, a single-channel 12-bit DAC with an I²C interface.

Wire the I²C bus and power

VDD → 5 V, GND → GND. SDA on the breakout → A4 on the Uno; SCL → A5. The breakout has 10 kΩ pull-ups already on board so you don't need to add any. The default I²C address is 0x60 — toggle the A0 pin to get 0x61 if you need two DACs on the same bus. Add a 100 nF decoupling cap from VDD to GND right at the chip.

Install the Adafruit MCP4725 library

Open Library Manager in the Arduino IDE and install 'Adafruit MCP4725'. The library wraps the I²C protocol with a simple API: dac.setVoltage(value, false). The 'false' tells the chip not to write to EEPROM — for waveform generation we just want fast volatile updates, the EEPROM is rated for only 1 million writes.

Generate a sine via lookup table

In setup() initialise the DAC at address 0x60 and start the I²C bus at 400 kHz (Wire.setClock(400000)). In loop(), iterate i from 0 to 63 and call dac.setVoltage(sine_table[i], false), then loop. A 64-entry table at 400 kHz I²C gets you about 1.4 kHz output frequency. Probe pin OUT with a scope — you should see a clean sine.