Energy Monitor Shield on the Arduino UNO
Although the Energy Monitor Shield was designed to connect to the Arduino YUN in order to upload the data to the cloud, it works perfectly with any arduino compatible board. On the right is code that has been tested on the Arduino UNO and Duemilanove.
Make sure that the EmonLib library has been installed in the Arduino IDE.
Connect the shield to the Arduino UNO.
Insert the Current Transformers (CTs) into the jacks. Clip the CTs around the primary AC inputs or your residence or office. Try not to die in the process. In this type of installation the direction of the CTs is not relevant. Make sure the clamps are completely closed.
4. Upload the code to the Arduino UNO and open the Serial Monitor.
Column 1: Current 1 (amps)
Column 2: Power 1 (Watts)
Column 3: Current 2 (amps)
Column 4: Power 2 (Watts)
CODE:
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1;
EnergyMonitor emon2;
void setup()
{
Serial.begin(9600);
emon1.current(1, 105.0); // Current: Analog input pin, calibration.
emon2.current(2, 105.0); // Analog inputs A1 and A2 respectively
}
void loop()
{
updateData();
}
void updateData()
{
double valIrms1 = emon1.calcIrms(1480);
double valIrms2 = emon2.calcIrms(1480);
Serial.print(valIrms1); // Current1 reading
Serial.print(" ");
Serial.print(valIrms1*120); // Apparent Power = I*V = I*120
Serial.print(" | ");
Serial.print(valIrms2); // Current2 reading
Serial.print(" ");
Serial.println(valIrms2*120); // Apparent Power = I*V = I*120
}