Upgrade FrSky D4R-II without a USB FTDI adapter using a RS232 COM serial port

I’ve just bought a D4R-II receiver supporting telemetry. This is a great little small, lightweight receiver that can be easily flashed to support full frame 8 channel CPPM output. You can get the software and manual from the FrSky website

I thought I had a suitable FTDI device which allows you to flash it without buying an official FrSky adapter. There are available online instructions on using the FTDI device to upgrade the D4R-II and for using the FTDI device on an arduino board.

Sadly the FTDI device I had didn’t support inversion of the RX/TX lines, but I do have an old school RS232 port on my desktop PC! It turns out you can use this old school RS232 COM Serial port to upgrade your D4R-II receiver.

Here’s a couple of pictures of my setup:

IMG_20150220_215930 IMG_20150220_215919

You just need to do the following:

  1. Jumper signal pins for channels 1/2 (puts receiver into programming mode)
  2. Connect serial port toD4R-II
    1. Connect D4R-II RX pin to RS232 DB9 pin 3 (TX)
    2. Connect D4R-II TX pin to RS232 DB9 pin 2 (RX)
    3. Connect D4R-II GND pin to RS232 DB9 pin 5 (GND)


  3. Connect power to the power pins of the receiver (marked +/-). I got this from my quadcopter ESCs via the Naze FC board.

Now you should be able to follow the instructions for upgrading from FrSky by getting the UID and downloading the new firmware.

I had a bit of trouble in Windows 8.1 using the FrSky software until I ran using the  ‘run as administrator’ option in the right-click menu. This seemed to enable it to work (presumably so it can use the serial port!).

However, I was first able to confirm that everything is working by using a terminal viewer and connecting to the relevant COM port (and settings – 9600 baud, 8N1) and seeing the board output it’s UID periodically as shown below:



Finally a thank you to the rcgroups post on upgrading the D8R-II with a serial COM port for inspiring this!

Posted in Howto, Quadcopters | Tagged , , , , , , , , , | 7 Comments

Max! Thermostat Pairing Procedure Protocol Information

This is just a quick post to document some reverse engineering of the Max! wireless/radio thermostat valves and window shutters to help others who might want to work on the project. I’ve simply attached a copy of the spreadsheet I produced in PDF format see this Max! Protocol Analysis PDF

These were manually extracted by listening to the communications between a normal Max!Cube and various devices using a CUL USB dongle and my OpenHAB binding plug in which allows you to enter a ‘listen’ mode to output the messages in a human readable format.

Posted in Home Automation, Reverse Engineering | Leave a comment

Metoffice Observations in OpenHAB

The article explains how to access MetOffice Observations in OpenHAB via the JSON API they provide. In the UK the MetOffice offer free weather observations and forecasts via their DataPoint service. This could be used for a variety of rules relating to external weather conditions.

To obtain MetOffice observations in OpenHAB you’ll first neet to get an API key from the MetOffice datapoint service by registering with them.

Once you are registered and logged in grab you API key from the link on the right and you’ll now need to find your site location using a query (just enter it into your browser) such as http://datapoint.metoffice.gov.uk/public/data/val/wxobs/all/xml/sitelist?key=APIKey

You’ll have to manually find your closest site from the list of 140 or so. My nearest site is Filton – so I will use ID 3628.

The MetOffice current supply the last 24 hours of data. To get the last 24 hours of observations we will use a URL such as (replacing 3628 from with your location) http://datapoint.metoffice.gov.uk/public/data/val/wxobs/all/json/3628?res=hourly&key=APIKey

Once you have working URLs you should get a load of JSON data ready to feed into OpenHAB.

First you’ll need to setup your transform. Create a new file in the configurations/transform directory. I called mine metofficeLatestObsTemp.js. Copy the following into it.

var metofficeData = JSON.parse(input)
metofficeData.SiteRep.DV.Location.Period[metofficeData.SiteRep.DV.Location.Period.length-1].Rep[metofficeData.SiteRep.DV.Location.Period[metofficeData.SiteRep.DV.Location.Period.length-1].Rep.length - 1].T

You can replace T with any of the data types listed in the metoffice documentation to get other information such as wind speed, direction, humidity, etc.

Next you’ll need to configure your OpenHAB item. I used the following line:
Number house_heating_externalTemp "External Temperature [%.1f °C]" (persist) { http="<[http://datapoint.metoffice.gov.uk/public/data/val/wxobs/all/json/3628?res=hourly&key=APIKey:3600000:JS(metofficeLatestObsTemp.js)]"}

You can now add this to your sitemap and display it in the openhab interface.


Posted in Home Automation, Howto | Tagged , , , | 2 Comments

Home Automation: Integrating Salus RT500 RF in OpenHAB using a Jeelink

We recently had a new boiler fitted with the Salus RT500RF controller. I’ve been playing around with a lot of home automation recently involving LightwaveRF, RFXCom unit and OpenHAB. Having temperature monitoring in my lounge and bedroom I really wanted the option to be able to control the boiler allowing the OpenHAB control system to decide when to enable the boiler based on factors such as room temperature, time of day and outside temperature.

Continue reading

Posted in Home Automation | Tagged , , , , , , , , , , , , | 21 Comments

Accessing partitions within an image or LVM volume used as an iSCSI target

I recently reinstalled the software on my NAS (open media vault) and tidied up the host name etc. As part of this I changed the name of the iSCSI target. This meant that my media PC wouldn’t boot over the network (I set it up using XBMCbuntu using this guide – http://www.heath-bar.com/blog/?p=184). To solve this I managed to mount the partition on the NAS server itself and modify the necessary boot parameters.

To mount it I did the following:

  1. Install kpartx:
  2. sudo apt-get install kpartx

  3. Create a loopback device. This create /dev/mapper/loop0pX where X is the parition number
  4. sudo /sbin/losetup /dev/loop0 /dev/mapper/Target-LogicalVolume

  5. Mount the parition:
  6. sudo mount /dev/mapper/loop0p1 /tmp/iscsi-target-mnt

The reason I created the loopback device was because I kept receiving these errors:

$ sudo kpartx -a /dev/mapper/Target-LogicalVolume
device-mapper: reload ioctl failed: Invalid argument
create/reload failed on Target-LogicalVolume1
device-mapper: reload ioctl failed: Invalid argument
create/reload failed on Target-LogicalVolume2
device-mapper: reload ioctl failed: Invalid argument

Credit to http://www.skytale.net/blog/categories/5-Linux for pointing me in the right direction.

Posted in Home Network, Howto, Server Admin | Tagged , , , , , , | Leave a comment

/dev/md0 can’t read superblock

Sometimes when my Stora NAS gets rebooted the array fails to mount and I get

/dev/md0 can't read superblock

To correct this I do the following:

  1. Try mount /dev/md0 (you probably tried this and got the above error)
  2. Do xfs_repair /dev/md0
  3. If that refuses to repair then do xfs_repair -L /dev/md0

No guarantees this won’t screw things up for you but it works for me.

Posted in Home Network, Howto | Tagged , , , , | Leave a comment

XBMC Frodo for Legacy AMD Graphics Cards (pre 5xxx)

Apparently AMD/ATI graphics cards less than 5xxx series have been left behind in the latest drivers. This is a bit of a pain for me as I have a 24xx series in my media PC. I tried the stock XBMCbuntu 12 ISO for AMD, but this left me with a non-working system. Going back the XBMCbuntu 11 and then doing a manual package upgrade seems to work:

sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install xbmc xbmc-bin
sudo apt-get upgrade

This upgrades everything, but keeps the base ubuntu install – so we get to keep the video drivers.

Posted in Home Network, Howto, Projects | Tagged , , , , , , , , , | 1 Comment

Carbohydrates, Glycogen and Weight

I saw in a forum post that glycogen stores can affect weight in quite a significant way. A quick search caused me to stumble across the article link below. It’s an interesting and enlightening read – and encouraging, especially after the festive season!

Understanding body weight and glycogen depletion

Posted in Interesting Articles | Tagged , , , , , | Leave a comment

MediaPC in a Xen Virtual Machine

The aim of this project was to get my MediaPC running as a VM host. This would allow me to run instances alongside my MediaPC, thus giving me a platform to experiment and develop things without having to setup separate machines etc.

I decided to use Xen on Ubuntu and found the Ubuntu Xen guide very useful.

Note: I never got this working – this is just documenting what I did and how it failed.

Continue reading

Posted in Howto, Projects, Virtualised Media PC | Tagged , , , , , | 1 Comment

Breaking the Ice on 50m Pools

The last week hasn’t been particularly exciting (except for today!). I have had the week off as I have had a cough – I stopped training as soon as my glands went up, it is my usual cue that something is about to go awry.

Today I was feeling better so I decided to head over to the new Hengrove pool this morning as it operates in its 50m configuration on Saturday mornings and I thought it would be a bit of a treat.

I haven’t done a solo swim for a while now as I have been just training once a week with BadTri – though I haven’t been the last two weeks due to illness / having stuff the evening before that meant I was back late.

Cycle computer showing -1.0 deg C

-1 deg… yeah I didn’t know it did negative!

After a very chilly cycle 25 min to Hengrove (my cycle computer is usually a bit optimistic with the temperature!) I entered the 50m pool.

It turns out 50m feels like a long way when you are used to 25m pools. There was definitely a psychological barrier about the thing – once I had warmed up and gotten used to the lap distance it I did a steady 1000m set and then did a gentle mixed warm down. It was tiring – I just felt I wasn’t generating power and was fatiguing quickly (maybe because I hadn’t had a good breakfast – only a banana), and it took me a while to get back used to the water. Seems two weeks is a long time to be out the water.

50m swimming pool with lanes

50m is a long way!

It was very quiet when I went, I don’t think there were more than three people (including me) in my lane at any point, and you very rarely meet them as the pool is so long! I quite enjoyed the 50m experience – I wonder what the transition back to 25m will be like.

The other exciting thing is that I have ordered my turbo trainer and ANT+ kit so I can get it running with TrainerRoad. I am really looking forward to thrashing out a few sessions over the coming months – hopefully getting my bike power up! Reviews to follow…

Posted in The Story, Week in Review | Tagged , , , | Leave a comment