Marc's Public Blog - Linux Home Automation


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Dining | Diving | Electronics | Exercising | Festivals | Flying | Halloween | Hiking | Linux | Linuxha | Monuments | Museums | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



Table of Content for linuxha:

More pages: March 2023 July 2014 December 2013 November 2013 January 2013 November 2011 August 2011 July 2011 March 2011 August 2010 June 2010 March 2010 February 2010 December 2009 November 2009 August 2009 May 2009 March 2009 March 2004



2011/07/24 Hacking an external antenna onto an X10 CM19a, and adding misterhouse support
π 2011-07-24 00:00 in Computers, Linux, Linuxha
While this page is about the CM19a, the code I wrote should work just as well with the CM15a.

I had an old CM19a (USB X10RF and X10Sec transceiver) lying around. This was more desirable than the well known CM26a used by many misterhouse users in that on top of being USB, it more importantly can decode X10 Security RF signals, as well as send X10RF signals too.
Now, the problem with the CM19a, is that like the CM26a, it has a useless antenna and therefore a useless RF range. The good news however is that the same antenna hack that can be applied to the CM26a works with the CM19a too.

For pictures, see the example for the CM26a antenna modification this hack was based on (scroll to the antenna plug wiring).

In a nutshell, you cut the antenna wire to go far enough to reach the new antenna plug that you attach to the plastic (I used my soldering iron to burn a hole through it). The antenna wire will plug to the center connector. Then, the tricky side is to use the piece of wire you cut off, and connect it to the ground plate of that board. Ground is actually easy to solder to: most holes through the board with metal on each side are ways to pass ground from one side of the board to the other. I used one of them (see red arrow) to solder my other wire to, and connected that to the ground of the new plug.



You then have the option of using a dipole antenna or a quarter plane antenna to connect to your new plug (which one is best depends on where you put the antenna and what kind of area you are trying to cover).


By now, you actually have turned your CM19a into a device that's almost as good as a W800 for reception, but with the bonus of being able to send data too.

Next (for me), was making use of this in misterhouse. Because it is a USB device that does not emulate a serial port, it will not work in misterhouse without a special driver.
To find the simplest way to solve my problem, I decided to use the open source mochad to talk USB to the device and spit out the data frames it was receiving (I hacked mochad to spit out undecoded data). I then wrote a glue shell script that sends that data to a pipe which misterhouse can then read from. It then sends that data into the misterhouse X10_RF module, reusing the common decoding and injection code used by the X10_W800 and X10_MR26 misterhouse modules.
This all ended up in the new lib/X10_CMxx.pm module I wrote and added to misterhouse svn.

You can find more details on the Misterhouse Page for X10Sec and X10RF support with CM19a and CM15a through mochad.

Here are two examples of logs with debugging enabled:

02/07/2011 14:51:45  CMxx: Ignoring first send of X10RF data from mochad (looking for confirmation resend): 8F 80 84 7B F1 80
02/07/2011 14:51:45  CMxx: decoded data received from mochad: 07/02 14:51:45 Rx RFSEC Addr: 8F:F1:80 Func: Contact_normal_min_DS10A
02/07/2011 14:51:45  W800: security: unmatched device 0xf1 (state = NormalMin)
02/07/2011 14:51:45  CMxx: X10RF data from mochad: 8F 80 84 7B F1 80
02/07/2011 14:51:45  X10_CMXX: security: unmatched device 0xf1 (state = NormalMin)
02/07/2011 14:51:45  CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 2): 8F 80 84 7B F1 80
02/07/2011 14:51:46  CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 3): 8F 80 84 7B F1 80
02/07/2011 14:51:46  CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 3): 8F 80 84 7B F1 80

02/07/2011 14:51:59 CMxx: Ignoring first send of X10RF data from mochad (looking for confirmation resend): 60 9F 20 DF 02/07/2011 14:51:59 CMxx: decoded data received from mochad: 07/02 14:51:59 Rx RF HouseUnit: A1 Func: Off 02/07/2011 14:51:59 XA1AK: testx10 off 02/07/2011 14:51:59 CMxx: X10RF data from mochad: 60 9F 20 DF 02/07/2011 14:51:59 XA1AK: testx10 off 02/07/2011 14:51:59 XA1AK: testx10 off 02/07/2011 14:51:59 CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 2): 60 9F 20 DF 02/07/2011 14:51:59 CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 3): 60 9F 20 DF 02/07/2011 14:51:59 CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 3): 60 9F 20 DF 02/07/2011 14:51:59 CMxx: Ignoring duplicate X10RF data from mochad (dupe cnt >= 3): 60 9F 20 DF

Ultimately, mh without debugging only sees, which is what you want: 02/07/2011 14:51:59 XA1AK: testx10 off


More pages: March 2023 July 2014 December 2013 November 2013 January 2013 November 2011 August 2011 July 2011 March 2011 August 2010 June 2010 March 2010 February 2010 December 2009 November 2009 August 2009 May 2009 March 2009 March 2004

Contact Email