Saturday, October 16, 2010

Receiving X10 RF Transmissions (Updated 11/21/10)

For me, at least, this was the last piece of the open hardware X10 puzzle. In this blog you'll find open hardware projects that receive and transmit PLC (powerline) signals, as well as transmitting X10 RF signals (via the CM17A). Now sitting in front of me, is an off the shelf 315MHz receiver (detuned to 310Mhz), happily beeping away each time a warm body crosses an X10 motion detector.

The receiver is from Sparkfun, but any similar receiver should work. The key is to get one with a tuning slug as opposed to a crystal. The software that interfaces the receiver to the Arduino is from a suite of X10 libraries written by ThomasM. You can find the whole suite (PLC transmit & receive, RF receive, and IR receive) here. Having written an earlier version of PLC receive, I'd recommend his version for PLC receive and transmit as well.

So lets get started. Get a  315MHz receiver, wire it up per the data sheet, get Thomas's libraries and his example sketch, (or get the "test & calibrate" sketch I made here). Press a key on an X10 RF remote. It should work right away, but only at close range.

So the next step is to tune this receiver closer to 310MHz. You'll want to start by adding an antenna. This page gave me the following lengths (in inches) for a vertical wire antenna at 310MHz:

  • 1/4 wave - 9 1/16"
  • 1/2 wave - 18 1/8"
  • full wave - 36 1/4"
I started with 1/4 wave whip antenna, but the ultimate may be the "egg beater" antenna (Google for examples).

Now it's time to tune the receiver to 310Mhz. I don't have a scope, and I found that a sound card scope was of little help, since the signal is clipped to soundcard inputs, so I came up with two alternate methods.

The first method I tried was to simply connect the output (data pin) of the receiver to the Aux-in on my PC. You will hear a lot of noise! (This is due to the AGC built into the receiver.) However you will clearly hear the RF signal when you push a button on an X10 RF remote - as long as it's close and pointing at the antenna. Pointing the remote away from the antenna gave a fainter signal, and moving it further away made it even fainter. So with the faint signal, I simply turned the tuning slug until I got a clearer sound in the speakers when I pushed a button on the remote. Not very scientific, but it seemed to do the job. (I started by turning the slug CCW - this post said ~160° CCW.)

Later I used a different method which seemed to be more "real word". I made the "test & calibrate sketch" linked above. It simply beeps a piezo and outputs to serial whenever the receiver has a good read. Then I clamped a button down on an X10 RF Remote (HR12A) so it would continuously transmit,  and located it at varying distances from the receiver. While listening for the beeps, I adjusted the tuning slug for good reads at the furthest distance.

While using the second method, I also played around with antennas.  The 1/4 wave whip antenna really didn't seem to do much, and I couldn't pick up signals if the transmitter was outside my house. Then I tried a 36 1/4"  piece of twisted pair from a phone cable. One wire to the ANT pin on the receiver and the other to GND. This made a big difference, and the grounded lead contributed to the difference.

That's about where I am at this point. Interfaced to the example sketch I can receive RF signals from the motion sensors on my front and back doors. There's more about this in last half of this thread in the Arduino forum. [4-3-13] (There were changes to X10rf.h - here is the modified version I used.)

Not sure at this point where I want to go with this - perhaps a "whole house" X10 receiver with some other goodies, or some little dedicated device. We'll see.

14 comments:

  1. Thanks for posting this!!
    I have been wanting to interface x10 security devices (PDS01, KR10A and PMS01) with the arduino and this brings the cost way down because I won't need to purchase a W800RF32A receiver.

    Then again the security devices are a bit more complicated so I might have some trouble getting it to work.

    ReplyDelete
  2. Great! Let me know how you make out with using X10 security devices.

    ReplyDelete
  3. Unfortunately it looks like sparkfun is no longer carrying this receiver. I guess their supplier stopped selling them. Any ideas for an alternative?

    ReplyDelete
  4. You might try this one . . .
    http://www.robotshop.com/seeedstudio-315mhz-rf-low-cost-transmitter-receiver-pair-3.html
    It has a tuning slug.

    ReplyDelete
  5. Can actually get a similar receiver from some Chinese websites (in English of course). Just Google 315MHz receiver. Works really well for me and pretty inexpensive. I get pretty good range with the suggestions here and on the tech notes for antennas on the supplier site. Maybe will try a transceiver next time.

    ReplyDelete
  6. I just ordered that Seeedstudio 315mhz receiver from robotshop, so I'll let you know how I get along. Thanks for this post.

    ReplyDelete
  7. If you're having problems receiving some remote controls check out http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1282815280/15 and see Phil.H's suggestion below. Needless to say would probably be good to adjust your own numbers.

    ReplyDelete
  8. Brilliant idea - listening to the raw output of the Receiver while transmitting from the fringe in order to tune it. I'll use that. Thanks much!!

    ReplyDelete
  9. thanks for your information, I built the egg beater antenna described at your link above, Its working really great with my V572A

    ReplyDelete
  10. Is there a library for the CM19A. It is the USB equivalent of the Firecracker...

    ReplyDelete
    Replies
    1. Interesting, thanks. It's good to see they are still making new types of X10 modules. Given that it's USB I won't have much use for it with microprocessors, but it could come in handy for some.

      Delete
  11. This comment has been removed by the author.

    ReplyDelete
  12. The link to the eggbeater antenna brings up a Zeus virus warning in Microsoft Edge browser.

    ReplyDelete
    Replies
    1. Thanks! I'll take your word for it. I removed the link.

      Delete