Arduino DAC programing

Hi! I am trying to get a Digital to Analog Converter working with my arduino. I had an Adafruit MCP4725 12 Bit I2C DAC working fine but then one day it started outputting just 2.45 volts and would not change voltage no matter what I did. I thought that I might have burnt out the board so I decided to get a new one a HiLetgo MCP4725 12 Bit I2C DAC. This one had the same problem being stuck at 2.45 volts. I then realized that they have the same MCP4725 chip and thought that it could be a software issue. Here is my current code to test it:

#include <Adafruit_MCP4725.h>

String readString;
Adafruit_MCP4725 dac;
void setup() {
  //pin set up
  dac.begin(0x63);
}

void loop() {
    dac.setVoltage(50, false);
}

This is using the Adafruit library that was working earlier and since they were both I2C I thought that it would work.

Any help would be appreciated. Could this be a soldering issue?? A cabling issue? I believe it is a programming issue as nothing has changed hardware wise. know that it is not a multi meter issue as it works with other things.

HI,
Have you tried the example code that came with the library?

Tom... :slight_smile:

There are three different address versions of the mcp4725 ic. Run the I2C address scanner to identify the version you have.

@TomGeorge Yes I did try the code that came with the library and still no luck. I will try again.

@avr_fred Thanks for the tip in using the address scanner. I am away from the DAC right now but I will try again tomorrow. Will the adafruit library work for the other MCP4725 DAC as long as I select the right address?

MathMXC:
Hi! I am trying to get a Digital to Analog Converter working with my arduino.

Not sure what you are planning to do with it or how many bits you need, but what I do for a DAC is simply use an 8 bit R2R ladder connected to one port.

Then, all I have to do is blast bytes at it and I get a clean analog DC output without the need for filtering (like you need for a PWM).

If you need 16 bits, you can use 2 R2R ladders and tie the output of the low byte R2R to the input of the high byte R2R and get a clean 16 bit analog output.

The dac is really fast too. I converted a small image to an 8 bit greyscale and put it into progmem, then blasted it out to the R2R dac and connected it to my old analog o-scope:

(click for full size)
video_dac_test.jpg

Works like a charm, and it’s ultra simple.

Will the adafruit library work for the other MCP4725 DAC as long as I select the right address?

Yes. It is only the base I2C address that changes. Four different part numbers, not three as I stated earlier. Total device address range is 0x60 to 0x67.

MCP4725A0 address is 0x60 or 0x61
MCP4725A1 address is 0x62 or 0x63
MCP4725A2 address is 0x64 or 0x65
MCP4725A3 address is 0x66 or 0x67

The address is a combination of the fixed internal value and the state of the ADDR pin set by solder jumper to VCC or GND on the breakout board (if you're using one).

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you post a picture of your project so we can see your component layout?

Thanks.. Tom.. :slight_smile: