Pages

Wednesday, 27 November 2013

Adding control to emoncms: RFM12b Packet Generator

I've had many conversations with people recently about controlling things like radiator set points, boiler thermostat's, heatpump's and so on.

I visited John cantor of http://heatpumps.co.uk/ today who is implementing an impressive control and monitoring system for a heatpump central heating system which involves EmonGLCD's with relay's connected to radiator valve actuators in each room. The buttons on the EmonGLCD are used to set the target temperature for the room and information is displayed on the EmonGLCD about heatpump power input and outside temperature.


On the way back I stopped at the Centre for Alternative Technology where Marnoch who is on their student placement there is working on doing something similar but for a radiator system connected to a wood chip boiler.

Both Glyn and Ynyr are keen to get boiler thermostat controllers working in their houses and Ken Boak who designed the NanodeRF phoned up the other day suggesting we start an openenergymonitor sub project and discussion on this topic, Ken's been working on central heating control for quite some time.

Its something I have a growing interest in too as we will be soon installing a heatpump system at home which has a lot of opportunity for control and monitoring to make sure its running efficiently.

So I've been giving some thought to how control features could be added to emoncms in a more integrated way than initial efforts I've made before.

I like the simplicity of the way Jean Claude Wippler designed the jeelib library to use c structures as the method in which data is packaged and sent via the RFM12b radio's and so I thought that maybe a good basis for adding control functionality to emoncms would be to first make it possible for emoncms to easily generate RFM12b data packets in the format that can be easily decoded with a struct definition on the listening control nodes. Emoncms would then broadcast this control packet containing all the state information about the system at a regular interval in the same way as an emontx broadcasts it's readings. Listening nodes can then be programmed to selectively use variables in that control packet depending on what they need to do.

I've put together an initial working concept of a module that can be used to do this and its up on github here: https://github.com/emoncms/packetgen

Here's a screenshot of the main interface:


One of the nice things about it is that as you generate your control packet the module generates example Arduino code to make it easier to start coding a control node, you can just copy the code any drop it into the Arduino IDE and upload to a atmega+rfm12b based node and it should start receiving the control packet right away.

I see this module and control in general being run on a local installation of emoncms running on a raspberrypi + harddrive combination rather than emoncms.org. The next step is an image with all this installed and working out of the box.


12 comments:

  1. One question.

    Why you are working with a HDD disk? Could I use a Usb flash?

    ReplyDelete
  2. Using a harddisk because of SD Card write issues, using up the max number of writes to the SD card. I think a flash disk has the same problem.

    ReplyDelete
    Replies
    1. Seriously?

      SD/SSD - Flash memory is cheap and even budget cards (not noname) will last months writing 24/7 at full speed. We are talking terabytes of data.
      HDDs on the other hand aren't generally designed for 24/7 operation and get heat damage. This includes laptops and home PCs. HDDs take space, are noisy and use way more electricity too.

      And there is backup: PC, NAS, cloud!

      Cheers!

      Delete
    2. This is not what we have experience. We have found that sd cards used for 24/7 logging seem to after three months. We are not the only ones to experience this, just search the forums or Google RaspberryPI sd card failure. Sure, could be an option but they are expensive. Hard drives are capable of running 24/7. I believe most if the Internet is running off 24/7 hdd 's. Using old low capacity laptop hard drives with the Pi is a good way to make use of otherwise obsolete hardware

      Delete
    3. I agree with Glyn,
      Running a Datacentre with hundred of mechanical HDs they last years if they don't fail in the first month usually. SD cards are not as reliable. SSD drives all suffer from write issues after a while and the more expensive you buy the longer they last. The cheap OCZ SSD drives are terribly unreliable and they are still £60 for 250gb compared to a lappy drive of 250gb that is around £25.

      Delete
  3. How do you see emoncms influencing the values of the packet data?
    Do you see the event module being utilized, for example;
    IF (lounge_temp) > 20 set feed (rad_valve) = 0
    To send a zero to the radiator valve, switching the rad off?

    Paul

    ReplyDelete
  4. This is very exciting, now emonCMS can become a home control system!! :-)

    ReplyDelete
  5. and what about emonglcd sketch? I can't find on github

    ReplyDelete
  6. Paul: yes something like that and also sliders, buttons and other input interfaces writing to the packet variables too.

    Denis, Im sure John cantor will publish the sketch soon, he is certainly planning to do this.

    ReplyDelete
  7. I love this idea and it is a logical extension. What I feel is needed is a relay board with a RF module integrated or driven by the EmonTX IO. It could be modular so you can add more relays as required? If there was some way to identify the RF node by dip switches then would there would be no need for any board programming. Simply check state data and switch relay appropriately. (oh if it was that simple :)). My electronics knowledge is a bit thin but it looks eminently possible.

    ReplyDelete
  8. Large number of candidates take these exams, competing for limited posts.Both Objective & Conventional Sections will cover the entire syllabus of the relevant engineering disciplines viz. Civil Engineering, Mechanical Engineering, Electrical Engineering and Electronics & Telecommunication Engineering.
    Minimum qualifying marks has to be obtained in Objective type papers for checking conventional papers.
    IES cutoff marks are available at website. You may contact student counselor in case you need any such data related to ES examination, IES cutoff, IES Question papers, IES solution, IES interview question.IES 2013 examination pattern are same as IES 2012, Examination difficulty level, cutoff and paper pattern are almost same.
    Gate Coaching
    IES coaching


    ReplyDelete

Note: only a member of this blog may post a comment.