X10 RF Protocol Decode - How to???

  • 1
  • 2
  • Page 1 of 2
nwrightson
Benutzer
Avatar
Gender:
Location: Newcastle
Age: 62
Homepage: nweha.homeserver.c…
Posts: 362
Registered: 08 / 2003
Subject:

X10 RF Protocol Decode - How to???

 · 
Posted: 31.03.2012 - 06:15  ·  #1
Hi All,
What do you think is the best method of performing a decode of the incoming serial data stream from a X10 (Home Automation product) RF (433MHz) Receiver?
Here is a link to the protocol X10 RF Protocol Basically a AGC header followed by a address byte, complement of the address byte, data byte followed by the compliment of the data byte.


I've never done a software based decode of a serial stream before, I've always used SPI/I2C/UART hardware.
I could do it -
1) All manually, looking at the level of the pin and doing a series of loops with udelays etc.
2) Using an Interrupt on the pin and a internal timer.

Given how noisy this area of the radio spectrum is, should I attempt to do multiple sampling within each bit?
Does any one have some code for this style of thing that they are willing to share? Save me reinventing the wheel again.


Thanks,
Neil.
nwrightson
Benutzer
Avatar
Gender:
Location: Newcastle
Age: 62
Homepage: nweha.homeserver.c…
Posts: 362
Registered: 08 / 2003
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 04.04.2012 - 06:28  ·  #2
Amazing!

Over 50 views and not one person has done a software decode of a serial stream or has any comments. :(

Neil.
Mr Crusty
 
Avatar
 
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 04.04.2012 - 14:04  ·  #3
Neil,

I think I would opt for a timer interrupt routine, as it does allow for other processing to carry on during interrupts, delays loops may suffer timing anomalies from other interrupt routines at a latter date.

It almost get a feeling that a hardware timer option might be a possible solution, or even a small FPGA

Like you most of my serial streams have used some form of UART in the past.

Hope others can give a better answer than I can.

Best
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 04.04.2012 - 17:48  ·  #4
Never done it, but I would comment as follows, althouhgh you have probably thought of all of this;

You can't really send the signal to, e.g. an ADC pin and hope to get anything useful. The AVR is simply too slow. So you need hardware to convert the carrier to a solid signal, hence the AGC I guess. You have a similar issue with many FPGAs although they do often run faster. Once you have these 'solid' signals you have to decide whether a false positive or a false negative is more likely to occur in order to resolve conflicts. If you have multiple sends of the same data you can use majority polling. I personally would use an off the shelf decoder chip to do the first stage, because that is the hard bit, e.g www.wgldesigns.com/w800.html This chip gives a serial output stream which you are more familiar with.
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 957
Registered: 09 / 2007
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 04.04.2012 - 20:15  ·  #5
Did you read http://load-8-1.blogspot.de/ ?
supports the X10 434MHz RF remotes and the X10 IR protocol with AtMega.
nwrightson
Benutzer
Avatar
Gender:
Location: Newcastle
Age: 62
Homepage: nweha.homeserver.c…
Posts: 362
Registered: 08 / 2003
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 05.04.2012 - 01:15  ·  #6
Hi Guys,
Thanks for responding.

Quote by Merlin

Never done it, but I would comment as follows, althouhgh you have probably thought of all of this;

You can't really send the signal to, e.g. an ADC pin and hope to get anything useful. The AVR is simply too slow. So you need hardware to convert the carrier to a solid signal, hence the AGC I guess. You have a similar issue with many FPGAs although they do often run faster. Once you have these 'solid' signals you have to decide whether a false positive or a false negative is more likely to occur in order to resolve conflicts. If you have multiple sends of the same data you can use majority polling. I personally would use an off the shelf decoder chip to do the first stage, because that is the hard bit, e.g www.wgldesigns.com/w800.html This chip gives a serial output stream which you are more familiar with.


The signal from the receiver is a Logic signal (TTL ?) so I don't need a ADC input. IT would appear that lot's of the transmitters do multiple sends, so I could use your majority polling. I already have a W800 but the PIC on it has died. Buying a new W800 is ~$150 including freight.
I have lot's of AVR's, a good compiler and help full friends, so why spend that amount of money on a inferior (PIC :) ) product. My PC software is looking for a W800 data stream and this is what I need to emulate. Ie convert the RF stream into four bytes, representing the 32 bits coming in. I don't need to do a decode of the bit's, more just a conversion between hardware mediums, ie from RF to RS232. But I do need to do some error checking though.

Quote by miparo

Did you read http://load-8-1.blogspot.de/ ?
supports the X10 434MHz RF remotes and the X10 IR protocol with AtMega.

I do have some Arduino hardware but have never used the compiler. I will have a look at the code though and see how they do it.

Thanks,
Neil.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1374
Registered: 03 / 2005
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 05.04.2012 - 10:24  ·  #7
Quote

My PC software is looking for a W800 data stream and this is what I need to emulate. Ie convert the RF stream into four bytes, representing the 32 bits coming in. I don't need to do a decode of the bit's,

Your original reference has an algorithm for doing just this (it is in basic, so it is easy to convert although the constants are questionable). The subroutine InputCapture obviously just generates an array of signal width. So I guess your original post was asking the best way to design 'InputCapture'. I would go with Mr Crusty on this and sample on a timer interrupt. I would set systick to 0.1 and use OnSystick to store the value. I tend to use a 3 sample algorithm to avoid glitches. I'll post it to you if you are interested.
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: X10 RF Protocol Decode - How to???

 · 
Posted: 05.04.2012 - 12:15  ·  #8
  • 1
  • 2
  • Page 1 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 10 · Cache Hits: 14   134   148 · Page-Gen-Time: 0.024321s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI