Problems with current measurement (EmonLib)

I want to measure current values using current transformer and library (EmonLib.h) in this example

#include "EmonLib.h"
EnergyMonitor emon1;
void setup()
{
  Serial.begin(9600);

  emon1.current(A0, 30);
}

void loop()
{
  double Irms = emon1.calcIrms(1480);
  Serial.println(Irms);
}

I use NodeMCU and SCT-013. I have succeeded. The values correspond to what the calibrated instrument shows but there is a problem. When the controller starts, it gives the first 3 values ​​not correct, but I need all the correct values.

2.88
0.67
0.16
0.06
0.04
0.04
0.04
0.04
0.05
0.04
0.03
0.02
0.02
0.03
0.02
0.01
0.01
0.01
0.01
0.01
0.01
0.02

scheme

What can be done in such a case?
Thank you.

Unless there is something in the emonlib library I see nothing here to control the rate at which measurements are taken - other than the very slow baud rate.

You havent explained how the ct is connected to the Node - so a schematic please?

Is the current already established when you start making measurements?

I have attached the wiring diagram for the transformer.

https://www.researchgate.net/profile/Viorel-Miron-Alexe/publication/312038242/figure/fig1/AS:465224521261060@1487929577727/Schematic-describing-the-interfacing-of-the-SCT-013-current-transformer-with-the-Arduino.png

You can choose any of the available data transfer rates; it does not affect the values that are formed after a restart. The main problem is that the values jump when the controller is restarted...

The output from the current transformer is an AC signal, that is biased to 5V / 2 by R1, R2

Because C1 charges from a source reisitance of R1//R2 = 5k you have a time constant of about 2 sec.

there will be a period of about 5RC = 10 sec before the bias vboltage becomes stable.

So You MUST ignore the first 10 sec before you start taking readings.

OK. The option to ignore is not entirely suitable ... Well, what if you connect the power not to + 5V, but to some output (pin 5) and turn it on in the setup?

#include "EmonLib.h"
EnergyMonitor emon1;

const int PowPin =  5;

void setup()
{
  Serial.begin(9600);
  pinMode(PowPin, OUTPUT);

  emon1.current(A0, 30);
  
  digitalWrite(PowPin, HIGH);
  delay (1000);
}

void loop()
{
  double Irms = emon1.calcIrms(1480);
  Serial.println(Irms);
}

Surely that will make it worse.

The power coming on happens before you can turn on an output pin doesn't it?

So add a start up delay.

I dont see why - the current doesnt know when ou connect the meter.

You can TRY adding a second cap from the 2.5V to the 5V rail.

Who was it said "ye cannae break the laws of Physics" ...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.