Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sat Dec 31, 2011 9:39 pm

I have a laptop that is tied up with an Owl energy monitor (run from our solar array).  The Raspi would probably be a much better option for such a job rather than tying up my expensive (in relation) laptop and reduce power consumption on my battery bank.  The monitor should be networked so you can remotely access it,and the recorded data over the home network via portable devices such as tablet pc's and smart phones.

Ability to monitor individual appliances if needed and even control their use.  It would be great to make use of the live data from the National Grid, so you could provide dynamic demand for say battery charging i.e mobile phones, portable equipment etc.  I know on an individual basis this isn't much, but if a cheap controller could be made, open source then maybe thousands of people could use the device.

I have been working on prototypes using discrete units for various parts of the above, but now think the Raspi could be the core to this idea as a single unit with multiple power monitor and management abilities.

Guys, let your imaginations run and toss in your ideas.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Sat Dec 31, 2011 10:57 pm

Thats interesting, I did not know that you could connect the Owl energy monitor to a PC.

Is that using USB?

You should have a look at http://openenergymonitor.org/emon/ they are a friendly group trying to achieve the same as you but using Nanodes.

The Pi would also make a good solution but is not as low power.

What you propose is perfectly 'doable' with a Pi. In many ways it would be easier to setup the Pi to log usage / generation etc and then serve that up as a set of web pages than using a Nanode. The linux make the web side so easy.

Measurement & instrumentation would be the main 'to do' with the Pi which is why I find your Owl & Laptop monitoring setup interesting.

Would you mind posting more details on that setup?

EDIT: No need, found it. Would you check your manual plz, how many channels can you use between the CT and the Owl monitor?

I would be very interested in sharing ideas on this project, its one of the projects I aim to do.

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 12:54 am

3 CT channels, but I think you can have multiple transmitters, not sure as I don't have more than one, but the software from Owl allows me to setup multiple units.  The big problem with the Owl unit is the way they encode the data transmissions.  I haven't really found a concise guide to decoding and reusing the data other than within Owls utility.

Programming is not my strongest subject

tank
Posts: 64
Joined: Thu Dec 15, 2011 5:51 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 10:00 am

Most Current Cost units output XML data to a USB  cable.

See http://www.currentcost.com/cc128/xml.htm

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 11:06 am

Interesting.

I did some more digging. The OWL does not have a Linux driver. The support desk's answer is that it will depend on demand. You know what you have to do!

There are some groups attempting to reverse engineer the protocol.

The OWL would be fine as a logging device if it had a driver.

The CurrentCost would also be fine. You would need a USB to RS232 convertor, they cost £10 or so.

I suspect that neither device would be great for the job of energy management i.e. switching something on/off based on solar PV generation.

The reason is that consumer unit monitoring unit is low power (on batteries) and may only send a reading every minute (IDK).

A reading every minute would not cope well with transient loads, kettles etc. or clouds?

Not so sure about the clouds, would want to log and see what reality is. Maintaining a gap between use and generation may be enough. Perhaps the number of cloud & transient events is minimal and so the effect on importing would be minimal.

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 12:40 pm

The Owl isn"t used for load switching, it just gives you a rough guide to overall house electric consumption. That was why I said other tasks use other equipment to monitor and manage other aspects of my project.

The Owl is a cheap simple solution in a windows environment, but it"s xml data can be used and broadcast. The Owl doesn"t have to be the final device used, it serves a purpose in developing the idea.

Solar is more resilient in cloudy conditions than I think you understand. Power rises and falls depending on conditions you rarely have zero generation during daylight. Our power is captured and stored in batteries for 24/7 use. Prolonged cloud cover and high demand means we still need to top up the batteries from grid power at times during the winter. My need for smart monitoring is to minimise this and pick the best times for recharging from grid.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 12:46 pm

Sorry, thinking ahead & not explaining.

Two Owl channels. One monitoring consumer use the other monitoring PV generation.

RPI monitors both & when PV>Consumer Use+Device load then switch devices on (probably using one of the home plugs that are available).

That was the context of my comments.

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 1:18 pm

Thanks Bradburts,
Unfortunately the Owl is no use for measuring DC current and too slow for transient changes as you mentioned. I could monitor the inverter mains out, but we have multiple inverters for load management. Much better to have inverters matched to loading and make our system fault tolerant. So, low 24/7 demand we run 200w inverter, then switch in another or use the 1000w for heavy loads. The system here is based on a 750w solar array and 4.8kw of storage.

Think of it like banking, we save money during the day, withdraw at night or for large purchases, then budget the following day and do our best to stay out of the red.

We aren"t self sufficient in power, but could be in the future if we had to be.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 1:54 pm

I am confussed as to what your setup is/what you want to achieve.

It sounds like you are supplying power from a battery bank but you mention monitoring the grid.

I was assuming that you are grid tied (for FIT tarrif) and so would monitor from PV->Grid Tie-(monitor AC)->Consumer Unit.

Don't see where the DC monitoring or multiple inverters come in.

(would have thought that a modern switching invertor would only change efficiency by a few % over a KW range)

If you want to measure DC current then a simple current shunt may do. The "Gert Board" would provide you with the analogue to digital input channel for the Pi to convert. You could also use a USB soundcard's microphone input.

Either wasy you would need to level protect inputs but it would be a fairly simple project.

PS I would be interested in your experience with batteries as I am considering using. At 20% energy increase PA sounds to me that I better get started soon.

How long have you been using batteries?

What batteries do you use? How long do you expect the batteries to last?

Do you maintain the batteries in anyway?

Bakul Shah
Posts: 320
Joined: Sun Sep 25, 2011 1:25 am

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 2:21 pm

May be you can use a Hall effect current sensor? Honeywell CSLA2CD ($20 @ Amazon) can measure AC or DC current up to 72A. 3 µs response. 32.7mV per Amp, relative to Vcc/2 (so if Vcc is 8V, current 10A, you'd see 4.327V). Readymade monitoring sensor can be had for $79 but it'd be more fun to build one with a PIC or TinyAVR + Raspi!

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 2:36 pm

Yep,

we are avoiding the whole fits fiasco, but thats another story....  We have been building our system over several years, the current setup has been in use 3yrs.

We are not independent of the grid, I monitor it via the National Grid website to watch trends and demand as I have an interest in power generation and use.

The power we generate is being used in our home and business.  We are building on a shoestring budget.  Most companies will sell you a system based on what your demand is or how much money you want to make!!!, so most people say its too expensive and don't bother.  We took the decision to build a system we could afford and tailor our energy demand to it.  As the system grows we get closer to being less grid dependant.

We started from a 10w panel charging a phone and PDA and the system has grown and continues to grow.  The more money we save the more we can reinvest in our energy systems.

Smart monitoring is needed to know where and what we are saving and how we can improve.  By monitoring we can also detect faulty appliances and other anomalies, even climate change by how much energy each month produces over the years.

Batteries require maintenance and supervision, but less than looking after hen's (haven't got any hen's by the way) or watching Eastender's.  We don't have a TV so plenty of time for research and development.  Our heating system is solid fuel and it alone paid for the current solar install we have, oh and we live in a normal suburban estate not the middle of nowhere LOL

Our way is not for everyone, but aspects of what we do can be used by the wider community and I am happy to be a guinea pig for ideas.  As you say, power is getting REALLY expensive and having a foot on the ladder is a must these days.

It could all be derailed by cold fusion, but I won't hold my breath on that or any other magic fix. (magic=any technology sufficiently advanced that we don't understand it)

Oh and have fun doing all the above

Joules
Posts: 87
Joined: Sun Dec 25, 2011 8:50 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 2:45 pm

Thanks Bakul,

we already use hall effect sensors and Arduinos for DC and low power monitoring, but it's all a very messy setup I use and not very integrated.

tank
Posts: 64
Joined: Thu Dec 15, 2011 5:51 pm

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 4:26 pm

Bradburts said:


Interesting.

I suspect that neither device would be great for the job of energy management i.e. switching something on/off based on solar PV generation.

The reason is that consumer unit monitoring unit is low power (on batteries) and may only send a reading every minute (IDK).

A reading every minute would not cope well with transient loads, kettles etc. or clouds?



I've done some testing in the past with a CC128 unit, and that sends every 6-12 seconds. Also some dev boards are available that you can add your own sensor equipment to see http://currentcost.posterous.c...../devboards

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Sun Jan 01, 2012 5:10 pm

Thanks.

Just read the datasheet, new measurement every 6 seconds.

That should do just fine, clouds don't move that quick :)

Going check if the transmitter will take more than one CT or if you have to buy two transmitters...

tank
Posts: 64
Joined: Thu Dec 15, 2011 5:51 pm

Re: Smart Home Energy Monitor

Mon Jan 02, 2012 12:32 pm

Bradburts said:


Thanks.

Just read the datasheet, new measurement every 6 seconds.

That should do just fine, clouds don't move that quick :)

Going check if the transmitter will take more than one CT or if you have to buy two transmitters…


The standard transmitters can take two extra clamps (usually for three phase) but the individual readings are available, not on the display but via the XML output.

bradburts
Posts: 341
Joined: Sun Oct 02, 2011 7:07 am

Re: Smart Home Energy Monitor

Mon Jan 02, 2012 4:15 pm

That's great, thanks for checking.

p4trykx
Posts: 127
Joined: Wed Jan 11, 2012 2:55 pm

Re: Smart Home Energy Monitor

Sun Jan 15, 2012 2:28 am

Analog Devices makes energy meters. Look here there are chips with measuring on shunt resistor and with spi output so you can directly connect it to Raspi.

Those chips multiply the current voltage and current so the output is just like the one on your energy meter. It's easy to solder them and they don't need current transformers just a shunt resistor.

Bridgjr
Posts: 3
Joined: Mon May 14, 2012 7:16 pm

Re: Smart Home Energy Monitor

Mon May 14, 2012 7:32 pm

Received my pi at the weekend and as I'd already got a Linux box talking to my EON supplied energy monitor (a free CC128 with supplied RS232 to USB cable) thought this would be a good project to start.

I'd built a Debian image a few months back and when I plugged in the USB it didn't recognise it as a serial device (ttyUSB0). After some tinkering I tried the latest Debian squeeze image which must have the PL2303 serial driver as with this it worked fine.

I created a web server with PHP as documented on the Wiki and used the Currentcost python code I found on the web and with some messing around I have it listening on the USB port and reading the XML file every 6 seconds.

I pull the watts used from the XML and store it in a MySQL server on my NAS box although I will have this on the pi at some point as well.

Using PHP and the web server on the pi I can read the data back out of the database and create a graph of my usage for the past few hours. Not very pretty at the moment but the basic info is there. The web page updates the picture every few seconds so you can get a live feed of the usage. Very interesting when you boil the kettle etc.

Happy to share code with anybody whose interested but bear in mind I've never you python before and have only ever coded as a hobby so there are probably better ways of doing things.

Ogoshi
Posts: 45
Joined: Wed Dec 28, 2011 5:13 pm
Location: Southend-on-Sea, Essex, England

Re: Smart Home Energy Monitor

Mon May 14, 2012 10:05 pm

oh darn, I threw out my Eon monitor a few months back as couldn't find a suitable home for it - I think the transmitter is still wired up though! Using your method would have been great as the monitor could go in the cupboard with a pi then just look at the stats using a browser.
Oh well!

gazza_d
Posts: 5
Joined: Thu May 24, 2012 9:36 pm

Re: Smart Home Energy Monitor

Thu May 24, 2012 9:42 pm

Have you checked out Open Energy Monitor? It uses open source arduino based hardware to measure the electricity usage (emontx) and send wirelessly to a arduino powered base station (emonbase) which then uploads to a webservice & database (emoncms)which can be self hosted.

I have one and the db/web service currently runs on a pogoplug running debian. some of the complicated graphs and queries take a few seconds to load, but by and large it works great. Emoncms shoud cheerfully run on a raspberry as well.

Bridgjr
Posts: 3
Joined: Mon May 14, 2012 7:16 pm

Re: Smart Home Energy Monitor

Thu Jun 07, 2012 1:57 pm

Not seen this before. Don't have the arduino bits but will look into converting the output from the CC128 meter to a format where emoncms can read it, already writing to MySQL so shouldn't be a problem. Will certainly look a lot prettier than my current graphs and imagine there's much more functionality as well.

Just looking at the latest video with MQTT etc. on the home page and imagine it's fairly straightforward to publish to a broker, may have to have a play with that too!

Bridgjr
Posts: 3
Joined: Mon May 14, 2012 7:16 pm

Re: Smart Home Energy Monitor

Fri Jun 08, 2012 11:50 am

Openenergymonitor.org blog someone has kindly posted Raspberry Pi instructions which I followed to install emoncms on my Raspberry Pi. Doesn't appear to work with Lighttpd unfortunately, probably due to me not understanding mod_rewrite but with Apache everything looks good.

Just added a few lines to my Python code to post to the api on the web server and now updating the emoncms database.

Next step to work out how to get the dashboards show what I want but sample Visualisation API shows what is possible all very impressive.

Even more so that it's running entirely on the RPi, reading from the meter, writing to MySQL and running the web server and PHP to produce everything... and only using 3 watts to do it all :)

iwallace
Posts: 1
Joined: Fri Jun 15, 2012 6:51 pm

Re: Smart Home Energy Monitor

Fri Jun 15, 2012 6:57 pm

This may be of interest to others with a Current cost cc128...

http://www.lifeofstu.com/?page_id=17

I tried this before on a bifferboard but wasn't able to make it work.... Thought I would give it a go with the pi..

download the source, run make.. plug in Current cost meter and it just works. Check out his readme for how to call just the data via a webpage.

chay
Posts: 1
Joined: Sat Sep 01, 2012 11:16 am

Re: Smart Home Energy Monitor

Sat Sep 01, 2012 11:57 am

Slight variation on the theme, having already configured Apache server, PHP and mySQL on the Raspberry Pi to learn PHP and mySQL.

Was also struggling with Perl and serial ports, so had a look at PHP as this would give me the mySQL interface I'd already learnt about.

Using PHP as a constantly running background task on the RPi, to read the (USB) serial port from the CurrentCost CC128, extract the information and place it into mySQL database on the RPi.
It's small and quick which with less risk of serial port buffer overflow.

Code: Select all

// Conect to database and select table
mysql_connect('localhost', 'mysql-username', 'mysql-password') or die;
mysql_select_db("energy_mon_table") or die;

// Set the serial port baud rate and open
exec('stty -F /dev/ttyUSB0 57600');
$handle = fopen("/dev/ttyUSB0", "r");

// never ending loop
while (1) {

  // Wait for and reads a line from the serial port
  $string = fgets($handle);

  //DEBUG example string: $string = "<msg><src>CC128-v0.12</src><dsb>00888</dsb><time>00:01:59</time><tmpr>20.8</tmpr><sensor>0</sensor><id>00902</id><type>1</type><ch1><watts>00057</watts></ch1></msg>";

  // Regular expression to extract the data of interest
  // would need to be refined to cope with additional sensors etc.
  if (preg_match( "/\<msg\>\<src\>CC128-v[\.\d]+\<\/src\>\<dsb\>0*(\d+)\<\/dsb\>\<time\>([:\d]+)\<\/time\>\<tmpr\>([\.\d]+)\<\/tmpr\>\<sensor\>0\<\/sensor\>\<id\>00902\<\/id\>\<type\>1\<\/type\>\<ch1\>\<watts\>0+(\d+)\<\/watts\>\<\/ch1\>\<\/msg\>/", $string, $matches)) {

    //echo "DEBUG: DSB: $matches[1];  Time: $matches[2];  Temp: $matches[3];  Watts: $matches[4]\n";

     $result = mysql_query("INSERT INTO energy_mon_table (service, dsb, meter_time, temperature, consumption) VALUES
               ('E', '$matches[1]', '$matches[2]', '$matches[3]', '$matches[4]')");
  }

}
The PHP runs continuously from command line:

Code: Select all

php5 current_cost.php &
or from boot:

Code: Select all

added to /etc/rc.local :

if [ -f "/home/username/current_cost.php" ]; then
  php5 /home/username/current_cost.php &
fi
(Using 2012-07-15-wheezy-raspbian)

tknows
Posts: 3
Joined: Sun Sep 16, 2012 12:12 am

Re: Smart Home Energy Monitor

Sun Sep 16, 2012 12:35 am

Now this is the kind of use that would make me buy a Pi. I've been looking for a good project. Media servers and such don't really interest me because I've done those and they're no fun anymore. But energy monitoring, this could be fun.

How feasible would it be to get to a point of appliance level monitoring? Imagine a dashboard that could indicate energy draw from different rooms and report on appliance-level usage. Lighting would be difficult but just thinking about things for now.


t

Return to “Automation, sensing and robotics”