Project in progress
Emon Voltage Calibration Arduino Due

Emon Voltage Calibration Arduino Due © GPL3+

Home power usage monitor, implementing for the Arduino Due. This sketch show running average of voltage, making it easier to dial it in.

  • 39 views
  • 0 comments
  • 0 respects

Components and supplies

About this project

Once finished it will allow me to monitor the power usage of home in real time, and per circuit. This will give me a better idea of how and where power is being consumed. I also have 3 RVs on my property, so getting an overview of what each RV is consuming will also be useful, the idea however is to have every circuit on the property monitored so that it matches up with what the power company shows we are using.

Code

voltage calibration sketchC/C++
its very similar to the voltage example given by the emonPi library however this one will show a running average of the voltage which is useful when calibrating the voltage.
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

#include "EmonLib.h"             // Include Emon Library
EnergyMonitor emon1;             // Create an instance

//code for average
const int numReadings = 30;
float readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
float total = 0.0;                  // the running total
float average = 0.0;                // the average
//code for average end

void setup()
{  
  Serial.begin(9600);
  analogReadResolution(ADC_BITS);
  //code for average
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }
  //code for average end
  
  emon1.voltage(0, 330, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(1, 101.1);       // Current: input pin, calibration.
}

void loop()
{
  emon1.calcVI(20,2000);         // Calculate all. No.of half wavelengths (crossings), time-out
  //emon1.serialprint();           // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
  
  float realPower       = emon1.realPower;        //extract Real Power into variable
  float apparentPower   = emon1.apparentPower;    //extract Apparent Power into variable
  float powerFActor     = emon1.powerFactor;      //extract Power Factor into Variable
  float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
  float Irms            = emon1.Irms;             //extract Irms into Variable (currentDraw)

  // subtract the last reading:
  total = total - readings[readIndex];
  // read from the sensor:
  readings[readIndex] = supplyVoltage;
  // add the reading to the total:
  total = total + readings[readIndex];
  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

  // calculate the average:
  average = total / numReadings;
  // send it to the computer as ASCII digits
  Serial.println(average);
  
  //Serial.print("");
  //Serial.println(supplyVoltage);
  //Serial.println(" C: ");
  //Serial.println(Irms);
  //Serial.println(" A: ");
  //Serial.println(Irms * supplyVoltage);
  //Serial.println("\n");
  
  //Serial.print("Watts: ");
  //Serial.println(Irms * supplyVoltage);
  //Serial.println("\n\n");
  
  delay(200);
}

Schematics

schematic - its a top down view, nothing special, just quickly whipped it up in GIMP
This is the schematic that I used to plan out my routing prior to soldering it up. It was created using GIMP.
Schematic vbtjo4cioj

Comments

Similar projects you might like

BrewCentral - Great Tasting All-Grain Brewing for Everyone

Project in progress by Team IoT Design Shop

  • 16,210 views
  • 6 comments
  • 54 respects

Arduino Due: MicroPython Enabled

Project in progress by AdiK

  • 7,180 views
  • 1 comment
  • 10 respects

Pachinko Arrange Ball Restoration

Project in progress by spiwrx

  • 1,156 views
  • 0 comments
  • 0 respects

Electronics of a hybrid rocket

Project in progress by Chrisy | Variint

  • 784 views
  • 0 comments
  • 4 respects

Arduino Altair 8800 Simulator

Project tutorial by David Hansel

  • 78,328 views
  • 109 comments
  • 166 respects

Relativ - Build Your Own VR Headset for $100

Project showcase by Team Relativty

  • 31,515 views
  • 20 comments
  • 111 respects
Add projectSign up / Login