Arduino energy monitor - measuring current

Hi,

I followed the tutorial of this http://openenergymonitor.org/emon/buildingblocks/how-to-build-an-arduino-energy-monitor

I am trying to measure only the current but, I cannot understand the output data

which is like following:

 

Irms*230.0    Irms

--------------------------

0.95        0.00
0.95        0.00
0.95        0.00
4.66        0.02
0.95        0.00
6.52        0.03
3.36        0.01
3.36        0.01
5.67       0.02
6.52       0.03

 

I cannot understand what is meaning of these output from the CT sensor, the sensor is connected to the some devise wire, but even the sensor not connected it still  print the same kind of  value to the output,

I am using arduino 2009

 

thanks

 

Robert Wall's picture

Re: Arduino energy monitor - measuring current

If you look at your sketch, you have at the bottom:

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

The line "double Irms = ....."  is a call to a method in the emonLib library that reads the analogue port and calculates the average current.

The next line prints this value multiplied by 230. That assumes your mains voltage is 230 V and the number printed is the apparent power in Watts. The last line prints the current in Amperes.

So what I think you are seeing is a very small load of around 5 Watts.  I do not know what load you were expecting to see, but experience tells me that you normally see numbers like that even when there is no current flowing.

A common mistake is to put the current transformer over a two core or three core cable that has two wires carrying current in opposite directions. A current transformer works on the magnetic field surrounding a wire, and if you have two wires carrying current in opposite directions, the magnetic fields cancel and you will read nothing. You must clip the current transformer onto one wire only, either Line or Neutral.

lolita's picture

Re: Arduino energy monitor - measuring current

Thank you very much Robert Wall for your detailed responce,

In fact I clipped CT sensor to the PC cable,  so I got always noise like you said.

Thanks a lot!

João Almeida's picture

Re: Arduino energy monitor - measuring current

Hey guys, I'm new to the forum, and I hvae the same problem as @lolita, meaning I was only testing the "current_only" exemple provided by the emonLib library, and even with the CT sensor disconnected, I read values similar to the ones on this thread, same thing happends when I connect the CT sensor to my laptop cable, or rather yet, the values seem to change a lillte, but they are kept in the same range as if I had the CT sensor disconnected.

I've read your answer Robert, but I'm not quite sure I understand it. What you mean is I can't connect the CT sensor to a normal cable, say something like a computer power source cable, because they have neutral and fase (line), or other ordinary house hold items. But if I connect it to say, a power source cable, or an electrical board cable I should have no problems?

Forgive me if my question sound stupid, but like I said, i'm new to these things :D

Things in advance for any help you can provide,

John.

Robert Wall's picture

Re: Arduino energy monitor - measuring current

João, You are correct. If you want to measure a computer, or a vacuum cleaner, or something that you plug in at a socket on the wall, then you must make up an extension plug and socket where the wires are separate and not collected together inside one sheath. You must clip the c.t. over only the line cable or over only the neutral cable.

http://openenergymonitor.org/emon/sites/default/files/PVCT.JPG

and

http://openenergymonitor.org/emon/emontx/accuracy

Be VERY careful when handling mains electricity.

 

João Almeida's picture

Re: Arduino energy monitor - measuring current

Thanks for the prompt response Robert.

I'll try to use the CT sensor the correct way now xD.

Thanks again,

João Almeida.

João Almeida's picture

Re: Arduino energy monitor - measuring current

Good afternoon Robert. I'm sorry for not replying to your previous answer, but I've been kind of busy with my work.

So summing up, I've took your advices into consideration and I've tested the shield, noticed everything's working as expected. 

Now I have a new problem xD. For my work, I'll have to use an real time clock (RTC) to keep track of the time of the readings I'll have to do. the problem is almost every RTC uses I2C, meaning that I'll have to use pin4 of my arduino (I use an arduino ETHERNET) to do readings of the shield and also readings of the RTC. This poses a conflict between the RTC and the shield, and after I searched for a while, I discovered that I can remap pin4 of the emonTX to say pin0, as neither the emonTX and RTC use that pin. For that I was thinking of using an go-between shield for the easy remap.

My problem now is that I would also need to alter the library code to change pin4 to pin0, and I just can't find any reference in the emonLIB library to pin4. I just find references to channels 1 to 3, and pins 1 to 3 also.

Don't know if I made my problem clear xD
 

Best regards, João Almeida.

Robert Wall's picture

Re: Arduino energy monitor - measuring current

I know nothing about the Arduino PCBs, and I don't understand your question. You want to move the signal on pin 4 to pin 0 - what is the name of that signal?

João Almeida's picture

Re: Arduino energy monitor - measuring current

The thing is the emonTX uses pins A1 to A4 from the arduino to do the readings. And the RTC uses pins A4 and A5 witch causes a conflict of communitcations because the pins A4 and A5 are used as I2C on the arduino.

The solution I found is to remap the pin A4 of the emonTX to the pin A0 as you said  but that would imply changing the library code to, I think. My problem is that I can't find references in the library code to pin A4.

I don't think it would be so simple as to change the pin in the code. For instance, change the example for two CT's from:
-----------------------------------------------------------------------------------------------------------------------------------------------#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1, emon2;                   // Create an instance

void setup()

  Serial.begin(9600);
 
  emon1.current(1, 111.1);             // Current: input pin, calibration.

  emon2.current(2, 111.1);            // Current: input pin, calibration.

}

void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only

 double Irms = emon2.calcIrms(1480);  // Calculate Irms only
 
          ...
}

-----------------------------------------------------------------------------------------------------------------------------------------------

to:
-------------------------------------
void setup()
{
  Serial.begin(9600);

  emon1.current(1, 111.1);             // Current: input pin, calibration.

  emon2.current(0, 111.1);            // Current: input pin, calibration.   <----------------------------CHANGE-------------------

}

-------------------------------------

Best regards, João Almeida.

Robert Wall's picture

Re: Arduino energy monitor - measuring current

If you look at EmonLib.cpp, EnergyMonitor::current( ) & EnergyMonitor::voltage( ) use the input pin directly. In other words, the pin you give it when you call current(0, 111.1) assigns the value 0 to inpinI and that is the pin used when it reads the analogue port with analogRead(inPinI). The same happens with the voltage input.

But if you do not use pin 4 for measurement, EmonLib will do nothing with it. So I think you can move the pins around without the need to change anything in EmonLib.

That is not true if you use currentTX or voltageTX, these use "channel number" instead of Pin number. The pin mappings start at line 41 in EmonLib.cpp. If you use these, then you MUST change the library.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.