Corrupted readings with MCP3428 4 Channel

#1

The setup is a MCP3428 4-Channel board ( PR 33-15 ) connected to Arduino Uno ( in connection with PR14-3 ) or Arduino Due ( connected with PR37-10 ), to measure the water level with several sensors 4-20mA. Power supply of the sensors is a Mean Well 24 VDC. According to the water depth of 3 to 4 meters, the signal has a current of 8 to 9 mA, which is coherent and corresponds to the scope of the sensors.
I have tested to read the sensors close to the water tanks and remotely, the readings are always unisonous inconsistant and have the same strange values.
Strange to say there exists one possibility to receive correct readings: this is to connect the Arduino to my notebook (HP250) and not to connect other devices, as e.g. an Ethernet shield with network cable. There is no difference, if the MCP3428 is connected to an Aduino Uno or to an Arduino Due. As soon as other modules are connected to the setup, the same inconsistant readings appear, see the serial monitor: readings 14 and 15 correct, the reading 13 incorrect, while the network cable is connected.

Other 2 desktop computers connected to the Arduino, the MCP3428 delivers always the same incorrect readings, all tests with Windows 10, Arduino Software always same version 1.8.8.
A swap of the sensor cables to other ports of the MCP3428 does not deliver coherant values, there is always a reading of nearly 0 at port 1, the reading at port 2 is close to the correct value, the reading at port 3 and 4 is considerably too low. If all signal cables are disconnected, the MCP3428 delivers values for port 2 of more than 2000, the other ports near 0.
The sensor data is usually recorded with resolution 16, a change of the resolution delivers corresponding lower incorrect values.

This is the sketch:
// connected: NCD-board PR33-15 with I2C-cable to
// NCD-shield PR14-3 for Arduino Uno, plugged on Arduino Uno
// or NCD-shield PR37-10 for Arduino Due, plugged on Arduino Due
#include <MCP3428.h>
#include <Wire.h>
unsigned long loop_y = 0;
float raw[3], volum[3];
float surface[3] = { 0.2529, 0.2648, 0.3334 };
float water_level, height;
int basis = 2980;
int divisor = 1123;
int resolution = 16;
String text1 = “”;
int delay_var = 5000;
byte error;
int i;
void setup()
{ Serial.begin(9600);
while (!Serial) {;} } // wait for serial port to connect.
void loop()
{
MCP3428 MCP(0); // Declaration of MCP3428: A2, A1, A0 bits (000, 0x68)
int8_t address = MCP.devAddr;
float volum_total = 0;
loop_y++;
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
for ( i=0; i <= 2; i++)
{
// SetConfiguration: Par. 1: input (channel), Par. 3: mode
MCP.SetConfiguration(i+1,resolution,1,1);
raw[i] = MCP.readADC();
if (raw[i] < basis) { water_level = basis; }
else { water_level = raw[i]; }
height = (water_level - basis)100 / divisor;
volum[i] = height
surface[i];
volum_total = volum_total + volum[i];
text1 = “channel “+String(i+1)+” : resolution “+String(resolution)+”, digital measured value: “+String(raw[i],0)+”, represents water level: “+String(height, 0)+” cm, corresponds: “+String(volum[i],2)+” cbm”;
Serial.println(text1);
}
}
Serial.println(“total volum: “+String(volum_total,2) + " cbm, reading: " + String(loop_y)+” every " +String(delay_var / 1000) + " seconds”);
Serial.println("");
delay(delay_var);
}

setup with Arduino Uno:

setup with Arduino Due:

In summery, the values of the MCP3428 are corrupted, as soon as there are additional devices connected to the Arduino and the Serial connection is not established from one certain notebook. This makes me believe, that the MCP3428 is transforming correctly the current from the sensors. A corruption of the data seems to take place in connection with the PC establishing the Serial monitor or other devices connected to the Arduino. The Arduino itself probably does not to disturb the data.
Whatever port of the MCP3428 is connected to the sensors, the digital values of the different ports follow a certain sample of values, independant of the sensor currents (when corrupted ).
How to resolve this problem ? I have actually no more idea.

0 Likes

#2

Hi Will,
Looks like there is some noise on the ground lines. You will need to install an isolator between MCP3428 and Arduino.
something like this


If you have a scope i will recommending scoping the power lines and you should see some noise on the power lines.

Thanks

0 Likes

#3

Thank you Bhaskar for the reference. I ordered the isolator. This will take 6 to 8 weeks to receive the device due to the remote site here and customs.
I was thinking about the context of noise. This device should match the problem.

Thanks.
Wilfried

0 Likes