Open Energy Management System

Hi everyone,
I’m a student at Aberystwyth University, Wales, UK and I’m currently working for my year in industry at the Centre of Alternative Technology in Machynlleth. My project here is to make a Open Energy Management system firstly for the site here which currently has 3 different non-inter operable OEM’s (Open Energy Management systems) and around 20 different buildings. The OEM I am developing will working alongside the room booking system we have here to heat the rooms which are booked. Currently an engineer has to go around and turn on the heating. The OEM will also monitor who is using the most electricity and heat around the site and eventually be able to take meter readings and measure the level of the reservoir we have here on site that gives us both drinking water and electricity (through hydro). I intended to do all of this with Spark core’s linked via TCP over a WiFi network we have on site and a Rpi which is located in the engineering office running a open energy monitoring hub modified to be able to both monitor the heat and send out instructions from the booking system.

Basic needs:

  • Spark core’s talking to a Rpi over TCP and visa-versa
  • Spark core’s working as thermistors (Working)
  • A modified open energy monitoring Hub

So far I’ve faced some problems with TCP and so opted to try and use UDP and ran into the same problems which through help from the community I think I’ve narrowed down to the fact the site is in the middle of nowhere so has to have satellite link broadband. (Averaging 0.8 mb/s DL 0.15 mb/s UL)

I eventually hope to roll this out for use in people’s houses etc as a fully open source project and I hope there will be contributors other than me in the future because energy management has a large number of spin off’s (such as the lake level sensor mentioned above). I’m also working with three Aberyswyth Computer-Science dissertation students who are going to help with the security of the network, the visualization of the monitored systems (For educational purposes) and the lake level sensor.

Thanks to those who have helped me out so far (@bko especially) the community has been really great so far. I have embarrassingly little code to post so far but please see my previous posts if you wish to help with my current problems.

Previous posts:

TCP

UDP

Any critism, guidance and general help would be much appreciated.

Thanks for your continued support.

Update
If anyone wants to help out the two active threads I’m using are:

Hardware Issue

Packet Sender / Receiver

5 Likes

Interesting project. Just curious, you mention that you’ve had issues due to connectivity with the internet. Have you considered, since you already have a raspberry pi onsite, hosting your own local cloud on the pi and then writing a script (NodeJS?) on the Pi to connect the local cloud to the Open Energy Monitoring Hub? That way your SparkCore code becomes very very simple: you can use Spark.variable, Spark.publish, etc to push your readings to the local cloud and then the local cloud, or another app running on the Pi, can push those readings to the hub software.

Hi @harrisonhjones, thanks for the response.
I have considered using a local cloud on the pi previously but I have so far choosen not to follow up with it because I’m trying to eventually swap out the sparks libraries with normal Wire code so that this system could be used with other wifi modules (Although I don’t know why anyone would use anything other than a spark/photon).

What does Spark.publish do in more complex terms than the docs describe then? How does the spark communicate with the local cloud in other words?

Thanks again for the response

My main reason for using spark publish is that A, it’s already there, B, it works well, and C, it really easy to use. In my opinion it comes down to where you want to invest you time: do you want to spend a lot of time working on the connection between the Core/sensor and the hub or do you want to spend a lot of your time working on sensing. I imagine you are much more interested in getting the energy data than transporting the energy data. By using Spark.publish over rolling your own transport method you will end up freeing up your time to work on the stuff you care about: sensing the energy consumption

Spark.publish puts the string you publish into a queue and when next the core connects to the cloud it pushes that info to the cloud. The cloud then pushes that info as an event on the listener endpoint.

Not sure if anyone has mentioned this yet, but there was a really great post and a port previously in this thread:

Thanks,
David

2 Likes

I see your point but I already have the sensing working, that’s never been the problem and while it needs to be accurate, it doesn’t need to be incredibly accurate.

I don’t want to the system to be tied spark. Personally I think they are by far the best thing for the the job but if someone has to buy a particular piece of hardware to implement my system then in my opinion that’s not truely open source. I intended to make this system fully transferable to other devices and if that means spending a longer amount of time working on the communication then I think that’s what needs to be done.

Thanks for your response

1 Like

I have breifly skimmed over this previously and it should be very useful. Also I’ve noticed similarities between my project and @phec’s beehive project.

Thanks for your help

1 Like

Update
Hi again guys,
Progress so far is I have a packet sending and receiving core to core via TCP. Hopefully I will have implemented my packet standard by the middle of next week and will then be starting work on the server side php code. It’s my first time writing php so if anyone’s got any experience and doesn’t mind lending a hand it would be much appreciated!
Thanks alot for all your help and support.

Update
Managed to post to the raspberry Pi running emoncms correctly over TCP using the HTTP library for spark. Most of the handling will now be done at the Pi end. The next step is for the spark to automatically register to the Pi.

Hopefully I’ll have a working prototype for you guys to try out soon!

@OddieCAT It sounds as though you are making good progress - I’ll follow how things are going with interest. If you are handling a lot of data transactions on the Pi make sure that you are using an external hard drive and not the SD card or everything may die after a few months. (OK I’m probably teaching Grandma to suck eggs in which case sorry Grandma.)