view history edit print login register

Arduino -> X10 Wireless

Overview:

The CM17A is a dongle that sends X10 commands (ON, OFF, BRIGHT, DIM) via RF to X10 receivers. The receivers then send signals down the house wiring to control lights and appliances. The CM17A is relatively cheap (about 10USD on eBay).

This technique is a good safe way to (wirelessly) control devices connected to the house wiring.

Hardware Connection:

Two digital pins and GND on the the Arduino are connected to the RTS, DTR, and GND pins on a DB9 connector which is plugged into the CM17A. (See "CONNECTION:" in the header comments of the sketch below.)

Code:

I used the common reference for the CM17A protocol from ftp://ftp.x10.com/pub/manuals/cm17a_protocol.txt .

Originally I posted the CM17A function and example here, but DaveK was nice enough to turn it into a class so it could be used as a library.

The sketch below shows how to use the "X10Firecracker" library and provides the basics you will need to control the CM17A. Change the sample commands in loop() as required.

  1. /* Arduino Interface to the CM17A Wireless X10 dongle. BroHogan 7/19/08
  2.  * Arduino Library Conversion by DaveK AC0KG  Dec/08
  3.  * The CM17A gets it power and data using only the RTS, CTS, & Gnd lines.
  4.  * CONNECTION: RTS -> DB9 pin 7.  DTR -> DB9 pin 4. Gnd. -> DB9 pin 5.
  5.  * See X10Firecracker.cpp in your libraries folder for more details
  6.  */
  7.  
  8. #include <X10Firecracker.h>
  9.  
  10. #define RTS_PIN     2                   // RTS line for C17A - DB9 pin 7
  11. #define DTR_PIN     3                   // DTR line for C17A - DB9 pin 4
  12. #define BIT_DELAY   1                   // mS delay between bits (1 mS OK)
  13.  
  14. void setup()
  15. {
  16.   X10.init(RTS_PIN, DTR_PIN, BIT_DELAY);  //
  17. }
  18.  
  19. void Test()
  20. {
  21.   X10.sendCmd( hcA, 2, cmdOn );
  22.   X10.sendCmd( hcA, 2, cmdDim );
  23.   X10.sendCmd( hcA, 2, cmdDim );
  24.   X10.sendCmd( hcA, 2, cmdDim );
  25.   X10.sendCmd( hcA, 2, cmdDim );
  26.   X10.sendCmd( hcA, 2, cmdDim );
  27.   X10.sendCmd( hcA, 2, cmdBright );
  28.   X10.sendCmd( hcA, 2, cmdBright );
  29.   X10.sendCmd( hcA, 2, cmdBright );
  30.   X10.sendCmd( hcA, 2, cmdBright );
  31.   X10.sendCmd( hcA, 2, cmdBright );
  32.   X10.sendCmd( hcA, 2, cmdOff );
  33. }
  34.  
  35. void loop()
  36. {
  37.   delay(2000);
  38.   Test();
  39.   delay(8000);
  40. }

You'll find the library with a similar example here: X10Firecracker.zip

License:

The source code here is released under the Terms of the GNU Lesser General Public License version 3.0.

That's all I know. BroHogan