Wednesday, June 30, 2010

X10 RF & IR remote using Arduino



Goals:
  • Create a platform independent solution that makes it easy to interface with X10 hardware and that supports sending and receiving both standard and extended X10 messages.
  • Make a cheap alternative to the Marmitek CM15PRO Computer Interface with better functionality, performance and RF-range.
  • Incorporate X10 IR into the solution to make products like the Marmitek IRRF7243 or the XanuraHome IRIX35 interfaces redundant.
  • Base it on the Arduino platform using a single Arduino Duemilanove controller.
Challenges:
  • Writing interrupt triggered non-blocking PLC1, RF and IR libraries that can be run in parallel on one ATmega168 chip without using too much resources or getting in the way of each other.
  • Making RF and IR performance good enough to be able to receive BRIGHT and DIM commands and forward them to the PLC1 interface without getting choppy dimming.
  • Using one of the ATmega168 pin change interrupts. Separate interrupts are needed for PLC1, RF and IR. The Arduino Duemilanove only has two external interrupts, but it's possible to use three additional pin change interrupts. Check out chapter 11 in the ATmega168 datasheet for more information.
Limitations:
  • RF library (X10rf) only tested with 434MHz KR22 remotes. Timing min and max values (defined in X10rf.h) may need changes to make library work with other remotes.
  • IR library (X10ir) only tested with Logitech Harmony remotes. Timings defined in X10ir.h can be changed to make it work with other remotes using the same protocol.
Future Enhancements:
  • Support for the WiShield 2.0 by AsyncLabs.
  • Android and iPhone apps.
  • Bluetooth Support.
Download the code:
  • X10ex library – X10 message transmission and reception using a PLC interface. 
  • X10rf library – X10 message reception using a standard 434 or 315MHz RF receiver.
  • X10ir library – X10 message reception using a standard, low cost IR receiver.
  • X10 test sketch – Example code using above libraries, including X10 serial protocol that works with the X10.Net library and code for the Ethernet shield.
  • X10.Net library – X10.Net serial communication library with test application. Written in C#.
The hardware you need:
  • Arduino Duemilanove board (ATmega328).
    Price: SparkFun ~$30, eBay ~$20
  • Marmitek XM10 Two-way PLC Interface2 or equivalent US version.
    Price: IntelliHome.be ~$50 (I live in Europe, X10 stuff is expensive)
  • 434MHz receiver module (I'm using one based on the Infineon TDA 5200 chip).
    Price: Similar product from SparkFun ~$5
  • IR Receiver (I'm using the Everlight IRM 3638N3).
    Price: Elfa.se ~$2, Similar product from SparkFun ~$2
Total Price: ~$77

The hardware it's replacing:
  • Marmitek CM15PRO Computer Interface.
    Price: ~$115
  • Marmitek IRRF7243 IR Mini Controller3 or XanuraHome IRIX35 Infrared Interface4.
    Price: ~$58 or ~$150 for the IRIX35
Total Price: ~$173 or ~$265

Harware used for testing:
  • X10 extended code capable two-way dimmers, appliance modules, etc.
  • Two Marmitek KR22 RF remotes (~$25 a piece).
  • Logitech Harmony 785 (using device Marmitek IR7243 to send X10 IR).
  • So far the library has been tested with the 50Hz European XM10 and the 60Hz North American PSCO5 PLC interfaces. Other models should work fine too. Thanks to the guy at http://brohogan.blogspot.com/ for testing the PSC05 :)
Credits:

I want to thank Jaime from Spain, for his contribution to getting me started with the Arduino Ethernet shield and for giving me useful information on the workings of the iPhone and Android platforms.

I also want to thank BroHogan for his excellent blog that inspired me to start my X10 project, and for his help on testing my libraries with North American PLC interfaces and 310MHz RF receivers.

If you want to know how to re-tune the 315Mhz RF receivers from Sparkfun to X10 compatible 310MHz receivers, check out BroHogans blog.

Resources:

1 PLC = Power Line Communication
2 The XM10 seems to have way better PLC signal strength compared to the CM15PRO.
3 In my opinion the IRRF7243 is not worth the money because of poor IR range and choppy dimming.
4 Never tested the IRIX35, but with a price of ~$150 I assume it’s a lot better than the IRRF7243.
Read More...