Current Senzor Monitoring Values

I recently started checking out the current measurement senzor with Arduino 1.0 and I bought a senzor ( A friend who has more technical skills helped me setup an adaption for the jack of the senzor, using an audio socket from a front-end panel of a PC, and mounted there the 3 rezistor and the capacitor from the OpenEnergyMonitor presentation (
I connected to Arduino and used the simple sketch they provided:

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance
void setup()
  emon1.current(0, 111.1);             // Current: input pin, calibration.

void loop()
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
  Serial.print(Irms*230.0);	       // Apparent power
  Serial.print(" ");
  Serial.println(Irms);		       // Irms

The result doesn’t seem to be something useful, or I’m missing something:

141.46 0.62
-0.01 -0.00
144.63 0.63
145.45 0.63
-208.64 -0.91
-208.30 -0.91
-316.95 -1.38
13.29 0.06
233.30 1.01
-319.38 -1.39
-0.01 -0.00
-0.01 -0.00
-0.01 -0.00
143.67 0.62

Is there some wrong with the wiring, the hardware part or something should be changed in the sketch?



Those photos are a bit hard to interpret - a sketch of the circuit might be more easy to read. How is the calibration value arrived at?

The rezistors value and capacitors are the one's specified in the project. The calibration value is the standard one provided in the sketch.

Actually this is really odd - the output of calcIrms() should never be negative - looking at the code the only way this might happening is if readVCC() returns a negative value (it ought to return the Vcc voltage in millivolts). Looking at the code in readVCC() suggests it is measuring the internal 1.1V reference voltage w.r.t. the supply voltage - I presume you aren't doing anything strange with the AREF pin?

No, I'm not doing anything strange with AREF pin. When I made this I used a very simple configuration of Arduino Mega 2560 + Arduino Cabled Network shield on top. I only connected to the Arduino, the current senzor and nothing more, just to keep it simple. The only way I'm not sure is the wiring on the audio socket. I'm not sure if it's correct.

[6 months later...]

I tried to reproduce the OpenEnergyMonitor setup with a different Arduino than the one in use in the project and had the same kind of trouble because the DAC config in ReadVcc was incorrect : it needs to be adapted to the ATMega model.

This should be dealt with properly, now, in latest emonLib.

Maybe this was the cause of your issue as well.