A super simple IOT home electric meter / record keeper

Simple IOT project of the day, a super simple IOT home electric meter / record keeper, without a need to modify anything at home.

  • Before you Start – This is very simple hands on
  • What is it – It’s a home electric meter that counts in both directions
  • What is it for – Keeping track of power consumption
  • How it is done – A clamp meter and a microcontroller board
  • Show me before i begin – A photo gallery
  • Components – What you need
  • Steps – steps to making the device

Before you start, you only need the first few paragraphs to construct this device, the rest of the blog post is simply an explanation of why we did things this way, the whole tutorial should be very simple to follow step by step. Photos of everything you need are also provided 😉 If you know how to solder, you can get through this. if you don’t, find a tutorial on YouTube on how to solder.

What is it

It is a simple always on clamp meter that keeps track of power consumption on a small server (Online, or at home), added in the same cabinet as the utility meter installed by the power company.

What is it for

Since this device allows me to continuously keep track of power consumption, and graph it, I can track down things that are not functioning as they should and drawing much more electricity than they should.

The idea was inspired by the fact that my water cooler was drawing way too much power, and it turned out that it was heating the water it cooled and cooling the water it heated ! so it was basically “on” for far longer periods than it should, the fault turned out to be a loose plastic piece in the cooler’s water tank.

How is it done

A cheap current transformer (Clamp) is attached to a microcontroller that is WIFI enabled, the microcontroller sends the readings to a server in the basement (That server is used for 1001 other things too).

Show me before i dig in

Here is a small gallery of everything you might want to see before you even begin !

HERE GALLERY

Action

Components

NOTE: This tutorial will show you how to do this with an ESP32 board as well as my own setup which is a combination of ESP8266 and Arduino pro mini

The components I chose here are mostly because i already have them lying around, if you are going the ESP32 route, I will cover it too.

  • 2 current transformers to take readings for 2 electric meters, in this example, they are the sct013 100A / 50mA
  • 2 Microcontroller boards, an esp8266 (esp8266MOF-12E) and an Arduino pro mini 3.3V (8MHz) (ESP32 is also covered as a single board)
  • A lousy 5V phone charger that is not capable of providing enough current to charge a modern phone in a timely fashion, but should do for this as long as we have a voltage of above 4.1V.
  • An LD33CV voltage regulator combined with 2 capacitors (10V – 680uF) each.
  • 1 x 10uF capacitor
  • An 23.34ohm resistor (Either series resistors or step down) as a burden resistor if you are using 3.3V board such as ESP8266 or ESP32, or a 35.36 ohm resistor if you are using a 5V board. if the values can’t be made with resistors in series, you need to go DOWN with the value to the next resistance value
  • 2 SCT013 – 100A – 50mA current transformers
  • A pair of equal resistance resistors as a voltage divider, the values are anything between 10 kΩ and 400 kΩ (The smaller is more precise, the larger resistance consumes less battery)
  • A 5CM x 7CM Universal PCB Board

And obviously you need to use a soldering iron unless you wish to use a breadboard.

IMPORTANT: I recommend you use 1 ESP32 board instead of my setup, and use the analogue inputs on that, AND SKIP MUCH OF THIS BUSINESS, one thing to note though is that the ESP32 has one of it’s 2 ADC channels disabled when WiFi is enabled (A channel with X Analogue pins), I will cover this so don’t worry.

So why did i make it with an Arduino pro mini (3.3V) and an ESP8266 connected together in SPI (Against my own recommendation) ? that is because i got those current transformers and went to sleep, by the time i woke up, it was 12:43AM, I woke up and decided on the project, and those are the parts that were at hand that very minute, the Arduino has 8 usable analogue inputs (for sensing the current passing through the current transformer) , The ESP8266 on the other hand has 1 analogue pin and i wish to connect 2 clamp meters to this board

The Arduino pro mini (or any other using the ATmega328 micro controller) only has 6 ADC pins available instead of 8 if you use I2C as 2 are for I2C

Now, let us get to making it, this project takes a few hours to make, and you might want to change some things as i don’t think you need to have 2 microcontrollers connected together in SPI (I don’t remember why i chose that over I2C).

I won’t get too much into why I am using these resistor values, Just use them.
Hint: the reason for the choice is obviously ohm’s law, once for telling the current from the voltage drop using the burden resistor, the other two are a simple voltage divider (use an online voltage divider calculator if you need something different)

Step 1: Cut the endings of the SCT013current transformers to expose the wires, in my case, he SCT013-50mA came with a audio stereo jack, the tip (usually left speaker) was connected to the white wire, the sleeve (usually ground) was connected to the red wire, and the ring (middle usually right speaker) was not connected to anything, the shield on the wire exists but is not connected to any pins on the jack side.

What we need to connect in this case above is the white wire (tip) to the center of the voltage divider, and the red wire to the analogue input pin of the Arduino, the sleeve of the cable which is not connected to anything on any side should be connected directly to the ground pin of the Arduino .

Now, to see the connections, you might want to inspect this photo, I have used Photoshop to make it clearer and to point out where components are connected.

Leave a Reply

Your email address will not be published. Required fields are marked *