Calibration and Parameters in EmonLib

Tags: #<Tag:0x00007fdb59b60558> #<Tag:0x00007fdb59b603a0>

I read carefully the article Installation and Calibration but I don’t understand how to calibration and calculate parameters “234.26, 1.7, 111.1, 20, 1480” in below code:

  emon1.voltage(2, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(1, 111.1);       // Current: input pin, calibration.


  emon1.calcVI(20,2000);// Calculate all. No.of half wavelengths (crossings), time-out
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only

I’m really stuck
I’m using arduino 5V, c.t. 100A:50mA, 33Ω burden resistor, 10kΩ divide resistor and transformer 9V
Could you tell me how it work, how to calcutate it?
Thank you so much!!!

Yes, I know it is difficult to follow, but the last line in each section tells you all you need to know. Written another way:

“234.26” is the mains voltage that gives you 1 V at the ADC input.
“111.1” is the mains current that gives you 1 V at the ADC input.
To calculate those, you must work backwards from the ADC input through the various resistors and transformers to the mains circuit.

“20” as it says in the comment, the number of half wavelengths (zero crossings) of mains over which you sample and average the power.

“1480” the number of current samples over which you sample and average the current. This should be as close to a whole number of mains cycles as possible, the last time I measured the sample rate, it was approximately 5588 current samples per second. (“1480” is no longer the best value.)

“1.7” is the correction for the phase errors in the transformers and the timing error between sampling voltage and current. It’s hard to calculate, it is best to set it on test as explained on the calibration pages in “Learn”.


I got it, thank you so much <3

Could you explain the number “1.2” in article Calibration theory
Thank you so much!!

It is explained there, in the sentence that begins “The voltage transformer output is nominally 9 V for 230 V input,…”

robert thank you man I was really stuck understanding it

1 Like

Hello Dat,
Were you able to have your Arduino and CT sensor working?
Could you please post the calibration numbers you end up using?
Thank you.

The calibration constants will be special for your particular set of hardware, so someone else’s values will not necessarily mean you get the correct values.

The values we publish are based on the manufacturer’s data sheets, and should give you the best overall accuracy without individually calibrating your system.

Hello robert can i use acs712 sensor instead of CT and potential divider
thanks your reply will be highly appreciated .

Welcome, @Muzammil_Nizamani

The output from the ACS712 is already biased to 0.5 × VCC, so you do not need the capacitor and the 2 × 470 kΩ resistors. You can use a direct connection to the Arduino input pin.