VGA and audio for Pi Zero

2016-03-26 11.56.06

I backed the Analog Expander Cap – for Raspberry Pi Zero Kickstarter campaign.

It was a lot of soldering, but it works and makes a very small PC that works with a VGA monitor.

I have only tried the VGA ad audio, not the composite output.


Posted in Electronics, Raspberry PI | Leave a comment


2015-12-06 09.57.38

I seem to be one of the first to get the Flotilla mini-kit from Kickstarter.

It consists of a hub that is connected to the Raspberry Pi, and then a set of modules can be connected to the hub via micro USB cables. The mini-kit comes with a 4-button touch sensor and a rainbow LED stick.

There is an application called Rockpool that lets you define connections between the inputs and outputs:


Rockpool is a Javascript web application that talks to a flotilla daemon on the Raspberry Pi via Websockets.

It is easy connect to the same websocket using node-RED,  which allows me to link Flotilla to my home automation system.

Here is it telling me when a touch button is pressed:


You send the Websocket a “ready” message and it starts sending back messages about the state of the modules. I am intercepting an update message for the”Touch” device, checking which button is pressed and then using my house control system to speak a message. I could just as easily use the buttons to switch devices in the house on or off.

Flotilla looks very promising; I will try it on my grandchildren to see how easy they find it to “program”.

There is also a python API, but this is being actively worked on, and may change.

There is an even easier interface coming called “Cookbook” with pre-defined “recipes” that should make it even easier for kids to start using it.




Posted in Electronics, Home automation | Tagged , | Leave a comment

MQTT Topic Hierarchy


Here is my current MQTT topic hierarchy in a real-time updating web page, produced by Ben Hardill‘s MQTT Topic Hierarchy browser.

I need to sort a lot of things out. The data is sometimes correctly scaled, and sometimes not. The precision is variable.

I need to publish the status of my IAM devices as well as their power usage.

I need to publish the data from my two Wemo devices.

I could publish the status of my LWRF devices, but I do not know that accurately.

Some data like the emonPi power data is probably not sensibly associated with a specific room.

I also need to rationalise battery level data and add last updated fields to all the data.

I think I will also publish fitbit data to /people/lawrie.

The weather data is not really weather data as it comes from an indoor ESP8266 BMP180 sensor. I neee to put it in the right place in the hierarchy.

I need to add my letterbox sensor status.

Posted in Home automation | Tagged | Leave a comment

MQTT and Websockets


I have been experimenting with a new web site to control my house as the current one, written in PHP, is very slow as it gets data using TCP connections to HouseControl.

I wanted to get as much of the data from MQTT as possible. I experimented with a node.js web site, which read the MQTT data in the server and sent it to the browser in a refreshing page. This worked but the data was slightly out of date, and the page refresh flash was annoying.

So I need a Javascript-based web site to avoid these problems. The easiest way to do this was to use a version of the Mosquitto MQTT server, that supported Websockets. The 1.4 version supports it, but only if you build it with Websocket support. So I followed Martin Harizanov’s guide, and installed it on a Raspberry Pi 2. I had slight problem with this, as the service script gave a syntax error, and as I had lost the indentation, it was hard to diagnose, so I copied the one from my emonPi. Also, as the script puts things in /usr/local, not /usr, I had to run “ldconfig”, to update symbolic links.

The web app works well and data is updated in real time.

I configure the page with a json file, rooms.json on the server:

"emonhub/rx/5/values":{"Total": null},
"/house/rooms/first-floor/kitchen/dishwasher/power":{"Dish washer":null},
"Utility room":{
"/weather/temperature":{"Temperature":null, "scale": 0.1},
"/weather/pressure":{"Pressure":null, "scale": 0.01}
"/house/rooms/first-floor/kitchen/light-level":{"Light Level":null},
"Living Room":{
"/house/rooms/first-floor/living-room/front/temperature":{"Front temperature":null},
"/house/rooms/first-floor/living-room/back/temperature":{"Back temperature":null},
"/house/rooms/first-floor/living-room/front/light-level":{"Front Light Level":null},
"/house/rooms/first-floor/living-room/back/light-level":{"Back Light Level":null},
"/house/rooms/first-floor/living-room/front/occupied":{"Front Occupied":null},
"/house/rooms/first-floor/living-room/back/occupied":{"Back Occupied":null},
"/house/rooms/first-floor/living-room/couch/occupied":{"Couch Occupied":null}},
"/house/rooms/second-floor/landing/lightlevel":{"Light Level":null},
"/house/rooms/second-floor/bathroom/temperature":{"Temperature":null, "scale": 0.1}
"Second bedroom":{
"/house/rooms/second-floor/second-bedroom/temperature":{"Temperature":null,"scale": 0.1},
"/house/rooms/second-floor/second-bedroom/humidity":{"Humidity":null, "scale":0.1}
"Master bedroom":{
"/house/rooms/second-floor/master-bedroom/temperature":{"Temperature":null, "scale": 0.1},
"/house/rooms/second-floor/master-bedroom/light-level":{"Light level":null}

I could have easier configuration if I made more use of the topic hierarchy, e.g. show everything under /house/rooms, but the way I have things is more flexible and lets me choose which items to display.

Currently this web site only supports monitoring devices, not controlling them. I think I might add Websocket support to HouseControl, or I might do a node.js gateway that converts a Websocket to the tcp socket that HouseControl currently supports. HouseControl does support controlling things by publishing to MQTT, but you get no reply from that, and sometimes I need the reply.

Posted in Home automation | Tagged | 1 Comment

Couch Potato


I have had a Jeenode force sensor under my couch for a while. I thought I would use it for some couch potato monitoring.

This node-red flow causes my house to say “Hello, couch potato” when anyone sits down on the sofa, and “Goodbye, couch potato” when they get up.

It uses the MQTT topic than emonHub publishes when it receives RF data from the couch sensor.

Posted in Home automation, Uncategorized | Leave a comment


2015-12-01 09.09.35

I have recently been working with the team from OpenEnergyMonitor to include support for LightwaveRF in their new emonPi product – see their blog post.

There was a port of my LightWaveRF library called lightwaverf-pi on Github. I forked this and added a daemon that allows LWRF devices to be switched using MQTT. This is now included on the emonPi SD image. I also assisted in getting openHAB working with LightwaveRF using MQTT, and this will also be included on the emonPI SD card image.

I have replaced and early version of their emonTx product that I was using for electricity monitoring, with the emonPi – see the picture above.

This now includes a CT sensor, an AC adaptor to measure the electricity supply voltage, and a pulse counter on my electricity meter. My electricity monitoring is now much more accurate, and I am using emonCMS to analyse my usage data.

EmonCMS runs on the emonPi and in the cloud at I am using both.

It provides a wide range of apps, dashboards, visualisations, etc., for analysing power and other sensor data. For example the My Electric App:


and a custom dashboard:


EmonPi also includes a service called emonHub that reads data from a Jeenode network, publishes data to MQTT and to the local and cloud version of emonCMS.

Here is its Nodes page that shows data coming from the emonPi and the rest of my Jeenode network.


The emonPi is an excellent addition to my home automation system, but I still have some decisions to make about how to incorporate it into the rest of my system.

It gives me much better electricity monitoring and data analysis. It gives me another way to control my LightwaveRF devices, but does not receive data from LightwaveRF switches, remotes, etc., so is an incomplete solution for LightwaveRF. It is a possible host for my MQTT, node-red and openHAB services, and possibly others. Currently I have duplication of services and functionality, which I need to rationalise


Posted in Electronics, Home automation | Tagged | Leave a comment

Using openHAB as a User interface


I have been experimenting with using openHAB to control my home automation devices. I am mainly using it as a user interface to existing capability.

It is very easy to set up, and install, and is very portable. Its default user interfaces for the web and Android are very usable, if a bit limited. Here is the web page I set up for my living room:


It was trivial to move it between running on a Windows PC and on a Raspberry Pi.

openHAB supports a huge number of devices, but unfortunately not all the ones I use. It has no support Jeenode devices (other than the OpenEnergyMonitor devices), and no support for my EDF (Current Cost) Individual Appliance monitors.

It does support Wemo plugs, but unfortunately not the Wemo Insight until the next release.

It does, however, have excellent support for MQTT, so I added extra MQTT support to my HouseControl system, including publishing the sensor readings from all my sensors including the Jeenode ones, and I added the ability to control my EDF IAM devices by MQTT.

openHAB does have support for LightwaveRF devices, but only via UDP and the Wifi link, which I do not own. My solution to this was to add LightewaveRF UDP support to HouseControl, so that it emulates the Wifi Link. This works well and lets me control my sockets and lights. There is no support for LightwaveRF contact devices, however. I am probably best supporting those via MQTT. (Althogh they don’t work very well, and I prefer EnOcean ones).

openHAB does have EnOcean support, and I could probably get it to drive my Raspberry Pi EnOcean interface, but it was easier to pick up the sensor values and button presses via MQTT, as I was already publishing them.

I don’t have my TV, TiVO and AV receiver controlled by openHAB yet. The simplest way to do that is probably to add emulation of a supported TV (like Samsung or LG) to HouseControl. These use UDP, and my HouseControl emulation would read the UDP packets and convert them to messages to my Jeenode IR blaster.

openHABs TCP/IP support does not seem to be compatible with the way that HouseControl TCP/IP sockets work, but I am moving away from using the TCP/IP interface so heavily as using MQTT or UDP is more lightweight.

openHAB does support camera streams from my IP camera, but the way I am currently doing is a bit slow.

I am currently configuring openHAB by editing the text files, which is very easy. I have not tried their designer product yet.

openHAB seems to have a good rules system, but I have not used it much yet. Currently I prefer to use node-red for rules.

openHAB lacks a natural language interface that can be used for speech and chat interfaces, so HouseControl remains an essential part of my infrastructure.

Overall, I think I prefer openHAB to OpenRemote, but I am not sure if I will use it much.

I now have a wide variety of user interfaces to control and monitor my house, but none of them is ideal. Getting the combination of immediate accessibility and usability is hard.

Posted in Home automation | Tagged , | 3 Comments