Introduction: Energino: an Arduino-based Energy Consumption Monitoring Shield

Energino is a plug-load meter that measures the amount of power consumed by whatever DC electrical appliance is plugged into its. It was originally designed to monitor the energy consumption of simple networking devices such as Ethernet switches and WiFi access points, but it can be used to monitor any DC appliance. Energino "sits" between the power supply and the actual device being monitored. Energino is also equipped with a mechanical relay allowing you to turn on/off whatever appliance that is plugged into it.

It has the following basic features:

* Supported load voltage: 0-60V
* Supported load current: 0-5A
* Sampling rate: up to 5000 Hz
* Sampling resolution (voltage): 60mV
* Sampling resolution (current): 30mA

Moreover,  when used in combinations with an Ethernet shield it supports:

* push interface to COSM (formerly Pachube) 
* REST interface for polling current energy consumption and for turning the attached device on/off 

Step 1: Bill of Materials

In order to assemble an Energino shield you will need:

Energino PCB from Fritzing or a Proto Shield
ACS712 Low Current Sensor Breakout
Resistors 10K x2
Resistor 1K
Resistor 100K
Diode 1N4001
Transistor NPN 2N3904
Screw terminals (2 Pin) x2
Relay Omron G6E-134PL-ST-US
Arduino Stackable Header - 8 Pin x3
Arduino Stackable Header - 6 Pin x1


Step 2: Assembly

Copy the diagram to a breadboard and check that you can run the Energino script, then you can start soldering the components on a proto-board.

Alternatively you can use this Fritzing project to order a professionally printed PCB frorm Fritzing. 

Fritzing is an open-source an open source initiative for designers, artists, and hobists. Among other things Fritzing allows you to create a custom PCB layout and have it manufactured for you at a very honest cost. For example an Arduino shield costs 19 Euro. You can find more information in their official web site and you can order the PCB from the Fritzing Fab.

In the pictures you can see the Energino shield mounted on top of either an Arduino UNO or an Arduino UNO + Ethernet Shield.

Step 3: Calibrating the Current Sensor

The ACS712 chip outputs an analog voltage that varies linearly with sensed current. The regular version can measure up to 5A of DC or AC current. In the Sparfun breakout board an opamp gain stage has been added for more sensitive current measurements. In particular by adjusting the gain of the embedded opamp (from 4.27 to 47) it is possible to measure very small currents.

In order to calibrate the current sensor  you must configure the offset and the gain trimmers using a screw-driver and a digital voltmeter. This is done in two steps:

1) Configuring the offset. With no current on the sense lines, adjust the offset in order to read about 2.5V on the sensor output line. 

2) Configuring the gain. With a known current input Iref (a 100mA limited supply works well for this), set the gain in such a way to read the desired value Vref on the output line. The sensitivity is then given by (Vref - 2.5) / Iref. For example, if with a reference current of 100mA the sensor output line reads 2.8V, it follows that the sensor sensitivity is 3 V/A. 

Considering that the sensor output increased linearly with the sensed current and that the maximum value cannot exceed 5V, it follows that the gain must be set as a tradoff between resolution and maximum measurable current.

Download the Arduino sketch available here and open it using the Arduino SDK. Before uploading the code to the microcontroller remember to modify the OFFSET (in mV) and the SENSITIVITY (in mV/A) variables using the values above. In the screenshot the OFFSET is set to 2500mV while the SENSITIVITY is set to 850 mV/A

Step 4: Setup for Command Line Interface Logging

A typical setup is reported in the attached figure. The following elements can be found:

* The Energino placed inside the Arduino Project Enclosure
* The wireless router whose power consumption we want to measure (the blue box)
* A laptop used to log the instantaneous power consumption samples
* The wireless router's DC power supply (18V, 1A max)

Notice that, when using the USB cable as power source, we noticed that the 5V pin on the Arduino UNO would supply less than five volts which in time led to a slight offset in the current sensor readings. In order to take mode precise measurements, using an additional external 9V power supply for the Arduino UNO is advised.

After loading the sketch to the microcontroller using the Arduino SDK, you can download the Python command line utility from here and use the command line utility to poll the Arduino board for the instantaneous power consumption of the attached device.

Let's give a look at the utility's parameters (notice that $ is the command prompt):

$ ./ --help
Usage: [options]

  -h, --help            show this help message and exit
  -p PORT, --port=PORT 
  -i INTERVAL, --interval=INTERVAL
  -o OFFSET, --offset=OFFSET
  -b BPS, --bps=BPS    
  -v, --verbose        
  -l LOG, --log=LOG

If the Arduino is attached to /dev/tty/ACM0 and we want to fetch the power consumption statistics every 100ms, we should use:

$./ -p /dev/ttyACM0 -i 100

This will produce an output similar to:

2012-03-15 13:08:08,586 17.886 [V] 0.5 [A] 8.951 [W] 90.0 [samples]
2012-03-15 13:08:08,611 17.886 [V] 0.493 [A] 8.822 [W] 85.0 [samples]
2012-03-15 13:08:08,639 17.886 [V] 0.5 [A] 8.936 [W] 95.0 [samples]
2012-03-15 13:08:08,662 17.886 [V] 0.519 [A] 9.28 [W] 85.0 [samples]
2012-03-15 13:08:08,683 17.886 [V] 0.496 [A] 8.879 [W] 95.0 [samples]
2012-03-15 13:08:08,707 17.886 [V] 0.496 [A] 8.865 [W] 85.0 [samples]
2012-03-15 13:08:08,730 17.886 [V] 0.488 [A] 8.722 [W] 95.0 [samples]
2012-03-15 13:08:08,754 17.886 [V] 0.512 [A] 9.151 [W] 85.0 [samples]
2012-03-15 13:08:08,775 17.886 [V] 0.494 [A] 8.836 [W] 95.0 [samples]
2012-03-15 13:08:08,802 17.886 [V] 0.502 [A] 8.979 [W] 90.0 [samples]
2012-03-15 13:08:08,826 17.886 [V] 0.496 [A] 8.879 [W] 85.0 [samples]

Step 5: Setup for Logging to COSM

When used in combination with an Ethernet shield, Energino can also export the energy consumption statistics to Cosm. Cosm is basically a web service which allows you to upload any kind of numeric data produced by Internet of Things applications. Common examples are temperature sensors, etc.

The Arduino sketch for the Ethernet version can be downloaded here. Before loading it to Arduino make sure that you modify the variables FEED and KEY with, respectively, the your feed number and your COSM key. The two variable can be found at line 57 and 58. The script assumes that the Ethernet shield will obtain an IP address from a DHCP server. This is the most common scenario if you plug the Ethernet shield to your ADSL modem/switch at home.

After loading the sketch, Energino will start uploading the energy consumption statistics to COSM.


Neselot made it!(author)2017-02-15

This is cool, the only thing however, is that I would like to see it accept up to 120 volts in the future because many household appliances use that voltage

crengle made it!(author)2014-12-12

A really useful tutorial, but what do I need to change in order to measure 220V AC consumption and get rid of the relay?

donkeyknee made it!(author)2013-07-18

Thats great...

roberto.riggio made it!(author)2013-07-18

Thanks :)

mykiscool made it!(author)2012-08-06

This is cool, the only thing however, is that I would like to see it accept up to 120 volts in the future because many household appliances use that voltage.

roberto.riggio made it!(author)2012-08-10

We the point is that I was not confortable with working with the mains at home. This project is meant for DC devices such as access points, adsl routers, etc.

About This Instructable




More by roberto.riggio:Energino: an Arduino-based energy consumption monitoring shield
Add instructable to: