Adafruit MCP4725 not working

Trying to implement a DAC
A few tutorials on ways to do it below that I am following:
How to use MCP4725 12-Bit DAC Module with Arduino
Downloads | MCP4725 12-Bit DAC Tutorial | Adafruit Learning System

The first tutorial uses and UNO in this configuration
In this configurtion SCL/SDA come from A4/A5

It appears the pinout I made in the schematic is different

This matches the device we are using
It is an UNO

The UNL we are using is made by this company
Ruggeduino-ET "Extended Temperature" -40C - 85C — Rugged CircuitsRugged Arduino

I have tried to run the demo code but nothing is connecting / working

For reference this is the schematic


some code


 /*

 */
 #include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 dac;

#define digitalPin2 2   // Port 2 for reading the door interlock state
#define digitalPin4 4   // Port 2 for turning on the cabinet LEDs
#define digitalPin6 6   // Port 6 for Power LED on light field alignment
#define digitalPin8 8  // Port 8 for slecting dimming method
#define digitalPin10 10   // Port 10 for Green LED on filter
#define digitalPin12 12   // Port 12 for Green LED on filter
#define digitalPin13 13   //  Port 13 for reading the push button on the light field module 
#define DAC_RESOLUTION    (9)   // Set this value to 9, 8, 7, 6 or 5 to adjust the resolution
 #define potentiometerPin A1




int x =0;          
int interlockstate=0;
int pushbuttonlightfield=0;
int analogPin = A5;
int Thumb_Dimmer_Pin = A1;
int Thermo_Pin = A2;
float rawvalue=0;
float rawvalue2=0;
float rawvalue3=0;
float voltagevalue=0;
float Thumbvoltagevalue=0;
float Thermovoltagevalue=0;
//ISR//float value = 100;   //3035;


void setup()
{ 

  Serial.begin(9600); //begin serial data
   pinMode(digitalPin2, INPUT); // Port 2 for reading the interlock state
   pinMode(digitalPin4, OUTPUT); // Port 4 for Cabinet LEDs
   pinMode(digitalPin6, OUTPUT); // Port 6 for Power LED on light field alignment is an output
   pinMode(digitalPin8, OUTPUT); // Port 8 for Dimming method select is an output
   pinMode(digitalPin10, OUTPUT); // Port 10 for Green LED on filter is an output
   pinMode(digitalPin12, OUTPUT); // Port 12 for Yellow LED on filter is an output
   pinMode(digitalPin13, INPUT); // Port 13 for reading the push button on the light field module 
   //pin 13 is not on an interrrupt for state change so might need to change the switch
}


void loop() 
{

      delay (500);    //rev 3, delay to slow system down

      //Read this to see if the push button to turn on the LED is pushed or not
       pushbuttonlightfield =  digitalRead(digitalPin13);
     //     Serial.print("Push button state (0 is not pushed): ");
    //      Serial.println(pushbuttonlightfield);

  //check if serial communication is avaiable
    //then issue responce if command recognized
    //using println rather than print so there is new line feed issued
    //took this part from Filter recogition code
  if (Serial.available() > 0) {
      String rx_byte = Serial.readStringUntil('\n');
        rx_byte.trim();
        
        if (rx_byte == "CMD1") {
            digitalWrite(digitalPin12, LOW); // turn off  Yellow LED in filter module
            Serial.println("SUC1");      //CMD1 responce
        }
        if (rx_byte == "CMD2") {
            digitalWrite(digitalPin12, HIGH); // turn on Yellow LED on filter module
          Serial.println("SUC2");      //CMD2 responce
        }
        if (rx_byte == "CMD3") {
          digitalWrite(digitalPin10, LOW); // turn on Green LED on filter module
          Serial.println("SUC3");      //CMD2 responce
        }
        if (rx_byte == "CMD4") {
          digitalWrite(digitalPin10, HIGH); // turn on Green LED on filter module
          Serial.println("SUC4");      //CMD2 responce
        } 
       if (rx_byte == "CMD5") {
          digitalWrite(digitalPin8, LOW); // Set Dimming method to Analog
          Serial.println("SUC5");      //CMD2 responce
        } 
       if (rx_byte == "CMD6") {
          digitalWrite(digitalPin8, HIGH); // Set Dimming method to Digital
          Serial.println("SUC6");      //CMD2 responce
        } 
       if (rx_byte == "CMD7") {
          digitalWrite(digitalPin6, HIGH); // turn on Power LED on light field alignment module
          Serial.println("SUC7");      //CMD2 responce
        } 
       if (rx_byte == "CMD8") {
          digitalWrite(digitalPin6, LOW); // turn off Power LED on light field alignment module
          Serial.println("SUC8");      //CMD2 responce
        } 
     if (rx_byte == "CMD9") {
          interlockstate  =   digitalRead(digitalPin2);  // 0 door open, 1 door closed
          Serial.println(interlockstate);  //(0 is door open)
        } 
      if (rx_byte == "CMD10") {
        rawvalue = analogRead(analogPin); // voltage Primary Trimpot:
        voltagevalue = rawvalue*(5.00)/1023.00;
         Serial.println(voltagevalue, 3); // Print voltage with 3 decimal places
        } 
        if (rx_byte == "CMD11") {
           rawvalue3 = analogRead(Thermo_Pin); // Read the analog input from thermocouple
           Thermovoltagevalue= rawvalue3*(5.00)/1023.00;
         Serial.println(Thermovoltagevalue, 3); // Print voltage with 3 decimal places
        } 
       if (rx_byte == "CMD12") {
         rawvalue2 = analogRead(Thumb_Dimmer_Pin); // Read the analog input from thumb wheel
        Thumbvoltagevalue = rawvalue2*(5.00)/1023.00;
         Serial.println(Thumbvoltagevalue, 3); // Print voltage with 3 decimal places
        } 
       if (rx_byte == "CMD13") {
          digitalWrite(digitalPin4, HIGH); // turn off Power LED on light field alignment module
          Serial.println("SUC13");      //CMD2 responce
        } 

       if (rx_byte == "CMD14") {
          digitalWrite(digitalPin4, LOW); // turn on Power LED on light field alignment module
          Serial.println("SUC14");      //CMD2 responce
        } 
       if (rx_byte == "CMD15") {

           //      https://how2electronics.com/how-to-use-mcp4725-12-bit-dac-module-with-arduino/
           //    https://learn.adafruit.com/mcp4725-12-bit-dac-tutorial/download
          // make sure to install Installed Adafruit MCP4725@2.0 before compiling

          dac.setVoltage((1 * 4095) / 5, false);    //Set voltage to 1V
          delay(2000);
          dac.setVoltage((2 * 4095) / 5, false);    //Set voltage to 2V
          delay(2000);
          dac.setVoltage((3 * 4095) / 5, false);    //Set voltage to 3V
          delay(2000);
          dac.setVoltage((4 * 4095) / 5, false);    //Set voltage to 4V
          delay(2000);
          dac.setVoltage(4095, false);              //Set voltage to 5V or (Vcc)
          delay(2000);
        } 



  }

}


Any thoughts on how to fix this?

Explain please the reason for putting series resistors in the SCL and SDA lines?

1 Like

Carefully follow the Adafruit tutorial. If you have trouble with it, the Adafruit forum is the best place to post questions, as it is staffed with paid Adafruit professionals.

But first, check that the header pin soldering is not the problem.

those resistors and IC are DNP
I put them down incase the module is no longer offered
Cant stop production, so can hand solder the ICs and resistors to keep going

I guess I can use adafruit user forum but its really both arduino and adafruit topic

I posted on adafruit

Pullup resistors are absolutely required for I2C to work. Make sure that a pair is mounted on either the MCU board or the ADC board.

Please post a photo of your actual setup showing how the MCP4725 is being connected to the Arduino board.

I can't tell what you are doing. Are you using a module or have you your own PCB?

When you write UNL did you mean UNO?

Have you run a simple I2C scan to see if the part is on the bus?

Post the code you tried that isn't your code. Or are you asking about possible issues with the code you did post?

a7

If the MCP4725 is not populated, how do you expect to be able to communicate with it?

If the I2C lines are not connected, the same question applies?

Or are you saying that your schematic is totally unconnected to what you're really doing?

There are 2 sets of parts for the DAC in parallel but only 1 is populated.
One is for the full MCP4725 Evalution module from Adafruit.
The other set of footprints is for the parts on the evaluation module.
They are in parallel so that either can be used as long as one is populated.

I did post of photo of the current setup with only the MCP4725 populated below.
There are 2 PCBs, one populated and the other is not.
you should be able to see a set of 6 SIP that the DAC eval module is mounted to.
I guess you cant see under it to tell the other parts are DNP and are not mounted which is hy the bare board is also shown.

The main question can really be asked in theory
If MCP4725 demo is configured to use i2c coming out of different pins of the UNO then I have. I guess I can try to scope it to see if it is turning on? Im not sure if this is causing the DAC to not work but my guess is the discrepancy in i2c pins.

i2c over hardware on the UNO comes out at the named pins and is also directly wired to A4 and A5.

Both sets of pins are connected to the same pins on the microprocessor.

a7

I appreciate everyone looking at this
I will give it a try in a few days

The use of the SCL and SCA in their location is from the vendors website

I just wired to the DAC to the marked locations for SCL/SCA on the vendors PCB and there seperate spots for Analog inputs

Header pins labeled SDA/SCL are wired directly to those labeled A4/A5 on the Arduino Uno R3, and almost certainly so on the board pictured. Check with your multimeter.

I am guessing the issue is that ... since there were separate headers for SCL/SDA and also A4/A5, I used all of them and the A4/A5 wiring for the ADC is likely interfering with the i2c as they all use the same pins (but i didnt know that earlier).

I may just breadboard a ruggeduno and MCP4725 to do a hello world to verify

yup, worked right away when i did it on a protoboard

so the issue that i connected things to A4/A5 as I thought they were different from SCL/SCA due to having unique header points on the ruggeduno