arduino home based electrical energy data logger

14
Arduino Based Home Energy Measurement https://github.com/Tooblippe/Energy_Logger [email protected]

Upload: tobie-nortje

Post on 12-Mar-2015

1.188 views

Category:

Documents


4 download

DESCRIPTION

My little Arduino based home energy logger

TRANSCRIPT

Page 1: Arduino Home Based Electrical Energy Data Logger

Arduino Based Home Energy Measurementhttps://github.com/Tooblippe/Energy_Logger

[email protected]

Page 2: Arduino Home Based Electrical Energy Data Logger

Background

This is my attempt to build a small home based energy logger. It is not unique but has an RF12 on board so it can integrate with other

systems, and it logs data to an OpenLog unit This makes changing SD cards and logging a breeze It is based on OpenEnergyMonitor Many of these projects have been done all around the world I think what makes this one unique is the fact that the sensor unit (the

arduino with the CT) has a RF12 radio built in and also an Openlog unit from Sparkfun

The OpenLog unit is connected to the UART of the sensor unit. Full control off the Openlog can be obtained via the remote unit connected via RF12 radio

This means that the sensor unit can keep on logging to the Openlog. You can remotely initiate a session with the Openlog from the base station, and make changes to the settings, before putting it back in logging mode

Page 3: Arduino Home Based Electrical Energy Data Logger

Some facts Small home built energy logger Based on Atmel ATMega 328 chip and arduino compatible Based on the OpenEnergyMonitor project Measure current only, Voltage assumed constant RF12 radio installed, this makes the system very expandable OpenLog from sparkfun installed Voltage assumed constant and only RMS current measured using

Emon.cc library from the OpenEnergyLogger project

Page 4: Arduino Home Based Electrical Energy Data Logger

Device Setup

PCPython Script

ArduinoRemote Unit

RF12 RadioSends commands

Receive power data

Log CSV Power Data to file

Log to Pachube

ArduinoSensor Unit

RF12 RadioSend power info

Receive Commands

OpenLogLogs power info

Can be remote controlled

CT

RF Link

Plot LifeGraph

Page 5: Arduino Home Based Electrical Energy Data Logger

Some photos

arduino

OpenLog

CT

Radio and CT shield

Remote Unit– rx info, loggingSensor Unit – CT and

logging

arduino

SD Card

RF12

Page 6: Arduino Home Based Electrical Energy Data Logger

Connecting the CT Use bias resistor s to bias CT voltage around 2.5V, since the

controller cannot read the negative portion of the current wave We would have to filter out this DC voltage later on with a digital

high pass filter – refer to code in emon.cc The CT sensor produces a current that is proportional to the

instantaneous current flowing in the mains wire by: Isens = CTturnsRatio x Iinst

The resistor in parallel with the CT sensor is called a burden resistor and converts the current Isens into a voltage: VsensI = Burden Resistance x Isens

The two Rvd resistors from a voltage divider that outputs a voltage at half the Arduino supply voltage of 5V. This voltage biases the AC voltage produced by the CT sensor and burden resistor by 2.5V, needed because the Arduino analog input channel requires a positive voltage. Voltage at analog input = Bias Voltage + VsensI

The capacitor C1 stabilizes the DC bias as this can often be a source of considerable noise.

Suitable sizes for resistors Rvd are 10 to 100k. Higher resistance lowers energy consumption but also increases noise. A suitable value for C1 is 10uF.

Source - http://openenergymonitor.org/emon/node/59

Page 7: Arduino Home Based Electrical Energy Data Logger

Measuring Powervariable deceleration and setup

void loop()

{

for n=0 to numberOfSamples

{

read in voltage and current sample

remove voltage and current sample offset with digital high pass filter

correct current phase displacement with linear interpolation caused by: ADC multiplexing,

inherent CT and power adapter phase displacements.

accumulate squares of voltage and current for rms calculation

accumulate product of voltage and current for real power calculation

}

calculate values for real power, apparent power, power factor, rms voltage, rms current from accumulators

apply voltage and current calibration coefficients.

print values to USB serial

reset accumulators.

}

http://openenergymonitor.org/emon/

Page 8: Arduino Home Based Electrical Energy Data Logger

Measurement of home hot water energyRow Labels Sum of Energy06-Jun-11 11.107-Jun-11 12.908-Jun-11 9.609-Jun-11 11.210-Jun-11 12.011-Jun-11 9.412-Jun-11 10.813-Jun-11 8.214-Jun-11 10.0

Grand Total 95.0

Average(kWh) 10.56 Average kWh for a dayApprox Losses 1.50 Lets remove losses, to see how much we usedQ(joules) 32614785.61 We used this many joules for water heatingT1(degreesC) 65.00 Geyser SettingT2(degreesC) 10.00 Lets guess the input water temperatureMass of water use(litres) 141.19 Approximate water use for the house (Q=mc delta T)Number of people (n) 2.50 How many people in the house....baby = 0.5Litres of water used per person 56.48 Average water use per person per day

0.02.04.06.08.0

10.012.014.0

kWh

Daily Energy

[email protected]

Page 9: Arduino Home Based Electrical Energy Data Logger

Specific Day measurement

0

500

1000

1500

2000

2500

3000

3500

00:0

0:04

01:0

2:53

02:0

5:26

03:0

8:16

04:1

1:08

05:1

4:00

06:1

6:41

07:1

9:33

08:2

0:54

09:2

2:13

10:2

4:34

11:2

6:53

12:2

9:29

13:3

2:03

14:3

4:10

15:4

2:50

16:4

5:24

17:4

7:48

18:4

8:56

19:4

9:44

20:5

2:10

21:5

5:06

22:5

7:41

kW

Wed, 8 June 2011

Load(W)

Dad – Shower,Mom - Bath

Baby Bath

Daddy Bath

Mom, shower

DishesDishes

Dishes

Get some more logged data at https://github.com/Tooblippe/Energy_Logger/tree/master/loggeddata

Page 10: Arduino Home Based Electrical Energy Data Logger

Logging data to Pachube with Python

Log your realtime data to the clowd using Pachube and Python Dowload eeml -

https://github.com/petervizi/python-eeml/tree/207ef35b9c0dd64851249b83d91b5e0506c5ebbd

CODE Exampleimport eemlimport serial

# parametersAPI_KEY = 'YOUR PERSONAL API KEY'API_URL = 'YOUR PERSONAL API URL, LIKE /api/1275.xml'

serial = serial.Serial('/dev/ttyUSB0', 9600)readings = serial.readline().strip().split(' ') # the readings are separated by spacespac = eeml.Pachube(API_URL, API_KEY)pac.update([eeml.Data(0, readings[0], unit=eeml.Celsius()), eeml.Data(1, readings[1], unit=eeml.RH())])pac.put()

Page 11: Arduino Home Based Electrical Energy Data Logger

Project Info GIT -https://github.com/Tooblippe/Energy_Logger GIT Wiki -

https://github.com/Tooblippe/Energy_Logger#readme Sparkfun – www.sparkfun.com Arduino – www.arduino.cc OpenEnergyMonitor - http://openenergymonitor.org/emon/ My RF12 data hub -

https://github.com/Tooblippe/Energy_Logger/wiki/The-RF12-Radio

RF12 Radio on its carrier - http://www.flickr.com/photos/tooblippe/5665521708/

Page 12: Arduino Home Based Electrical Energy Data Logger

More about me www.navitas.co.za/tobienortje

Page 13: Arduino Home Based Electrical Energy Data Logger

Project licence Free as in really free... give us a mention and

we are happy, but you don't have to.

Page 14: Arduino Home Based Electrical Energy Data Logger

OpenEnergyMonitor info OpenEnergyMonitor is copyright © 2009,2010,2011 the OpenEnergyMonitor researchers (see developers), and

other contributors. Principal author:

Trystan Lea Ogoronwy, Llanfrothen, Gwynedd, North Wales, UK, LL48 6DJ   e-mail - [email protected]

OpenEnergyMonitor is free; you can redistribute it and/or modify it under the terms of the GNU General Public Licence as published by the Free Software Foundation; either Version 3 of the Licence, or (at your option) any later version.

OpenEnergyMonitor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licence for more details.

For this purpose the words "software" and "library" in the GNU General Public Licence are taken to mean any and all computer programs computer files images data results documents and all other copyright information available from the OpenEnergyMonitor project.

The copyright covers the neologism "OpenEnergyMonitor" in upper, lower, or any mix of cases in any typeface, also covered by the GPL. Anyone can use them freely in any way they choose, but they may not be registered as trademarks or restricted in any other way.

You can read the GNU General Public Licence here. This page you are reading now introduces the licence for the entire OpenEnergyMonitor project; that licence applies to all of it; if the links to the licence do not work, write to the Free Software Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110 , or see http://www.gnu.org/copyleft/gpl.html

  Hardware designs (schematics and CAD) files are licensed under the Creative Commons Attribution-ShareAlike

3.0 Unported License and follow the terms of the OSHW (Open-source hardware) Statement of Principles 1.0. All documentation on OpenEnergyMonitor is subject to GNU Free Documentation License  Overview of open-source licenses by Adafruit http://www.adafruit.com/blog/2009/03/28/open-source-hardware-

overview-slides/