Arduino energy meter on-line (Part 1)

I’ve always wanted to have an on-line energy meter that I could check and see the electricity consumption. This could be done in real time. This post is about getting it working with nothing but an arduino ethernet, an LDR and a resistor.

This is my personal Arduino energy meter project. It is based on an idea from Jon Archer at jonarcher.info (check my post about it). After checking his project I decided it was time for me to give it a try.

This is the first of a two post series. Check the second part here.

 

The idea behind the energy meter :

The basic functionality of this energy meter is to get the instant energy consumption in a nice graphical representation. With a look at the graphic you are able to see the amount of energy that it is being consumed in real time.

I have to say this project has changed my view of how energy is being consumed at home. So if you are ,as me, curious about all this stuff and go ahead and build your own.

-This project will work only with the newer energy meters that have a LED blinking every 1000W/h –

Energy meter with pulses output
My counter with the sensors installed

Research:

A search on google on energy meters brought some interesting projects with slightly different approaches. There are projects that read the consumption and save it in an SD card in CSV format. But removing the sd card and installing it in my computer would be too much hassel. My main goal for this project is to have an online live reading. Knowing this I narrowed my research to these types of projects.

Data recorded in an CSV file
CSV File

 

The connection between the arduino and the “server” is critical. This is the part that could make the project very simple or incredibly complex. I discarded different types of communications because they where too difficult to implement in an arduino. I also discarded options without proper documentation or lack of support. MQTT comunication was one of this options that I ended discarding for being too complex. Check my other post about a project using MQTT. This project is also using MQTT.

I know a bit of MySQL and I saw also another project posting data into a MySQL database. That’s fairly doable, but with all the data in the server you still need something to view it. There are ways of building a simple script to plot yourself all the data into a nice graph. But I always get lost in the configuration, implementations, etc…

 

Implementation:

For this project I wanted something simple, with the fewer steps possible. Something that me or any other person could comprehend easily.

Finally I did found something really interesting. Sparkfun is developing a modular node.js based data logging tool. This tool allows collecting data from the IoT. The project is called phant.io and you can use it for free (with some data transfer/storage restrictions). You can also get a copy of Phant.io and install it in your own server, virtual machine or raspberrypi.

Phant data logging
Phant.io

 

For the arduino software, Phant.io has plenty of documentation available at their site along with arduino examples that you can use straight away to get an arduino posting data to their servers.

Looking a bit further into data logging services I also found thingspeak. It looks simple, has a good support and a few arduino examples. I decided to give it a try both at the same time to compare.

thingspeak_logo
Thingspeak

 

So to clarify how the system works:

  1. There is an “arduino ethernet” sitting in the closet where the energy meter is.

    LDR
  2. In my house (an in most of the houses) the internet connection enters from the same place as the electricity. This is very convenient because we can connect from the “arduino ethernet” to our router using an ethernet cable.
  3. The arduino has a circuit with a light sensor (LDR) attached. This light sensor is extended with long cables to reach the energy meter and it is placed directly on top of the led emitting light pulses of the energy meter.
  4. The arduino reads the pulses and calculates the energy consumption for a given period of time. This data is then transferred to an external server (in this case data.sparkfun.com and thingspeak.com).
  5. Once the information is in the servers you can view the data in theyr respective control pannels. Sparkfun doesn’t plot any data into nice graphs but you can connect to analog.io to see the charts.
Schema
Energy meter logic schema

 

 Continues with hardware schematics and code at part 2. (To be published next week)

Leave a Reply