Project in progress

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

• 1,822 views
• 0 respects

## Components and supplies

 Arduino Due
×1

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;
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);
//code for average
}
//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:
// read from the sensor:
// add the reading to the total:
// advance to the next position in the array:

// if we're at the end of the array...
// ...wrap around to the beginning:
}

// 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

This is the schematic that I used to plan out my routing prior to soldering it up. It was created using GIMP.

#### Author

##### xekon
• 1 project
• 0 followers

• Using arduino due for emonpi library by boredman

#### Published on

December 21, 2019
See similar projects
you might like

#### Humidity Sensor Calibration

Project tutorial by engineer2you

• 7,494 views
• 10 respects

#### LiPo Low Voltage Cutoff

Project tutorial by Jean-Michel Julien

• 7,174 views
• 14 respects

#### AVR High Voltage Programmer 2

Project tutorial by Dilshan Jayakody

• 7,572 views
• 1 comment
• 15 respects

#### BrewCentral - Great Tasting All-Grain Brewing for Everyone

Project in progress by Team IoT Design Shop

• 18,608 views
• 58 respects

#### Arduino Due: MicroPython Enabled

Project in progress by AdiK

• 12,510 views