Fluctuations in 4-20 mA Readings with Industrial Hat

gman

New member
Hi,

I am using the Industrial Hat to read a 4-20 mA input and have noticed significant oscillations in the readings. To investigate this issue, I set up a test with a continuous 8 mA current (according to a multimeter, which is not calibrated but should be fairly accurate).

I read the incoming current using the get4_20In function with some different sampling frequencies (1s, 0.1s and 0.01s). I ran 4 tests and got the following result:

Test1: Avg: 7.84mA, Min:7.57mA, Max: 8.08mA
Test2: Avg: 7.84mA, Min: 7.54mA, Max:8.16mA
Test3: Avg: 7.82mA, Min:7.54mA, Max:8.17mA
Test4: Avg: 7.85mA, Min: 7.56mA, Max:8.15mA

While the average readings across all tests are close to the expected 8 mA, the variation within each test seems unusually high and concerning. I've attached a plot from one of the tests where the oscillation is clearly visible.

Is this level of fluctuation normal for a 4-20 mA input reading with the Industrial Hat?
Could there be any environmental or hardware-related factors causing this oscillation?
Any other suggestions or similar experiences?
plot.png
 

alexburcea

Moderator
Staff member
Hi,

Thank you for the analysis, but you did not describe the source of the signal.
There are a few factors that can influence the noise on the analog inputs starting with the signal itself, continuing with the power source, and ending with the electromagnetic influence from other devices.
To have a complete analysis we need to measure all those factors first or try to reduce his influence.
If you can redo the test by generating the current from a clean power source with just resistors to set the current will be a better test.
 

gman

New member
Thanks for the reply.
I used a 2-wire 4-20 mA current transmitter, powered from +24 VDC from a good quality power supply. But I will defenitely try with a clean power source and a resitor. I will get back with the result tomorrow.
 

gman

New member
I tried the setup with a clean DC power source and resistor. I used +24 VDC and a 3.3kOhm resistor (measured to be 3272 Ohm). Initially, I tested it as an isolated circuit with a multimeter in series, and the measured value was 7.28 mA.

Next, I connected it to the Industrial Shield, still with the multimeter in series, and this time it gave me 6.74 mA. I expected a higher value here because, as I understand, the series resistor is 140 Ohm, and I think that is the only visible resistor for the voltage? The RPi and Industrial Shield were powered by the same source.

However, focusing on the fluctuation problem, it seems to still be there. The measurements were as follows:

Average: 6.72 mA
Minimum: 6.46 mA
Maximum: 6.97 mA

This results in a 0.51 mA difference between the maximum and minimum values. The current read from the multimeter was really stable during this period.


plot.png
 

alexburcea

Moderator
Staff member
Hi,

The input circuit contains a 140 ohms resistor and an optocoupler LED in series, so you see the lower current value. Multimeters have a cutoff frequency of 1Hz and you will not see the fluctuations even if they are there. The only way to determine if the signal is stable is with an oscilloscope.
I could lower the internal digital filter cutoff frequency but this could have a bad impact on the users that need to see rapid changes in the signal.
You could implement a low pass filter in Raspberry (even the simplest moving average filter will work) until I do the test and determine the possible cause.
Thank you for the tests.
 
Top