Category Archives: Home Automation

Home automation and short-range RF comms

Introducing the Tiny Home Area Network Stack

TinyHAN MQTTIn the past I have bemoaned the resource requirements and closed nature of “standard” RF protocols such as ZigBee and other 802.15.4 based specs.  In the meantime low-cost radio modules like the RFM12B, RFM22B and the newer RFM69 series (all from HopeRF) have started to become the radios of choice in open source Internet of Things projects.  The problem is that despite a tendency towards standards like MQTT and HTTP on the Internet side, there does not seem to have been any attempt to standardise on what goes over the air, leaving a situation where everyone uses the same radios but nothing can actually interoperate.

Tiny Home Area Network (TinyHAN) is an attempt to address this in the form of an Apache licensed, highly portable protocol suite for resource constrained embedded systems using cheap sub-GHz radio hardware.  The software is written in portable C and uses a layered approach to enable interoperability even between devices using different radios.  This initial release of the suite supports basic client/server topologies currently without security, but with authentication and encryption to be added in the near future.  Various examples are included, as well as a GnuRadio based sniffing tool that can be used with an RTL-SDR dongle.

Continue reading

Low Cost, High Accuracy Temperature Sensing with a Thermistor

For many microcontroller projects requiring accurate temperature sensing the sensor of choice is the Maxim DS18B20.  Although this has a specified absolute accuracy of +/- 0.5°C, it has several drawbacks, not least of which is its relatively high cost.  For my prototype sensors I incorporated a TI TMP112, which is an I2C device with a minimum operating voltage of 1.4 V, making it particularly attractive for battery powered applications.  My preferred option for cost-reduction, however, has always been to use a cheap thermistor with the microcontroller’s built-in analogue to digital converter (ADC).

This post discusses the evaluation of a thermistor-based technique for small embedded systems capable of achieving uncalibrated temperature accuracy to rival expensive digital sensors.  An experimental comparison of various sensors over temperature is then introduced.

Continue reading

Antenna Measurements – Part 1

PCB antenna with test port attached

I finally found the time to make some measurements on the printed antenna used on my sensor board, which I didn’t think was performing very well.  Turns out I was right.

For this first part of the test various antenna configurations were tested by mounting them on unpopulated sensor boards connected to an Anritsu Sitemaster RF fault analyser via some added SMA connectors.  This instrument is capable of making return loss measurements, which were taken over a range of 800 MHz to 1 GHz.

Return loss is a measure of the proportion of power reflected back into the transmitter (or back out of the antenna) due to a mismatch.  It is given in decibels as incident minus reflected dB, and is related to VSWR.  A high positive return loss value indicates a good match.

Measurements were made on the following antennas:

  • A reference dipole tuned for resonance while mounted on the instrument
  • The printed antenna cut to the recommended length for 868 MHz as given in the TI application note
  • Wire monopoles of length 85 mm, 86 mm and 87 mm

Continue reading

Implementing the ELV FHT Protocol with an RFM23

Over the last few weeks I have been helping out the guys over at OpenTRV with an implementation of the FHT protocol for use with HopeRF RFM22B and RFM23B modules.  My as-yet unreleased sensor modules (as seen in another post) make use of an RFM23B, and I have an interest in evaluating the Conrad/ELV FHT8V valve head as part of my own central heating upgrades, so this was a job that I needed to do anyway.

The FHT protocol is similar to FS20, but the receivers are battery powered and so use a timeslot technique to avoid the need for a permanently powered receiver.  This necessitates a synchronisation procedure between the controller and its valve.  Once completed, the controller will send a packet approximately every two minutes, keeping the valve in sync.  This means that it can take up to two minutes for a change to take effect, but it does mean that the receiver remains un-powered for most of the time.

This example implements the protocol using the module’s FIFO mode, requiring minimal intervention from the host MCU.  Source is available for ATMEGA328, so it should work on an Arduino, although I have not tested it yet.

Continue reading

A Simple RF Protocol (or, what is the point of ZigBee?)

I’m going to start by admitting that this isn’t going to be a tirade of abuse against the oddly named 802.15.4-based wireless tech, but rather a request for comments on an open, lightweight alternative, particularly for low-cost sub-GHz applications.  I know what the point of ZigBee is, and the ability to form into self-organising mesh networks is an obvious advantage for large scale industrial automation, but for domestic applications it feels like overkill.

The industry is apparently thinking along the same lines, because the vast majority of DIY Home Automation (HA) stuff on the market in the UK at least is using proprietary sub-GHz like LightwaveRF.  The driver here is probably cost, but it is my view that the lack of interoperability that this leads to is holding back the mass-market acceptance of HA, and is unnecessary.

What I am looking for is a simple, open (as in freely available, properly documented, royalty free) standard for sub-GHz RF that could be implemented on the cheapest of radios in minimal code space.  I am aware of MQTT-S, although even that looks too complicated for simple sensor/actuator applications, and it doesn’t define the lower layers, instead running on top of something like ZigBee or 6LoWPAN.

Continue reading

Wireless Sensor Boards Arrived

Sensor PCBsAs part of my project to bring our central heating into the 21st century I have been working on a custom wireless sensor platform.  My key aim here is to develop a low-cost, open solution with security designed in from the start; something that a lot of sub-GHz protocols seem to totally omit.  I’m avoiding ZigBee because, as much as I want to like it, I keep coming back to the issue that its complexity just pushes up the system cost.  In a domestic environment a simple sub-GHz solution can easily cover a typical property without resorting to meshing.

The design I have gone for combines temperature and light sensing with a pulse input for connection to the gas and electricity meters.  The microcontroller is an ATMEGA328 and the radio is a Hope RF RFM23B, which is based on a SiLabs Si4431.  This is a synthesised transceiver so the potential for congestion can be avoided through the use of listen-before-talk and frequency hopping, the latter also offering a way around the duty cycle restrictions in the 868 MHz band.

The printed antenna needs to be tuned by trimming it to length, which will no doubt be the subject of a future post.  Once the optimal dimensions have been determined this can be applied to any future spin of the boards in advance.  No prizes for spotting the deliberate mistake with the microstrip track passing under the RF module – I am hopeful it won’t have too great an effect!

The boards in the photograph just came back from iTeadStudio in about a fortnight.  The quality is absolutely excellent considering the <£10 price tag for the 10 circuits.  I have loaded a couple and firmware development is in progress.