X10 RF & IR Remote Using Arduino - Lookout

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:
  • Arduino Reference
  • ATmega168 datasheet
  • Marmitek XM10
  • X10 PLC protocol
  • X10 RF protocol
  • X10 IR protocol
  • X10 Standard and Extended Code Protocol
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.

31 comments :

  1. Anonymous20/7/10 20:32

    The US X10 RF frequency is 310MHz but sparkfun only has 315MHz RF receivers. Any idea where to find one?

    ReplyDeleteReplies
    1. Anonymous26/5/18 07:10

      The cheapest mobile subscription differs from the more expensive deals with hundreds of dollars, this despite the fact that the amount of data included is the same. Looking at Forbrukeretaten will also find that within the same price range you can find offers where you get up to 20GB extra compared to your current subscription forbrukeretaten.no …..

      DeleteReplies
        Reply
    2. Reply
  2. Thomas M25/8/10 17:58

    Sorry, wish I could help you. I wasn't even aware that the X10 frequency in the US was 310MHz. I found a receiver module that looks suitable on www.wenshing.com.tw, but I don't know how to order one.

    ReplyDeleteReplies
      Reply
  3. Unknown4/10/10 00:48

    Hi! very good job. I write you because I'm know a little of iphone/android programming and I'm working to make some app for interacting with arduino and your libs. I have searched for your email but i don't find it. If you want, we can't talk about all of this.

    ReplyDeleteReplies
      Reply
  4. Unknown13/12/10 15:09

    Hi, At first, I thank you for sharing that good work. It is really inspired me to control my existing X10 devices independently as you did.But, I want to mbed instead of Arduino MCU. It has everything but much more. There are plenty of interrupts and built in PHY (LAN) for accessing over internet.Do you have any knowledge how to attach a transmitter module along to Receiver then we can control X10 devices by using X10 TM13 transciever module instead of XM10 (PLC)?Thanks, Sener

    ReplyDeleteReplies
      Reply
  5. Mirko Ugolini19/12/10 08:56

    Hi Thoam,Great job!I was searching on internet for a while a project like yours.I would like to develope a Android app for control and for receive trigger from my x10 devices.In the beginning i though to control them by internet implementing one app that send comand to a rest webservice arduino.In your article you make reference to a arduino web server that implement the rest/jason protocol but from the photos that you post it seems that you use a rf module.I do not understend!I miss something.I would like to use arduino 2009 plus one ethrnet shield.What do you think about?Did you make a solution like this or you planned to do like this in the near future.Compliments again for your great job and for sharing jour efforts.Mirko Ugolini

    ReplyDeleteReplies
    1. Ben Tesser23/4/13 07:51

      Your best bet is to use a raspberry pi (~$25 linux computer @ newark.com) as the server with a usb->serial connection ($5 on t-mart.com) you can connect a cm11a into that (~$15 on ebay) and a cm19a (~$15 on ebay) for rf signals. You could easily also hook up a usb ir reader/blaster (~$10 tmart.com) if you need ir too. Then you could use software like domogik, or domus.link with heyu, or mochad for controlling x10 security systems

      DeleteReplies
        Reply
    2. Reply
  6. Thomas M7/1/11 12:29

    @Mirko UgoliniI'm using the RF module to receive X10 commands from standard X10 remotes like the KR22. The web server code is written for the Arduino Ethernet shield, so using the hardware you are suggesting should work perfectly.I'm currently working on an Android app that uses my web server code and the Ethernet shield. I've been testing the app for quite a while now and will publish it soon.If you want to e-mail me directly, look for my e-mail address in the source code.-Thomas

    ReplyDeleteReplies
      Reply
  7. Thomas M7/1/11 12:37

    @SenerAlthough it's possible to send X10 RF commands from the Arduino and repeating them using a device like the TM13 I wouldn't recommend it because the X10 signaling is quite slow. Putting another link in the chain will make it even slower. Dim/bright commands will suffer from this performance loss. Also, be aware that the X10 RF protocol doesn't support extended code, so preset dim commands, e.g., would not work.I don't think it should be very hard to rewrite my X10 libraries to work with the mbed. If you want to give it a try I'll assist you as much as I can.-Thomas

    ReplyDeleteReplies
      Reply
  8. dave21/5/11 06:07

    Your libraries are compelling, but is there some documentation on their usage? I tried to follow the code in the example but kept getting lost. Something regarding how to send an ON command vs an OFF command, receiving and displaying commands, that kind of thing.

    ReplyDeleteReplies
      Reply
  9. Unknown23/5/11 13:55

    Thomas,I'm having trouble compiling your code. I'm getting the following error;"X10_Ethernet.cpp: In function 'void processEthernetRequest()':X10_Ethernet:407: error: 'class X10ex' has no member named 'setModuleName'"I'm using an ATmega168. Can you help.Thanks.

    ReplyDeleteReplies
    1. Thomas M25/6/12 20:27

      I know this is a bit late. But, to anyone else who has the same question: Unfortunately there is not enough memory on the ATmega168 to run the Ethernet sample code.If you're OK with serial only it will work fine with the ATmega168.

      DeleteReplies
        Reply
    2. Reply
  10. Johnnygal1/1/12 23:15

    Hello,Great blog post. I hope to make one of these.I cannot find a receiver based on the Infineon TDA 5200. Will one of these do the job:http://www.sparkfun.com/products/10532Thanks,John

    ReplyDeleteReplies
    1. Thomas M25/6/12 20:35

      Any receiver on the frequency used for the Marmitek remotes in your country should work fine.

      DeleteReplies
        Reply
    2. Reply
  11. Negadeth25/1/12 09:05

    You connect directly the pl zero crossing, pl receive, and pl transmit to digital pins on arduino?I'm trying to do this but I have some problems. I have the Marmitek XM10 and arduino uno.If you have a fritzing scheme... thanks a lot!

    ReplyDeleteReplies
    1. Thomas M25/6/12 20:45

      I hope you got it working. Yes, I have everything connected directly to the Arduino digital pins. Not sure a Fritzing would be much clearer than the image on the top of the blog post.I recommend that people start with a simple setup, start with just the XM10 (no Ethernet Shield, RF or IR). And start with the X10 Serial sample sketch. Once that works, connect the next "device".

      DeleteReplies
        Reply
    2. Reply
  12. eddie3D16/3/12 12:17

    Hi I'm an newcomer to Arduino and am trying to interface an Arduino Uno with a Marmitek XM10 controller. I've spent days trying to get an X10 library that is compatible with 60HZ and I found everyone recommending this lib. I've noticed that the "#include WProgram.h" line won't compile on the 1.0 IDE, changing the line to "Arduino.h" seems to work but I'm not sure if that change is appropriate or if anything else needs to change. Initially I just want to switch a few appliances on and off so don't need any of the remote code Is there a simple sketch of using the x10ex lib just to switch lights on off etc.Many ThanksEddie

    ReplyDeleteReplies
    1. Thomas M25/6/12 22:19

      Hi Eddie.First, try to download the new versions of the library (published June 23.), that should fix the "WProgram.h" error and some other issues.Next, try experimenting with the phases and Hz settings in the X10ex library "constructor". By default these are set to 1 (no phase coupling/repeat) and 50Hz respectively.I'll make a "Simple" sketch without the RF and IR stuff soon, but I'm afraid it wont make much difference.

      DeleteReplies
        Reply
    2. Thomas M26/6/12 00:20

      Simple sketch available here.

      DeleteReplies
        Reply
    3. Reply
  13. Edy24/4/12 09:41

    Thomas, why your library doesn't work with arduino mega 2560?The XM10 doesn't respond but with Arduio Uno works fine.

    ReplyDeleteReplies
    1. Thomas M25/6/12 21:59

      I think you have to use other pins and interrupts with the Mega, have you tried that? And make sure to use the new libraries and samples I published June 23.If you can't figure it out, send me an e-mail. You can find my e-mail address in the license text of every source file.

      DeleteReplies
        Reply
    2. Reply
  14. Thomas M25/6/12 20:31

    It doesn't work with either. You need the XM10 or equivalent. The good news is that the XM10 is cheap compared to the CM11 and CM15 computer interfaces.

    ReplyDeleteReplies
      Reply
  15. Thomas M25/6/12 21:00

    My libraries and sample sketches have not been working well after the Arduino 1.0 upgrade, and not at all after the Arduino 1.01. I'm sorry to anyone who've had problems, but I just noticed these issues myself.As of revision 68 (23. June) everything should be working again.

    ReplyDeleteReplies
      Reply
  16. Jon Caira11/8/12 19:56

    Hi Thanks for the library and sketches. I am using the XM10U and am unsure about how to wire it up to the Arduino. Your diagram seems to be wired up differently to the arduino X10 documentation although there seems to be discussion on whether that is correct or not. Do you still have the 5k Ohm pull up resistor in place? Would it be possible for you to provide a simple wiring diagram without the RF and IR components?Thanks

    ReplyDeleteReplies
      Reply
  17. JPingouix27/1/13 18:38

    Hi everybody,I am new comer in Arduino land, and very interested about this project. My goal is to allow a disable person to switch on/off lights and others from a PC, using the LAN.I have buyed an Arduino Mega260 and an ethernet shield. I get some trouble for cabling the Marmitek XM10 module to the Arduino: I have 4 wires (black, red, green, yellow) and don't fint how to plug them on the board.Any help would be very welcome.Thanks in advance.

    ReplyDeleteReplies
      Reply
  18. Ciupanezul11/5/13 02:09

    This comment has been removed by the author.

    ReplyDeleteReplies
      Reply
  19. Philip19/9/13 22:16

    Hello ,I made an Android App to use with this library X10Domuino on google play.Check Androidmodbus.com for more infoPhilip

    ReplyDeleteReplies
      Reply
  20. Ana María25/1/16 20:08

    This comment has been removed by the author.

    ReplyDeleteReplies
      Reply
  21. Woodstock656/3/16 14:45

    Meanwhile, thank you so much, I'm rehearsing ...I saw that the library is not compatible with the 1.67 version ...

    ReplyDeleteReplies
      Reply
  22. Unknown11/7/16 22:28

    sadly the library doesnt seems to compile anymore

    ReplyDeleteReplies
      Reply
  23. GusD19/8/19 09:01

    first, thanks for publishing your effortand have a question, if you find the time to answerHave compile your library with help from some others sitesCannot send X10 but receive for now, no mattermy project is and question is,Have installed at home, HAI Omni Pro from 1999and try to remove all together X10 modules and PLC XM10Want to read X10 directly from Omni RJ11 (and go from there with PWM and Relays no matter that)Any guidance on how to simulate Zero crossing and receive X10 from control panel. thanks is advance. Costas

    ReplyDeleteReplies
      Reply
Add commentLoad more... Newer Post Home Subscribe to: Post Comments ( Atom )

Recent Posts

Downloads

  • SonosUPnP library
  • MicroXPath library
  • X10 libraries

Other Blogs

  • Ben Krasnow
  • EEVBlog
  • Mike's Electric Stuff
  • Veritasium
  • Weatherstation +

About Me

Thomas M View my complete profile

Followers

Tag » Arduino X10rf.h