How to draw a myelectric style bar chart

Part of the android app tutorial series: How to build an Energy Monitoring android App P1
Both the myelectric emoncms module and the soon to be myelectric android app have a bar chart that is written using the 2d graphics canvas. This short guide details how the bar chart is built and the first part is written to be applicable for different programming languages with examples in each particular language to come at the end, there's one for android java canvas at the moment.

Writing custom graphs is not as complicated as I initially imagined it to be. Once you have a grasp of 2d graphics canvas sometimes its easier to write your own graph to get the style that you want. The myelectric graph was written from scratch in order to achieve a precise look: simple color scheme, bar height values overlayed on the bar, kWh label in the top-left corner.

Tutorial: How to draw a myelectric style bar chart

Gwynedd Council Award 2014

Many thanks to Gwynedd Council (our local council) inviting us along to the Gwynedd Business Week dinner and presenting us the 'Special Contribution to Gwynedd's Economy' award week before last. 

It's great to be recognised locally for our achievements, especially being an open-hardware business where everything we develop is open-source both hardware and software. It shows that there is a different way of doing things, technology business does not always need to be about closed IP, open-source works and open-source hardware businesses could be a way to have local employment not just here in North Wales but all over the world.

Trystan stepping up to receive the award 

A little side story about the slate plaque: We love the slate plaque, slate is very appropriate material to the area; North Wales was once the slate mining capital of the world. Nowadays the slate quarrys and mines are far fewer, many being dormant landmarks in the area used as recreation areas (e.g. our personal favourite, rock climbing :-D ). One underground cavern is used to house a 1.7MW pump storage hydro-electric power station which is the second largest in Europe  and 8th largest in the world

View from the Llanberis Slate quarries - the round building is a vent hole for the 1.7MW pump-storage hydro power station underground...very cool!  

Diolch yn fawr Cyngor Gwynedd! 

How to build an Energy Monitoring android App part 1

Glyn and I have wanted to have an android app to make it easier to access energy monitoring data from phone's and tablets for sometime.

Last year we took part in a student project to develop an Emoncms android App with Mathew Keegan who was studying at the time at Aberystwyth University. Mathew made good progess on the foundations of the app which I've uploaded to github here:

I've been trying to learn a bit of android app programming to understand what Mathew has developed. I followed a couple of Hello World tutorials and then explored networking and how to update the display. I've written up my notes as a tutorial: How to build an Energy Monitoring android App part 1 here:

How to build an Energy Monitoring android App part 1

Im going to try and continue development in this style by writing tutorials of how to do each step.

I think we should all be able to build our own software (if we want to) and given the rising use of tablets and mobiles as our personal computing devices having at least a basic understanding of how to build an app is enlightening and satisfying to see the results on your phone. Even if you've only dabbled in software before I would like to encourage you to try the tutorial, please ask me if I can clarify anything and feel free to send me a github pull request with edits to the tutorial.

My next tutorial will focus on how to use android graphics canvas to draw a graph that looks like the myelectric graph in the myelectric emoncms module.

I've posted this blog post on the forum's here which is a better place to discuss:

Emoncms Mobile View (My Electric)

The latest version of Emoncms (V8) has got a feature called 'My Electric', this is a ready made mobile friendly dashboard.

Just click the 'My Electric' button once logged into Emoncms and select your Power and KWh/d feeds. You will notice that that URL for this page automatically contains your API key, this is to enable this page to be bookmarked and easily accessed on a mobile device.

If you use Chrome on both your desktop and mobile device your bookmarks will automatically sync. For even easier access Chrome on android allows web-pages to be pinned to the home screen for one button full screen access, this makes the Emoncms page load almost instantly, just like a native app giving a real-time dynamic view of how much power is currently being consumed or generated. Just follow the steps below:

On first visit the My Electric page will ask you to select your Power and KWh/d feeds

To create a shortcut on your android home screen hit the 'Add to home screen' button in Chrome

A shortcut is now created on your homescreen to enable quickly firing up the dashboard

When the homescreen short-cut is launched the My Electric dynamic mobile view page loads up almost instantly in Chrome in fullscreen mode (no URL bar etc.). This makes  it appear like a native app
Recently Trystan has been working on taking the first steps to building a native android Emoncms app documenting the progress of building android apps as he goes along. If your an android developer who fancies working on this, please get in touch. See here for Trystans progress:

Emoncms 'Hello World' android App

Development update: EmonHub, Emoncms&MQTT, Application guides

There's been a lot of development happening recently but not being blogged about so here's a short overview with links to where to find out more:

EmonHub (The next version of the oem_gateway)
Paul (pb66), Jerome, Dave McCraw and I have been discussing the best way to integrate the ability to listen and dispatch data with different datatypes and how best to integrate threading so that dispatchers cant block the other dispatchers and listeners.

Using MQTT with Emoncms to make a more extensible flexible system.
We've discussed the idea of using MQTT within emoncms several times before but the idea came up again during discussion about the best way to implement node decoding in emonhub. Emoncms could provide some of the same features of emonhub ie multiple listeners and multiple dispatchers in an elegant way if it incorporated mqtt message queues. It would also provide benefits for control as initially explored here last December

Here's a system diagram of how it could look like:

This approach needs a fair bit of work to make it a really nice solution, If you think this is the way to go it would be great to get some help with making it happen, in particular:
  • Integrating the event module by running it as its own process subscribed to the applicable mqtt topics.
  • Writing a process for the emonhub style dispatcher for sending data to other services such as a remote emoncms or another service entirely such as PVOutput or ThingSpeak
  • Creating raspberrypi module style emoncms gui for the new python based listener setting the rfm12pi radio settings.
  • Managing all these processes, a process status interface in emoncms?
Richard Hatfield and I have also been doing work on setting up Emoncms + MQTT + scheduler for heating control, the raspberrypi software setup guide for the configuration so far is here:

There are also some new related MQTT mini examples in the emoncms/development repository:

I've created a forum thread for discussing emoncms + mqtt here:

New Application Guides

An ongoing project for some time now is the writing of new application guides that go through step by step system building for home energy monitoring, heatpump monitoring, solar pv and thermal performance monitoring, integrating some of the new features for counting watt-hours on the emontx and using some of the new emoncms features such as myelectric. There's a new github repository in which to develop these guides. The table of content so far is:

Help with testing and github pull requests with changes to these guides would be most appreciated and if youd like to submit a guide for an application or configuration that you dont think has been covered well that would also be welcome. Please get in touch on the forums if you've got any question's about development and how to get involved.

ZeroCarbonBritain: Report in short

I've just come across the 'report in short' flyer by zerocarbonbritian giving a very nice overview of their more in-depth report that I've mentioned before that outlines a very positive and thorough vision for a sustainable future. If you haven’t seen it already its worth checking out:

"We have the technology to power ourselves with 100% renewable energy, to feed ourselves sustainably and to leave a safe and habitable climate for our children and future generations" - ZeroCarbonBritain

Download the flyer here: ZCB_RTF - Report in Short - A4 printable.pdf

Download the full report here:

Id also very much recommend Alice of ZeroCarbonBritain's inspiring talk on their work:

Alice Hooker-Stroud, Centre for Alternative Technology, ‘Zero Carbon Britain (Energy)’ from tyndallcentre on Vimeo.

Elektrocamp, visiting Jerome in Bordeaux and OuiShare

Lars Zimmerman and Jenni Ottilie Keppler (Open It Agency), Tristan Copley Smith & Jonathan Minchin (Open Source Beehives), Nick Ierodiaconou (Open Desk), Justina Swat (Fab Jam), Tomas Diez (Fab Lab Barcelona) and Open Energy Monitor (myself) at OuiShare Paris.

Im now back home in Wales after spending two weeks in France and Belgium attending two interesting events and meeting up with Jerome Lafréchoux developer of the oem_gateway (now emonhub) in Bordeaux. It was a great two weeks, I met lots of very nice people and heard about all sorts of interesting projects.

The first event was Elektrocamp which is a European meetup that happens every 6 months for people taking an open source approach to Smart Metering, Smart Home, Smart Grid. Some of the projects at elektrocamp where:

Flukso – an innovative open source energy monitoring project using openwrt
OpenTRV – open trv heating controller
Perpetual project – better heating control methods and algorithms
MySmartGrid - open smart grid approaches based on flukso

I then went down to Bordeaux to meet Jerome Lafréchoux who developed the oem_gateway which is a central part of the OpenEnergyMonitor system, it was great to meet in person and discuss next steps for OpenEnergyMonitor and emonhub development as well as enjoying a beer and good food.

Then it was back up to Paris for OuiShare which is an amazing event bringing people together from quite a wide spectrum of projects in the sharing/collaborative economy. There was a good group of us open hardware people there, we had our own space called 'the factory' where as well as a lot of discussing we built things, I spent quite a bit of time over those days building open source furniture with Nick of OpenDesk and beehives with Tristan and Jonathan of open source beehives.

Lars Zimmerman of Openit made a good blog post with a list of many of the open hardware projects at OuiShare here
Here's a copy of the list and I've added a few more on the bottom:
Thanks a lot to Leo Benichou for organising the open hardware for energy transition session at ouishare and for putting me up for the days in paris.
As Lars said, Good days for Open Source Hardware!

emonTx V3 Antenna Testing

Today we did some quick testing regarding using different antennas with the emonTx V3. 

Four antenna options were tested (Farnell part numbers listed for SMA antennas) :

Note: the graph sub-title has a typo, it should read 'RFM69CW', 'CRW' module does not exist.. At least to my knowledge! 

It was found that the wire-whip antenna as shipped by default with the emonTx V3 performed best. 

However using an SMA could be preferable in some environments; it's more robust and can  be extended easier. 

Now we have a way to measure RSSI (received signel strength indicator) using  an rfm69cw module we plan  to  do some more antenna and range testing. I'm interested to test to see how many db we're loosing in the antenna pcb trace from the module to the RFu328 then the emonTx V3 pcb trace then finally into the 90 degree sma connector. In future version will probably but the rf module and MCU directly on the PCB keeping the antenna trace as short as possible and use an edge mounted sma connector (these are also cheaper and easier to solder in manufacture). 

For more info on the test see the emonTx V3 wiki page:  

Direct connection emonTx V3 > Raspberry Pi GPIO

Sometimes it's more convenient to connect the emonTx V3 directly to a Raspberry Pi base station rather than use RF. 
Both the Raspberry Pi and emonTx V3 run at 3.3V so the serial Rx and Tx serial lines can be directly connected. The raspberrypi's 5V supply can be used to power the emontx which is then stepped down to to 3.3V through the emonTx V3's voltage regulator. 5V is provided by the red wire. The ground connection is the black wire and the data going from the emontx to the raspberrypi is the green wire. I haven't connected a wire for serial data going the other way but this is a possible option if two-way serial is required.

emonTx V3 > Raspberry Pi Connection 

Here's a simple direct serial output sketch for the emontx v3 on GitHub here
On the raspberrypi if you just want to forward the emontx data to a remote emoncms this can be done with the oem_gateway developed by Jerome which is on the standard rock solid forwarder image
See our blog post about how to configure the oem_gateway for work over a serial link rather than RFM12B 

This info was taken from the emonTx wiki and written up after a forum thread

For the future we are working on developing an energy monitoring shield for the Pi to create an all-in-on Pi-energy-monitoring unit, see dev forum thread: