Cannot communicate with MCP4725 using WiringPiI2C

I am trying to use the 4-20 mA current loop which uses the MCP4725, but I cannot get any output. I am using an I2C shield and the device is detected at address 0x60. I am following a Sparkfun tutorial, which uses the same chip. Here is the sample code they provide:

#include <iostream>
#include <errno.h>
#include <wiringPiI2C.h>

using namespace std;

int main()
   int fd, result;

   // Initialize the interface by giving it an external device ID.
   // The MCP4725 defaults to address 0x60.   
   // It returns a standard file descriptor.
   fd = wiringPiI2CSetup(0x60);

   cout << "Init result: "<< fd << endl;

   for(int i = 0; i < 0x0000ffff; i++)
      // I tried using the "fast write" command, but couldn't get it to work.  
      // It's not entirely obvious what's happening behind the scenes as
      // regards to endianness or length of data sent.  I think it's only 
      // sending one byte, when we really need two.
      // So instead I'm doing a 16 bit register access.  It appears to 
      // properly handle the endianness, and the length is specified by the 
      // call.  The only question was the register address, which is the 
      // concatenation of the command (010x = write DAC output) 
      // and power down (x00x = power up) bits.
      result = wiringPiI2CWriteReg16(fd, 0x40, (i & 0xfff) );

      if(result == -1)
         cout << "Error.  Errno is: " << errno << endl;

I understand this is being used for voltage output, but the value that it loops through should still give me some change in output in the current loop, but all I see is 0.

Do you have a voltage source connect in series?
please checkout the wiring diagram on the product page under drawing section.


I am using the model with the built-in voltage source.

got it… i dont have any python example but i do have arduino

For testing
unplug the module from pi and also kill the script
now plug the module back and use a multimeter across the screw terminals and you should see around 12-13mA flowing through the meter.


I plugged the module out and then back in to the Pi and still no signal, just 0 mA.

Additionally, I tried converting the Arduino example to C/C++ for the Raspberry Pi, and it never worked. The C/C++ code found on Sparkfun also does not work, which does not make sense as it is the same chip.

can you share a picture of the setup and also measure the voltage across the terminal.

I am out of office until Thursday, so I cannot show picture right now. I have my Raspberry Pi connected to a power source, I2C adapters on top of Raspberry Pi, then 4-20 mA current loop plugged into I2C adapter using NCD custom connector. Then I have multi-meter connected to current loop output, with one probe on one side and the another probe on the other side. I will share a picture as soon as possible.

The voltage across the terminals is around 11.8 V.

Here is my setup.

Can you check and make sure your meter is reading mA. The mA fuse could be dead. Its a very common issue.


You were right. There was something wrong with my meter. Thank you!