Christopher Mendez Martinez
Published © GPL3+

Grove AC voltage sensor for a DIY Smart Energy Meter

Electrical energy is crucial in our lives, and it is very important to know how we use it in order to be aware of how to do it prudently.

IntermediateFull instructions provided2,831
Grove AC voltage sensor for a DIY Smart Energy Meter

Things used in this project

Hardware components

Wio Terminal
Seeed Studio Wio Terminal
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Schematics

Circuit diagram

Code

Code

Processing
Define the analog input pin you are using in the emon1.voltage(x, 523.56, 1.7);
Modify the calibration factor until you have an accurate value compared to an AC voltage meter (multimeter).
// Code based on Emon Library example

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

void setup()
{  
  Serial.begin(115200);
  
  emon1.voltage(A1, 523.56, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(A0, 111.1);       // Current: input pin, calibration.
}

void loop()
{
  emon1.calcVI(2000,2000);         // Calculate all. No.of half wavelengths (crossings), time-out
 
  
  float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
  Serial.print("Voltage =");
  Serial.print(supplyVoltage);
  Serial.println(" Volts");

}

Credits

Christopher Mendez Martinez

Christopher Mendez Martinez

35 projects • 74 followers
Electronic Engineer and Tech YouTuber who loves automation, programming and sharing his knowledge with everyone.

Comments