Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Sensor SCT-013 and emonlib

Hello,

Could you tell me if the samples provided by the emonlib.h library in the CalcIrms function when the SCT-013 sensor reads are instantaneous values (for modeling and drawing a sine wave) or are they average RMS values?

I want to collect information to identify the harmonics influencing the measurements…

Thank you very much.

Sergio - Brazil.

Guess why the function is called calcIrms( ) :roll_eyes:

The rms value reported by emonLib - and you can see exactly how emonLib works when you examine the code - is the rms value calculated, in the case when a voltage sample is present, over a defined number of half-cycles of the voltage; or in the case where a voltage sample is unavailable, of a defined number of current samples.

Hi Robert,

That’s right… I saw it in the code, but as in the CalcIrms function there is an AnalogRead() function I’m in doubt if this acquired value is an instantaneous sample or is it RMS. So I would like help in this matter.

Grateful.

Hi Robert,

I need to acquire instantaneous values to check harmonics too, so I need values to plot the sine in time.

Grateful.

That is not the question you asked.

If you need to do a harmonic analysis (Fourier transform?), then you should not use emonLib. You will need to read the analogue values directly from the ADC, for every ADC that I am aware of, each of those numbers will be the instantaneous value when you instructed the ADC to sample the input.

You will need to write the software to process those numbers. Also, you should probably not use the Arduino analogRead( ) function because it is very slow, you will read the samples much faster - meaning better accuracy and higher harmonics - if you set the ADC to sample continuously and use interrupts to read the ADC registers directly. The Atmel data sheet for the ATMega 328P has all the details, you might also like to look at emonLibCM as that uses the same technique (but like emonLib, that too only produces rms average values for voltage and current, and the average real power, but over the whole reporting interval, not just a 200 ms sample, which is typically how emonLib is used).

Hi Bill,

Sorry for the inconvenience, but could you indicate a board with Atemega 328P ready to mount to connect the voltage and current sensors?

I read that the ESP82XX line has this microcontroller, but I don’t know if it’s the necessary model…

Thank you again.

An Arduino Uno or Nano.
Ref:
https://www.arduino.cc/en/Main/Products

I’m not sure I’m following you here.
Are you saying you’ve read about a board that has both the ESP as well as the ATMEGA
microcontrollers on it?

Hi Bill,
I’ll see the ESP82XX datasheet and then confirm again, ok?

Thanks.