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.
| 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 } |