Nigel MaloneyJakub NierodaAngel Grajales
Published

Electricity Usage Monitor

A sensor that returns the number of amps and the amount of power used at different times throughout the day.

BeginnerFull instructions provided1,467
Electricity Usage Monitor

Things used in this project

Hardware components

Photon
Particle Photon
×1
SparkFun CT Sensor (30amps)
×1
Resistor 330 ohm
Resistor 330 ohm
×3
RGB Diffused Common Anode
RGB Diffused Common Anode
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Breadboard (generic)
Breadboard (generic)
×1
Capacitor 47 µF
Capacitor 47 µF
×1
Fiberglass PCB
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Google Sheets
Google Sheets

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Allen Wrench
OpenBuilds Allen Wrench

Story

Read more

Custom parts and enclosures

Enclosure File for Laser Cutter

Schematics

Breadboard Layout

This initial breadboard design consisted of 3 resistors, a 40ohm resistor as a burden resistor, and 2 10k resistors as voltage dividers. For the PCB, the burden resistor was dropped because it was deemed unnecessary.

PCB Diagram

The PCB implementation of the circuit. All of the connections are made underneath the PCB for a cleaner look.

Sketch for Enclosure

Sketch for the enclosure. We decided on a small enclosure to make the final project as compact as possible

Code

Energy Monitor Library Code for Photon

Arduino
This is the reference library for the sensor.
// This #include statement was automatically added by the Particle IDE.
#include <EmonLib.h>
EnergyMonitor emon1;                   // Create an instance

double Irms = 0;
double Prms = 0;

void setup()
{  
  Serial.begin(9600);
  Particle.variable("Arms",Irms);
  Particle.variable("Prms",Prms);
  emon1.current(1, 60);             // Current: input pin, calibration.
}

void loop()
{
  Irms = emon1.calcIrms(1480);  // Calculate Irms only
  Prms = Irms*120;
  Serial.print(Prms);	       // Apparent power
  Serial.print(" ");
  Serial.println(Irms);		       // Irms
  delay(1000);
}

LED Code

Arduino
Code that changes the color of an RGB LED based on the values received from the CT sensor.
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;

void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop() {
    int R =0;
     int G =0;
      int B =0;
int val=analogRead(0);
val=map(val,0 ,2400, 0, 765);

if (val < 255)
{  R=val;}
else 
{  R= 255;}

if (val > 255 && val<510)
{  G=val- 255;}
else 
{  G= 0;}

if (val >510)
{ B=val- 510;}
else 
{ B= 0;}
digitalWrite(redPin, R );
digitalWrite(greenPin, G);
digitalWrite(bluePin, B );
}

Github for Energy Monitor Library

Credits

Nigel Maloney

Nigel Maloney

-1 projects • 2 followers
Jakub Nieroda

Jakub Nieroda

-1 projects • 2 followers
Angel Grajales

Angel Grajales

-1 projects • 1 follower

Comments