Created
July 31, 2017 15:05
-
-
Save ItKindaWorks/b5339cc122e029b85dcc1d1a465cd27b to your computer and use it in GitHub Desktop.
A small Arduino program to measure AC voltage using a voltage transformer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3 | |
#include "EmonLib.h" // Include Emon Library | |
#define VOLT_CAL 148.7 | |
EnergyMonitor emon1; // Create an instance | |
void setup() | |
{ | |
Serial.begin(9600); | |
emon1.voltage(1, VOLT_CAL, 1.7); // Voltage: input pin, calibration, phase_shift | |
} | |
void loop() | |
{ | |
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out | |
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable | |
Serial.println(supplyVoltage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment