MCP4725 DAC not outputting the correct voltage

Hi,

I am trying to a run a bit of code to test the output of my DAC (MCP4725). I am using an Arduino Uno, and the endgame of this endeavor is to control a micropump. My code is simply outputting a voltage, but I am reading ~5v supplied by the Uno. It should cycle between 1-5v.

#include <Wire.h>
#include "Adafruit_MCP4725.h"
Adafruit_MCP4725 dac;
#define DAC_Resolution (9)
#define I2C_Addr 0x62

int del = 500;

void setup(void) {
  Serial.begin(9600);
  Serial.println("MCP4725A0 Test");
  dac.begin(I2C_Addr);
}

void loop(void) {
  dac.setVoltage((1*4095)/5, false);
  delay(del);
  dac.setVoltage((2*4095)/5, false);
  delay(del);
  dac.setVoltage((3*4095)/5, false);
  delay(del);
  dac.setVoltage((4*4095)/5, false);
  delay(del);
  dac.setVoltage((5*4095)/5, false);
  delay(del);

  
}

The output of my dac is going to a voltmeter right now.
Any suggestions?

Anish

Your sketch works for me.

I think it's my dac. Do dacs "go bad" a lot? I am finding that if I leave dacs sitting for while (a few weeks) they work right.

Have You made this run without any load connected to the DAC analog output?
If You have I have to ask You for schematics, and the link to the DAC datasheet.
Checking the load is needed. Know that the DAC most likely only manages some milliamps.

That sounds like some kind of overload.

Sitting = Idle
I did not run the DAC continuously. It was doing nothing.

I just drew the schematic

Thanks! What You show is okey.
How is the Arduino powered?

It's not clear what that is supposed to tell. Load, or no load is the number one question. If the only load is a digital voltmeter set for voltage, not current, and plugged to the proper places on the DVM, we need to widen the search area.

The DAC can't drive a significant load, like a motor. What is the plan to "control a micropump"?

The plan is to drive a micropump (XaVitech BPV1500). I want to control the frequency of the pump.

The 'datasheet' informs: "The serial interface uses RS-232 with TTL levels of 2.85 V DC."

Oh. . . my.

Anyway ─
https://www.xavitech.com/wp-content/uploads/datasheets/BPV1500-intelligent-technical-dtasheet.pdf

runaway_pancake,

There is another variant that is described as analogue. This sounds more like the one that oxygen02 has.

https://www.xavitech.com/wp-content/uploads/Datasheets/BPV1500-Analog-Tecnical-datasheet.pdf

This is the one, apologies for not providing it.
Shouldn't my approach work though? According to the datasheet, if you provide a constant voltage at the range specified. The pump should function accordingly. My problem is that the DAC will not change its voltage.

Forget the pump for the moment. @JohnLincoln has verified your software, and @Railroader agrees with you wiring, such as you show.

If you can't get that to function, there must be a wiring error or a faulty component.

Your twin brother might try using a potentiometer to directly feed a controlling voltage to the pump to confirm the data sheet's claims.

But the two parts can remain separate until each is working.

There's still the question of the DAC providing enough current to the motor input. Since it says it goes direct to an analog converter it probably doesn't need much, but that specification is missing or buried, so may be a problem.

It looks like you are using the DAC chip directly, are you sure all the pins you don't mention in your drawing are connected appropriately?

It would probably be better if you had the kind that used digital control. Just sayin'.

a7

I think there is a faulty component, and that is the DAC. I used this configuration before, and it worked before. The DAC I am using only has 6 pins. My diagram shows everything that is relevant to my situation. It is a very simple circuit. The job of the DAC is to provide a steady voltage. I think I have to get a new DAC.

But you mentioned a DAC that has digital control? Please elaborate.

Sure enough, sry shoulda looked it up.

No, again sry. I was not clear. There is a version of the micropimp that uses digital communication for control.

So it could be controlled directly from the Arduino, no in between parts to fail and conversions that get reconverted.

I like to stay in the digital domain whenever possible, you may have reasons (like you already have the equipment!) to choose analog control.

a7

No worries, it would sure be easier to not use so many in between parts, alas this is the path I chose. I would like to see it through. I think I have to get a new DAC.

@JohnLincoln did you use a MCP4725 DAC to verify that code works? How new is the DAC. I am finding that the older my DAC is the less it functions. When I say old its been a few months since I used it last.

That's not normal.

If you are inadvertently stressing the part in some way, that might make it slowly go bad. More common is works -> doesn't work due to some mishap like applying voltage in reverse or in excess of chip limits.

Obvsly in your current circumstances the thing to do would be trying a new copy of the chip. You might take a look to see if there is indeed something about your circuit or how you are talking to it or powering it that creates this wearing out kinda process.

a7

A0 is floating. That may explain why it works/doesn't work.
You should have pull-up on the I2C lines.

1 Like