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)

    db9-pinout

  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:

IMG_20150220_220049

 

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.

Capture

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

Indefero errors fatal: bad argument fatal: The remote end hung up unexpectedly

I was trying to commit something to my Indefero project management server today and was getting the following error:

fatal: bad argument
fatal: The remote end hung up unexpectedly

I puzzled around for a while and then tried manually logging into the git server using a console SSH and was greeted with this:

$ ssh mygitserver.com
PTY allocation request failed on channel 0
PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/mhash.so’ – /usr/lib/php5/20090626+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
Need SSH_ORIGINAL_COMMAND in environment.
Connection to mygitserver.com closed.

Those PHP errors are probably throwing Git off course and making it unhappy. The solution was two step:

  1. Edit /etc/php5/cli/conf.d/ming.ini to ensure that comments are pre-ceded by ‘;’ and not ‘#’
  2. Move mhash.ini out of  /etc/php5/cli/conf.d/ as as it is no longer used in debian (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593266)

Doing the above two steps resulted in a clean session opening up when ssh’ing into the git server:

$ ssh mygitserver.com
PTY allocation request failed on channel 0
Need SSH_ORIGINAL_COMMAND in environment.
Connection to mygitserver.com closed.

Now pushing to the Git server works – yay!

 

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