Arduino MCP4725 Digital to Analog Converter Tutorial

Zero to Five in 1.2 mV Increments

This could be a useful device if you find you need to create a programmable voltage.

It has 12 bits of resolution and is controllable via I2C.

Where to Find One

These are readily available from the following sources.  I’ve seen them as low as $2.40 USD… less than a price of a Starbucks coffee.

eBay     Amazon     Bang Good     Ali -Express

MCP4725 Pin Outs

The VCC connects the chip VDD pin.   What’s important to understand is that this not supplies power to the chip, but it acts as the reference voltage as well.

Arduino MCP4725 Module Pin Outs


MCP4725 Specification Notes

Arduino MCP4725 DAC Resolution

This is a 12 bit DAC converter.   What this means is that it will accept up to 4096 possible inputs to provide an analog output,  where an output value of zero is zero and an output value of 4095 is full scale.

Full scale is determined by the reference voltage you supply to the VCC pin.  That supply voltage can be anywhere from 2.7 volts to 5.5 volts.

Thus the equation to determine the value of the Least Significant Bit (LSB) is:

1 LSB = VCC Voltage / 4096

What you can see from this is that voltage resolution improves with a lower supply voltage.   For example, if you never have to output more than 3.3 volts,  you might want to use a 3.3 volt supply.

MCP4725 Power Requirements

With no load on the output,  the MCP4725 will draw no more than 0.4 mA from the power source.  The typical draw is about 0.21 mA.

MCP4725 Output Current Limits

The device can supply no more than 25 mA to a load.  For many applications,  that will not be enough to act as a device power source.

Arduino MCP4725 DAC Tutorial

Download and Install the Adafruit MCP4725 Library

To run this tutorial,  you will want to install the Adafruit library found HERE.

If you’re not familiar with with adding or installing libraries,  I suggest this article for the Arduino folks.

Connecting Your Arduino the MCP4725

MCP4725 Arduino Module Tutorial Hook Up

Get Your MCP4725 I2C Address

The little Chinese MCP4725 breakout I have is at address 0x60.    The Adafruit style comes with address 0x62.

Once you’ve connected your I2C device, I recommend scanning for your I2C address using the code found HERE.

Copy Paste and Upload the MCP4725 Tutorial Code

Here is what is happening:

 – We’re incrementing the DAC by 15 from zero to full scale

–  We’re measuring the output of the DAC using an analog pin.

– We’re calculating what we think we have as an output from the DAC and what the Arduino claims we have.

– We’re displaying the results.

#include <Wire.h>
#include <Adafruit_MCP4725.h>
#define voltsIn A0

Adafruit_MCP4725 dac; // constructor

void setup(void) {
  dac.begin(0x60); // The I2C Address: Run the I2C Scanner if you're not sure  

void loop(void) {
    uint32_t dac_value;
    int adcValueRead = 0;
    float voltageRead = 0;
    float dac_expected_output;
    for (dac_value = 0; dac_value < 4096; dac_value = dac_value + 15)
      dac_expected_output = (5.0/4096.0) * dac_value;
      dac.setVoltage(dac_value, false);
      adcValueRead = analogRead(voltsIn);
      voltageRead = (adcValueRead * 5.0 )/ 1024.0;
      Serial.print("DAC Value: ");
      Serial.print("\tExpected Voltage: ");
      Serial.print("\tArduino ADC Value: ");
      Serial.print("\tArduino Voltage: ");      

Verify Your MCP4725 Tutorial Output

Since I have incremented my MCP4725 DAC by fifteen bits,  the expected output voltage increases by about 18 mV.

The actual value measured by the Arduino corresponds pretty closely in terms of scaling.  The output is also within about 15mV.  Not too bad.   There are host of reasons for this that include the accuracy of each device separately.

More, keep in mind that this tutorial uses the 5V out from the Arduino as a reference, which really isn’t all that accurate.

Arduino MCP4725 Tutorial Output