Tuesday, 21 January 2014

Central heating control using SMS and the Arduino

One of the things I set out to do after discovering the world of Arduino was to make myself a clever controller for my central heating but, not unusually for me, my focus wandered here and there finding new and probably easier things do do with all these little gadjets.

I got back into air rifles which meant most of the blog, over the last few months, has been full of my various versions of a chronograph! I've tried loads of different displays and even Bluetooth to get the speed of the pellet to my phone.

Anyway, the weather turned cold again and thoughts drifted toward the central heating again but this time something a bit simpler, something to switch the heating or water on for a period of time without leaving the comfort of my arm chair.... yes I'm that lazy.

I'd dabbled with the 868MHz RF links, Bluetooth links but after coming across a post on nathan.chantrell.net I found a source for a cheap GSM modem.

My original thoughts were to bow to the latest fashion of "IoT" but my dealings so far with the Arduino and Ethernet interfaces had been less than perfect, quite randomly the data flow would just stop and I never got to the bottom of it.  The SMS solution appealed because I don't need a data connection or even a smartphone and can switch the heating on before I get home even if the raspberry pi and the arduino etc. are switched off when I'm on holiday.  The SMS route seemed like a good solid proven technology.

The Modem was an ex-equipment modem from some old BT security line monitoring equipment (search "redcare GSM" on Ebay) and I picked up mine for £4 including delivery, not too expensive, the SIM card was an old Giffgaff card from a previous phone which still had few quid in credit and my contract phone had unlimited texts ... so I thought I would give it a go.

The overall system laid out on the desk
The modem came with an external antenna and the 2x50 header still attached to the PCB which was quite lucky because the connector is a 1.27mm pitch IDC on a ribbon cable, to get connections to the modem I used a hot air gun to sweat off the SMD connector from the PCB.

I made the connections to a standard pitch connector so I could interface to the rest of the system, the pins are very small and it wasn't easy.

The idea was to connect the the relays in parallel to the existing relays in the controller so that the current timer based operations would continue but I could switch on the heating or water remotely.  The relays would be switched by the Arduino Mini Pro via a soft serial connection from the modem, there was also an I2C OLED status display and a remote temperature sensor for the hot water tank.  Initially the temp sensor would just monitor the water temp and be sent to the phone on request but I intend to use it later to give a finer control to the water temp (I might log temp to and SD card for a while to get an idea of usage).

The SMS control takes the form of a simple short message coded for heat or water and a duration, heat on for an hour would be H60 whereas heat for 2 hours would be H120 ... I said it was simple. Hot water just uses a "W" instead of a "H".  There is also the function to request the temperature of the water, this causes the Arduino to send an SMS containing the temperature of the water.


The control is done by an App on my Android phone but could be done just as easily by sending a text normally or there are some automation apps that would allow a pre-defined text message to be sent from an icon on your home screen.  Actually I suppose you could control your central heating system from within an app such as Tasker, Tasker would allow you to setup timed text messages to carry out the operation, this would only make sense if you get free text messages though.

The Arduino code checks the incoming phone number to make sure it matches the one(s) you allow to control the heating and the response to the hot water temp request is sent back to the requestor's phone.

I'm also thinking of connecting in to my alarm system to send out an SMS when it gets triggered.
That's all for now, I'll post a link to the Arduino code and the Android app in the next post.

There's plenty of technical information on the modem and links to a SMS messaging library on nathan's blog post here.

Please feel free to ask any questions or make suggestions in the comments below.

3 comments:

Nathan Chantrell said...

Nicely done.

Spencer Owen said...

That looks great! Almost like what I want to do, but have been too lazy to finish. I would use a Google Calendar for the Arduino to check, and I could have pre-defined schedule I could modify from smartphone as required. But big Congrats on finishing something - more than I've done :-)

Gadjet said...

Thanks guys.
Finished? not sure, the biggest hurdle is yet to come, putting in a box!