New Project : messaging strategies ?

98 views
Skip to first unread message

Jon Bartlett

unread,
Nov 25, 2012, 6:32:25 AM11/25/12
to nanode...@googlegroups.com

All,

 

Im on to my next Nanode project - a central heating controller (ie replacing the programmer to hot water and room heating).

My plan is to use the Nanode measure the temperatures (ambient and water) and use mains relays to perform the duties of controlling the boiler and valves at the relevant times.  Ultimately, Id like to build into the Nanode code some 'intelligence' ie be able to use historic temperature delta rates to determine when to turn and off the relevant parts to achieve desired states at target times...

 

I plan to use a remote and separate management system to send reprogramming commands and have the management/interface control and monitor it.  Both management system and nanode will be on an Ethernet network, communicating via a series of messages to set the parameters, or immediate demand etc.

 

Obviously, I want to be mindful of codesize (in the Nanode),

So my questions for the group are :

- Anyone aware of a project similar ? (I couldnt find one with a quick search).

- Whats the lightest weight messaging system over Ethernet anyone has used ?

- Are there benefits in using MQTT or other (e.g. I remember a 'Home Hub' messaging system proposed too) ?

- Should I simply write a simple message handling myself ? if so, anyone got some examples I can look at ?

- Given the management system will be web based, does it make more sense to put a simple webserver in the Nanode to handle the messaging/control ?

 

Any other thoughts ?

Jon.

cyan

unread,
Nov 25, 2012, 11:41:23 AM11/25/12
to nanode...@googlegroups.com
Hi John,
 
I use this Library to assemble and disassemble packets - works pretty well for me: https://github.com/madsci1016/Arduino-EasyTransfer
 
Also, do you know about this project: http://tclcode.com/opentherm/ ?
 
Have fun :-)

Glyn Hudson

unread,
Nov 25, 2012, 12:20:22 PM11/25/12
to nanode...@googlegroups.com
LLAP is another protocol, not used it myself but it's being used extensively by Ciseco http://openmicros.org/index.php/articles/85-llap-lightweight-local-automation-protocol 
--
Glyn Hudson 

Work: 01766771100

Ben Laurie

unread,
Nov 25, 2012, 12:46:21 PM11/25/12
to nanode...@googlegroups.com
On Sun, Nov 25, 2012 at 11:32 AM, Jon Bartlett <J...@thebartletts.org> wrote:
> All,
>
>
>
> Im on to my next Nanode project - a central heating controller (ie replacing
> the programmer to hot water and room heating).
>
> My plan is to use the Nanode measure the temperatures (ambient and water)
> and use mains relays to perform the duties of controlling the boiler and
> valves at the relevant times. Ultimately, Id like to build into the Nanode
> code some 'intelligence' ie be able to use historic temperature delta rates
> to determine when to turn and off the relevant parts to achieve desired
> states at target times...

PID is really what you want for that -
http://en.wikipedia.org/wiki/PID_controller.

> I plan to use a remote and separate management system to send reprogramming
> commands and have the management/interface control and monitor it. Both
> management system and nanode will be on an Ethernet network, communicating
> via a series of messages to set the parameters, or immediate demand etc.
>
>
>
> Obviously, I want to be mindful of codesize (in the Nanode),
>
> So my questions for the group are :
>
> - Anyone aware of a project similar ? (I couldnt find one with a quick
> search).

I've been working towards something similar, not using the horrible
arduino libraries: https://github.com/benlaurie/arduino--.

> - Whats the lightest weight messaging system over Ethernet anyone has used ?

Why not use the RF12B? That's what my stuff does.

Tho the network protocols I used could also be used over Ethernet.

> - Are there benefits in using MQTT or other (e.g. I remember a 'Home Hub'
> messaging system proposed too) ?
>
> - Should I simply write a simple message handling myself ? if so, anyone got
> some examples I can look at ?
>
> - Given the management system will be web based, does it make more sense to
> put a simple webserver in the Nanode to handle the messaging/control ?

My plan is this:

Winodes measure temperature and control relays.

Winodes talk to Nanodes, which gateway RF12B to Ethernet.

Real computers talk to Nanodes and do all the heavy lifting.

Probably I'd put the PID stuff into the Nanode, tho. Of course, also,
anything a Winode can do a Nanode can do, too.

Very happy to help with getting this closer to reality if you're
interested - note that s/w is my strong point and h/w is very much my
weak point (that is, I can take a chip manual and write code for it,
and solder a chip into a board, but that's about as far as I go
competently).

Where I'm at so far: winodes measure temperature, talk a lightweight
protocol over RF12B to nanodes which gateway to Unix boxes over
ethernet.

Ken Boak

unread,
Nov 25, 2012, 1:57:36 PM11/25/12
to nanode...@googlegroups.com
Hi Jon

I have put together a crude central heating control which is Arduino/Nanode based and I call it Navitrino.

I have thermistor temperature sensors in the 2 most frequently used rooms, also an outside sensor and two that clip onto the pipes on the hot water tank - so that I can gauge the amount of hot water.

You could use DS18B20 type temperature sensors - but I like to fit thermistors to the analogue inputs and linearise their response with some simple code.

My boiler originally used a Drayton Digistat wireless room thermostat, which is now redundant - but I use the receiver part with the relays to turn the boiler on and off under wireless control from the Nanode. I managed to crack the Drayton wireless protocol - which was very trivial - just two types of packet, one signifying boiler on, the other boiler off.

The Nanode measures the various temperatures and makes a decision whether to turn the boier on or off depending on room temperature, time of day, or lifestyle preferences - eg weekends = more occupancy than workdays and workdays need an earlier start time.

I'm not sure whether you could save much by PID control.  The easiest way to save gas is to turn the mean room temperature down, and not to overheat the hot water cylinder.  

Navitrino outputs a serial CSV log of the various temperatures, and whether the boiler is currently on or off.   I intend to get it to log to SD card too before the end of this heating season.

I also send my temperature readings up to openenergymonitor.org  and their emonCMS server.  There is also the option to turn the boiler on or off remotely from the emonCMS server  - but whilst this has been proven in principle, it's not yet fully implemented or tested.

I'm happy to share the Navitrino code and techniques amongst interested parties, but cannot take any responsibility for the safe operation of your boiler when commanded by my code ;-)  Navitrino has been running wells for the last 3 winters.

I'd like to do an open-source wireless relay board that plugs into a standard central heating controller backplate, but again could not offer CE certification or be responsible for how it is used. If enough people were interested in an open-source heating controller, I would consider starting a user group, so that we can all benefit.

My blog contains posts describing Navitrino - from around 2010  - 


and here's a typical entry discussing temperature monitoring



One thought is that you could use a WNode or a JeeNode as a smart wireless temperature sensor in each room you wish to control, and then have an ethernet connected Nanode for your web logging and remote access.

I fitted my radiators with thermostatic radiator valves, and it is quite easy to trick a valve into shutting off a radiator by using a power resistor (or transistor) to heat up it's wax capsule control valve.  The WiNode with 2A PWM motor controller would be a good candidate to do this.


Lots of ways to skin cats - 



Ken




lightbulb

unread,
Nov 25, 2012, 3:58:42 PM11/25/12
to nanode...@googlegroups.com
Jon,

Sorry if this is a bit long winded:

I have a setup that shares common aspects of a number of replies so far, so there is definately some common ground for system/module commonality/re-use.

- Jeenodes throughout the house with a nanodeRF acting as a pesudo hub/gateway; they feed PIR/light/temp/humid from 6'key'  rooms to the NRF via 868 RFM12B.
- 3 DS18B20 sensors attached to NRF (under insulation via thermal grease and tie-wraps) to top/bott hw tank and to hot tap output with relevant calculated offsets.
- 4 relays controlled by 1 jeenode that take commands from NRF for boiler use, they are setup as either NC and NO states (depending on function), so everything runs like a traditional CH/HW if not 'under control, or the jeenode disconnected, I use a simple butchered 9v walwart with voltage divider on analog to detect boiler state (my boiler is not OT compatible).
- I have some conrad and itemp radiator valves, a seperate 'atmel' board drives the conrads, and I am having limited success hacking the itemps.
- (I am now just in process of building a jeenode with IR/RF and LCD (with buttons) for manual override - some 2 weeks away from completion i figure) - currently i use CLI for manual override.
- I have PV but its newly installed and not integrated yet.

All these 'simple' nodes/sensors and the NRF in turn feed into a RPi, which has the houses 'lifestyle' plan (as i call it).
The RPi makes all the descisions based upon sensor input and various other inputs (for instance the itemp's valve plan) and calls for heat only when either a rooms rad calls for heat and/or a sensor detects its needed (and a room is determined to be an 'occupancy' room for that duration. I have 2 zones now, since it is not 'as effective' with 1 CH zone.

My HW is now under very accurate control and has 'learned' the average week's usage profile, so we get very little waste, we occasionally pay for this accurate use with a cold shower when things get out-of-band - i am looking at a better manual override or 'panic' button, currently we sometime have to begrudgingly fall back on immersion for fast 'correction' (this will change somewhat with PV integration).

(I originally started with a NRF controller but the code grew to 'heavy' and was difficult to drive 'dynamically' with the limited RAM, eth and rfm12b).
I use a std wheezy build on Pi with a few additional components/software and a python controller suite (series of interacting daemonized modules), the most important supporting sub-systems of which is 'redis' and 'xap'
(there are also other devices driven by IR/RF etc, but not CH/HW related).
The eth connected  'duino's' can use pub/sub to push data into redis which is a simple delight to use, everything else is driven/routed from there.

Its obviously a little more complicated, but it is working out to be very much a modular system, and parts can be 'taken out' and the entire system can be 'healed' to work on a reduced intelligence level.
(this is a SWMBO cop out from full silicon brains)

My room thermostat (simple RF CM927) is 'redundant' and is almost always overridden by the micro (via the JN NC relay), it is now only really there for bypass/failure, as is my seperate HW timer, although both are still 'in-circuit'

My Gas usage has reduced by cummulative 36% over 9 months on previous years (more importantly we have not made too many sacrifices that make us uncomfortable), I have just installed a log burner so envisage a further reduction in Gas (but the log burner cost ;{ ). I expect payback of everything so far (except log burner) in next 2 months, the excess going into reducing my log burner defecit over time (so long as I still get low cost hardwood).

Anyhow, I think that 2012/13 is the year for hobbyist microcontrollers to take on challenges like this, I am happy to start to pass on my design notes and code in the next few weeks for others to get ideas from, mostly the bits that led to dead-ends etc, as thats where my time was wasted.

If only i can have the same success with electricity: (this is my next project using the same sensors (PIR/light) -  lets see after I gets some data and costs!!.

Summary of my current system:
I needed jeenodes, eth connected 'duino's AND an RPi to keep it modular and simple, total cost for avr's about £160.00 (although I had 2 originally for hobby use)
I found I absolutely MUST have localized intelligent room storage heating (capable/semi programmable rad valves) to reach full potential of the capable micro's/sensors: £140+
(I could have gone the whole hog with a full blown demand driven multi-zoned system, but they were still more costly that my current system (and would have not helped on the ELEC front)

 'redis', 'python' and 'xap' seem to be all the software I have needed for 'brain' and semi-simplistic avr sketches via RPi (£35.00).
I found flexible rfm12b sketches to be the most difficult part, hence the intro of the PI, but there are some really smart peeps out there that could probably squeeze all the brains into an atmel or two, and I have even come across products recently that can reprogram avr's via radio (but they cost!!) (that could save £35.00). I am also pretty sure if I had invested in providing my avr's with a 'filesystem' I could of built more capability into them without running to the PI (but the PI came along at just the right time for me and I could not resist).
I have/will have saved the cost of my sensors/controller etc within 11 months I am sure (2 months from now).
My previous rad valves had paid for themselves over 14months (before i started messing with avr's) - but caused my family some 'pain' - alleviated now.

Hope the above helps whet some appetite.

Kind Regards
Andy

Jon Bartlett

unread,
Dec 1, 2012, 10:17:06 AM12/1/12
to nanode...@googlegroups.com

 

All,

 

Many thanks for your thoughtful and considered responses to my questions.  It sounds like Im following similar paths to a few of you.

A little more detail may help...

I have a couple of Raspberry Pi's  already on my Ethernet network - including one running the fantastic Wview which monitors the weather outside and reads one internal room temp.

My plan was to use this as a central hub for the simple CH/HW control - and have it perform the 'override' or intelligence beyond the standard timing and PID control, which Id hoped to build into the Nanode at the Bioler/heating.  The balance of what is performed by which component will probably lie in the code size of the Nanode.

 

As mentioned before the Nanode will control the relays and measure (via DS18B20's) room and water temps - and as I already have Powerline Ethernet networking, so I was going to invest £25 or so in an additional mains ethernet device, to  provide power and Ethernet to the remote Nanode without requiring wireless protocols etc etc.  Im hoping I can cannibalise the powerline device to provide the 5v for the Nanode too...   As a side note - this would be like a Sheevaplug - but with Ethernet over mains... anyone working on such a device that would be in the £50 or so range ?!

 

I think I'll start by getting the Nanode to emulate a simple programmer first - using the simple HTML webserver arduino example code to take and receive commands.  But Im expecting to have to rip this out to a lighter weight push/pull messaging system.

 

I'll let you know how I get on. 

Once again, many thanks group - you're very helpful!

Jon



On Sunday, November 25, 2012 11:32:37 AM UTC, Jon Bartlett wrote:

Reply all
Reply to author
Forward
0 new messages