12 Chanel 4-20mA Current receiver Board. Correct Wiring and sketch usage example

Hi there,

I would like to connect it to a large number of 4-20mA Sensors for water quality monitoring like these. In total I would like to monitor 30+ Sensors so I am looking for the neatest sloution possible.

I recently purchased this board hoping to be able to wire the sensors I wanted directly to it. I saw it had a 12v external power input so assumed it would provide a loop to wire the sensors to directly and that I could daisy chain three of these boards together to give me enough inputs.

Afer running the example mcp3428 sketch (i found mcp3428 written on the board) and tweeking the address of the board with a jumper setting on address 1 to 0x68 with nothing wired in I got these values.

    ***************************        

Digital value of Analog Input at Channel 1 : 20

Digital value of Analog Input at Channel 2 : 44

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 122

at which point I realised that I needed to provide an external power source to the loop.

I did this and got readings like this (sensor is wired to channel CIC1) The readings I got seem to not be particularly stable but I am not sure what I am looking at. (I am used to seeing a value between 1 and 1024 when reading directly on an arduino with a 10v analog input using a 500ohm resistor )

    ***************************        

Digital value of Analog Input at Channel 1 : 1956

Digital value of Analog Input at Channel 2 : 43

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 119

    ***************************        

Digital value of Analog Input at Channel 1 : 1688

Digital value of Analog Input at Channel 2 : 43

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1740

Digital value of Analog Input at Channel 2 : 43

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1676

Digital value of Analog Input at Channel 2 : 43

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1537

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1092

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1004

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1451

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1976

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1749

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1731

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1690

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1583

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 1441

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************        

Digital value of Analog Input at Channel 1 : 2

Digital value of Analog Input at Channel 2 : 42

Digital value of Analog Input at Channel 3 : 3

Digital value of Analog Input at Channel 4 : 118

    ***************************       

Here is the sketch I have modified (I think I changed the gain to to so as to read 4-20mA)

/****************************************************************************
/*
        Distributed with a free-will license.
        Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
        MCP3428
        This code is designed to work with the MCP3428_I2CADC I2C Mini Module available from ControlEverything.com.
        https://www.controleverything.com/content/Analog-Digital-Converters?sku=MCP3428_I2CADC#tabs-0-product_tabset-2
*/
/****************************************************************************/

#include <MCP3428.h>
#include <Wire.h>

MCP3428 MCP(0); // Declaration of MCP3428: A2, A1, A0 bits (000, 0x68)

void setup()
{
    // Start serial communication and set baud rate = 9600
    Serial.begin(9600);
    Serial.println("MCP3428 Analog to Digital Converter");
    Serial.println("Getting ADC Readings from Channel 1...4");
    Serial.println("        ************************************            ");
    Serial.println("        ");
    delay(500);
}

void loop()
{
    byte error;
    int8_t address;

    address = MCP.devAddr;
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0)
    {
        long Raw_ADC[4];

        for(int i=1;i<=4;i++)
        {
            // MCP3428 is configured to channel i with 12 bits resolution, continuous mode and gain defined to 1
            // This arrangement of the mentioned paarmeters can be changed as per convenience
            MCP.SetConfiguration(i,12,1,2);

            // Note that the library waits for a complete conversion
            Raw_ADC[i-1] = MCP.readADC();
            // raw_adc = raw_adc * LSB(1 mV)/PGA for PGA = 1;       // 12-bit Resolution
            // raw_adc = raw_adc * LSB(250 µV)/PGA for PGA = 1;     // 14-bit Resolution
            // raw_adc = raw_adc * LSB(62.5 µV)/PGA for PGA = 1;    // 16-bit Resolution

            // Output to the Screen
            Serial.print("Digital value of Analog Input at Channel ");
            Serial.print(i);
            Serial.print(" : ");
            Serial.println(Raw_ADC[i-1]);
            Serial.println("        ");
            delay(500);
        }
        Serial.println(" ");
        Serial.println("        ***************************        ");
        Serial.println(" ");
    }
    else
    {
        Serial.println("MCP3428 Disconnected!");
        Serial.println(" ");
        Serial.println("        ************        ");
        Serial.println(" ");
    }
    delay(1000);
}

What range of values should I be expecting to receive from the sensor e.g. what is a valid sensor not attached value and what is the expected start value for 4mA (0) and the expected end value for 20mA (100) if using the 12 bit resolution ?

Is the maximum number of chanel groups I can address on a single i2C bus 8 as per the addresses specified in the jumper settings and how would I modify the sketch to do that ?

Is there a card with a large number of inputs that is capable of supplying the power directly to the sensors so that I dont need to wire up an external supply ?

Regards,

Sam

Hi,
You can change the address over here
MCP3428 MCP(0); // Declaration of MCP3428: A2, A1, A0 bits (000, 0x68)
to use16 bit you can use this formula
MCP.SetConfiguration(i,16,1,2);
​Current = raw_adc * 0.00069
the raw adc value will be around 5795 @ 4ma and 28,985@ 20mA.

If you are looking for on board power supply 4-20mA you can checkout this


with a 4 channel I2C mux board

Thanks

Hi there,

Thanks for the quick response. Sorry for the newbie arduino question so to change the sketch to read all 12 ports on the card If channel 1 is 0x68 channel 2 is 0x6C and channel 3 is 0x6A what would I need to do?

Regards,

Sam

i will recommend setting the addresses 0x68,0x69,0x6A. You can find the address setting info on the product page under resources section( wiring diagram).
after that, test each address separately by changing the address over here
MCP3428 MCP(0); // Declaration of MCP3428: A2, A1, A0 bits (000, 0x68)
after that you can add a for loop which will change the address for you and read all channels.

Thanks