MCP3428 4-20 mA circuit

I have the 12 channel - 4-20mA board seen here
MCP3428 12-channel

I am trying to hook up a pressure sensor and an temperature sensor.
I have set it up in a loop circuit so that the positive line goes to the sensor,
the negative line from the sensor goes to the + terminal and the -Terminal goes back to ground

And I get nothing that looks like a proper reading. On the page for the device it states that the output for 4-20mA is supposed to be When resolution is set to 16bit

  1. at 4mA the raw ADC value will be around 5813
  2. at 20mA the raw ADC value will be around 29390.

I am getting ‘1’ back.

Am I missing something?

Any help is appreciated - thanks

Dave

Hi Dave,
Can you share a picture or your setup ?

also the code you are using ?

Thanks

Code is from ControlEverything.com website with modifications to allow me to enter which channel I am on.

> #include <stdio.h>
> #include <stdlib.h>
> #include <linux/i2c-dev.h>
> #include <sys/ioctl.h>
> #include <fcntl.h>
> #include <string.h>
> 
> void main(int argc, char * argv[]) 
> {
> 	if (argc != 2)
> 	{
> 		printf("Usage: mcp [channel]\n");
> 		exit(0);
> 	}
> 
> 	unsigned char chan = (unsigned char)atoi(argv[1]);
> 
> 	// Create I2C bus
> 	int file;
> 	char *bus = "/dev/i2c-2";
> 	if((file = open(bus, O_RDWR)) < 0) 
> 	{
> 		printf("Failed to open the bus. \n");
> 		exit(1);
> 	}
> 	// Get I2C device, MCP3428 I2C address is 0x68(104)
> 	ioctl(file, I2C_SLAVE, 0x6F);
> 
> 	// Select configuration command(0x10)
> 	// Continuous conversion mode, Channel-1, 12-bit resolution
> 	char config[1] = {0};
> 	config[0] = ((chan & 0x03) << 5) + 0x09;
> 	printf ("Config byte is %d\n", config[0]);
> 	write(file, config, 1);
> 	sleep(1);
> 
> 	// Read 2 bytes of data from register(0x00)
> 	// raw_adc msb, raw_adc lsb
> 	char data[3] = {0};
> 	if(read(file, data, 3) != 3)
> 	{
> 		printf("Error : Input/Output error \n");
> 	}
> 	else
> 	{
> 		short raw_adc;

if (data[0] & 0x8000)
{
raw_adc = ((~data[0]) << 8) + ~(data[1]) + 1;
raw_adc = -raw_adc;
}
else
raw_adc = (data[0] << 8) + data[1];

> 		// Output data to screen
> 		printf("Digital value of Analog Input : %d  config %d\n", raw_adc, data[2]);
> 	}
> }

The config value output (btye 3 returned from the read) matches the config byte sent in.

(Edit - fixed 2s complement conversion)