ARCELI 5A Range Monofase AC Active Output Precision Micro-Current Transformer drifting

Hi all,
I'm trying to use a "ARCELI 5A Range Monofase AC Active Output Precision Micro-Current Transformer" sensor to read the AC current consumption of a device.

I found a similar argument here (YQJ010504 Single Phase AC Current Sensor Module Active Output 5A problem) but it doesn't seem to get to a solution.

I understand that the read current is a sin() curve, so it makes sense that each reading differs from the previous one.
So my sketch, instead of logging instantaneous values, keeps reading for a while and tries to find and log the highest value of that period.

My problem is that, the max value is slowly but continuously drifting upwards. No matter if current is passing through the load, or not: the levels are obviously different in the two cases, but the drifting is always there.

I connected sensor's VCC to 5V output of Arduino, sensor's GND to Arduino's GND and sensor's OUT pin to Arduino's pin 17 (A3). One wire of the device I want to measure, passes through the sensor's hole.

The max value started at about 315 and after several minutes the situation was the following:
18:42:20.907 -> 432
18:42:21.489 -> 432

18:42:27.223 -> 432
18:42:27.788 -> 432
18:42:28.392 -> 457 // Spike ??
18:42:28.940 -> 433
18:42:29.516 -> 432
18:42:30.084 -> 433

18:42:34.701 -> 433
18:42:35.280 -> 433
18:42:35.855 -> 433

This is the sketch I'm using:

#define MY_PIN (17) // Pin 17 (A3) on an Arduino Nano Every
int maxLoops = 5000;
int curLoop = 0;
int maxVal = 0;

void loop() {
  // Collect data for several loops and store the max value.
  int readVal = analogRead(MY_PIN);
  if (readVal > maxVal) {
    maxVal = readVal;
  }
  curLoop++;

  // When the max number of loops is reached, write the max value and restart counters.
  if (curLoop > maxLoops) {
    Serial.println(maxVal);
    curLoop = 0;
    maxVal = 0;
  }
}

Any help/idea would be very appreciated!

Thanks,
M.

Why does that make sense to you? Does not to me. But you have same problem as the thread you linked to. No schematic and no data sheet specifications.

Somewhere in the circuit they convert the AC to a DC that is proportional to the current through the transformer. Unless something is getting hot and changing value, there should be no change in output when the AC current is the same.

Then pot on the board must be for calibration. Did documentation for the device show you how to calibrate the device?

Hi Paul,
thanks for your answer.
So far I was not able to find any documentation (too bad!).

I supposed (but I have no clue if this is correct) that the AC is converted to alternate voltage: that's why I 'understood' that each reading was different than the previous one.

The only calibration I can think of, is the trimmer visible in the figure. But it seems that no change occurs when turning the screw (in both directions)...

M.

Yes, too bad. That make your device rather useless, doesn't it?

Yes, you're right!
Do you know about any other -documented- AC sensor?

No. but you are free to look. Be sure they offer documentation!

I can share this much with you. There are dozens of sensors just like yours out there. They are, for the most part based on a ZMCT103C current transformer. You have that current transformer sitting on a module with an amplifier and a gain pot. A Google of "ZMCT103C 5A Range" will get you a few dozen hits of what you have from a few dozen suppliers.

Basically here is what is going on. The CT alone outputs a current proportional to the measured current. A burden resistor is placed across the CT to generate an AC voltage proportional to the current through the loop. The overview looks a little like this:

ZMCT103C 5A Range Single Phase AC Active Output Onboard Precision Micro Current Transformer Module Current Sensor

Features:
1.Onboard precision micro current transformer
2.High precision op-amp circuit board, do accurate sampling for the signal and appropriate compensation, and other functions
3.The module can measure within 5A current communication , corresponding to output analog quantity can be adjusted
4.PCB board size : 38 (mm) x18.5 (mm)

Package Include:
1 x ZMCT103C 5A Range Single Phase AC Active Output Current Transformer Module

I think (operative word think) the onboard pot can adjust the gain of the amplifier. The signal into your Arduino is an AC sine wave offset because an Arduino can't have an AC signal going below zero volts on an analog input pin.

Here is a typical code example used for using an Arduino and then we can look at it in minor detail.

/*
Made on Dec 22, 2020
By MehranMaleki @ Electropeak
Home
*/

#define calibration_const 355.55
int max_val;
int new_val;
int old_val = 0;
float rms;
float IRMS;

void setup() {
  pinMode(A0,INPUT);
  Serial.begin(9600);
}

void loop() {
  new_val = analogRead(A0);
  if(new_val > old_val) {
    old_val = new_val;
  }
  
  else {
    delayMicroseconds(50);
    new_val = analogRead(A0);
    if(new_val < old_val) {
      max_val = old_val;
      old_val = 0;
    }
    
    rms = max_val * 5.00 * 0.707 / 1024;
    IRMS = rms * calibration_const;
    
    Serial.print("  IRMS: ");
    Serial.println(IRMS);
    
    delay(1000);
  }
}

Yes, you are correct as to a sine wave for the AC current. Also on these units the current must be a sine wave. Even then they leave a little, actually much to be desired. So looking at the code all we are really doing is finding a peak value of the sine wave. That is what this is about:

/*
Made on Dec 22, 2020
By MehranMaleki @ Electropeak
Home
*/

#define calibration_const 355.55
int max_val;
int new_val;
int old_val = 0;
float rms;
float IRMS;

void setup() {
  pinMode(A0,INPUT);
  Serial.begin(9600);
}

void loop() {
  new_val = analogRead(A0);
  if(new_val > old_val) {
    old_val = new_val;
  }
  
  else {
    delayMicroseconds(50);
    new_val = analogRead(A0);
    if(new_val < old_val) {
      max_val = old_val;
      old_val = 0;
    }
    
    rms = max_val * 5.00 * 0.707 / 1024;
    IRMS = rms * calibration_const;
    
    Serial.print("  IRMS: ");
    Serial.println(IRMS);
    
    delay(1000);
  }
}

OK so now we have the peak value of the sine wave. There are other ways using code to get there but this works. So we have the AC peak value. The RMS value of a sine is equal to Epk * 0.707 so the code does that next. Finally we use a calibration constant. In this code the calibration constant is 355.55 . The way the calibration constant is derived is a matter of applying a known current through the CT loop and finding a cal constant that works doing the math.

I don't have your CT so here is what I did using the code I posted. I applied a 5.0 volt PK to PK sine wave to A0 on an Arduino Uno. I offset the sine wave by 2.5 volts so 0 volts is my baseline. My peaks are 5.0 volts. Multiple that by 0.707 and we get 3.535 and then multiply by the cal factor of 355.55 and we get 1256.86. Pretty much what we see in the below image.

So that is how it plays out. :slight_smile: Personally there are much, much better AC current sensors. Least I forget the code you see came from here. Personally as to another sensor? I have used very similar to these. Jumper selectable range but you do need a 24 VDC power supply which is inexpensive and a 250 Ohm external resistor. This converts the 4 to 20 mA to a 1 to 5 VDC signal to a uC or Arduino Analog input. Yes, the good AC current transducers cost more but actually have come down in cost for those off the boat. :slight_smile:

This is the data sheet for the actual CT on your module.

Ron

Hi Ron,
first of all, thanks for your long explanation and for your time!
I discovered a simple workaround for the drifting problem: instead of finding the maximum value within the 5000 measurements, I find both the min and max values: their difference seems quite stable, like 2 or 3 units when no current I passing through the load, and around 200 when the load is turned on (the exact value depends from the load and it’s current absorption, of course).

That's the common way of doing it, with a measuring time of at least 3/4 of the mains sine wave.
Measuring time, not a fixed number of samples.
Leo..

Glad it came together. :slight_smile:
Ron

Hi !

I'm experimenting with the ZMCT103C and I'm also facing the drifting problem. I checked the circuit diagram and realized that it could be caused by the charging of the output capacitor. By bypassing it, the problem was solved, but even then, the output is not consistently around 512, but according to the serial plotter, it has many spikes between 490 and 520. I'm currently looking for a solution to this and would appreciate any help. Thanks.

Jozs

If you sample/hold minimum and maximum values, and subtract from each other,
then a drifting midpoint becomes irrelevant.
Leo..

Untested example.

const byte currentPin = A0;
int minPeak, maxPeak; // peak values
int rawValue; // peak to peak
unsigned long startMillis;

void setup() {
}

void loop() {
  maxPeak = 0; // reset
  minPeak = 1023; // reset
  startMillis = millis(); // mark
  while (millis() - startMillis < 16) { // 15ms is 3/4 of 50Hz
    rawValue = analogRead(currentPin); // sample continuously
    if (rawValue > maxPeak) maxPeak = rawValue;
    if (rawValue < minPeak) minPeak = rawValue;
  }
  rawValue = maxPeak - minPeak; // final peak to peak value
}

Thank you for your response! If the center significantly deviates from the 2.5 Volt midpoint in any direction, is it possible for the minimum or maximum of the sinusoidal signal to "hit" the 0 or 5 Volt limit, causing measurement errors?

But my real problem is not this, as I mentioned above, it has been solved. My issue is that there is too much noise on the output, and I don't know how to eliminate it.

Asymetric clipping can occur if the midpoint drifts too much.
But that midpoint is set by the hall sensor's internals, and should be fairly stable.

The rest of the parts on that board is for the digital output, with threshold set by the pot.

Hall sensors are noisy.
You can try smoothing code (averaging many samples).
Or move to a current transformer.

Leo..

Thank you, but as far as I know the ZMCT103C modul is a current transformer and has no digital output.

Oops, you're right.
And it has a blocking capacitor, which makes the output swing around 0volt.
And it has an LM358, which will clip asymetrically.

Maybe best to leave the module as is (with the blocking cap),
and add a 100k:100k voltage divider to the Arduino pin, to center the pin at VCC/2.
Then use the peak to peak detector code I posted.
Leo..

How are the pins labeled (may be on bottom of board)?

Pins are: VCC, OUT, GND, GND.

Have you tried a "smoothing" algorithm? Can you post your code?

I would like the circuit to function properly, as I am afraid I may face various errors later otherwise. In its default state, the output of the ZMCT103C should be 2.5V voltage, that is, it should be around 512 (~510...515), stable and without spikes. Currently, I am getting the result shown in the image when I read the analog input port on the serial plotter.