Introductory Course on MBED

Went on this course earlier in the week, kindly sponsored by RS and organised by the ESP KTN. The concept was impressive and it all worked well (apart from a rather major oversight concerning internet access which, for this course, is essential).

My own interest is around the thought of where do we go when Arduino runs out of steam? It’s excellent for educational purposes but has a few limitations when you want to field-test prototypes. MBED looks like it could be the answer. This course looked like a way to get things moving.

The kits handed out include the MED dev module and a great little breadboarding kit from Cool Components.

The MBED IDE is online which has advantages. This is acknowledged not to suit people who want to configure their own tool-chains. Hoever, it’s just fine for the likes of me who just want to get on and build some protoypes.

Simon Ford of ARM presented the main part of the course (at RS premises). He certainly knows his stuff and kept us moving at a good pace. The course materials are online and contain loads of worked examples – important for a fast start.

Strongly recommended for anyone about to do their first MBED project. No need for in depth knowledge but C++ experience useful.

Since then have been looking at more robust prototyping options. Seem to be plenty available, eg from Cool Components.

A Low-Cost Smart Heating Control

Now that I have a low-cost, low-power web server (made from a Current Cost bridge board) I wanted to make a better programmable thermostat. The standard product you can get from any good plumbing supplier incorporates timers and a thermostat and links wirelessly to a boiler relay. These cost between £50 and £120 and do the job – sort of. However, like conventional video recorders, they are hellish to program. As a result, they are often not set correctly so your home is over or under-heated.

The objective of this project was to create a plug-compatible alternative that would be easy to program as well as more flexible. The end goal was to use less energy without loss of comfort. We’ll achieve this in two steps: firstly to make programming easy and then to automate it as far as possible. This post is about ease of programming. I wanted to use a web browser of this as these are ubiquitous in many homes now, certainly ours. The initial control panel looks like this:

It’s laid out in this way to make it compatible with any browser, from smartphones to desktops. The version shown is for central heating only. We have four presets for weekdays and another four for weekends. I plan to add a set for hot water when I get another relay for that. This version also has Advance and +1 hour buttons just like the timer it’s replacing in our home. Changing the code is as easy as editing the Arduino sketch and reloading it. It would be even easier if we had an Ethernet bootloader (instead of USB). Anyone done that?

Not-so-obvious features of the software include the approach to power-up where the unit functions as a network client to pull settings from a cloud-based server. When testing this my initial code ran out of RAM and behaved badly. The solution was a slight redesign which includes a test to raise an alarm if available RAM runs too low. Pretty obvious for embedded software but something you can easily forget if you are used to the resources of a conventional web server.

This version is under test at the moment and I’ll open source the software when I’m happy with it. There are a few assumptions behind the code so testing is absolutely necessary. I need to be sure that this will run indefinitely and will recover properly from mains outages etc. Batttery operation would be nice but this Arduino configuration is not well suited to that.

In a future version I’ll also be adding compensation for outside temperature so that the system can adjust itself to weather fluctuations.

If I can find a way to fund it I get a specific PCB developed so others can do this more easily, unless of course the London Hackspace team gets there first.