PDA

View Full Version : Teensy as USB Adapter for X-10 CM17A "Firecracker"



johncc
01-08-2013, 03:41 AM
The last time I needed to control X-10 was years ago when PCs still had serial ports.

I didn't have a USB/Serial adapter around tonight so I threw this together.
119

The code was so simple, worked the very first time!


/*
CM17A Firecracker - USB Adapter

ftp://ftp.x10.com/pub/manuals/cm17a_protocol.txt
http://www.db9-pinout.com/
https://www.pjrc.com/teensy/pinout.html
Pin 4 DTR - Teensy 2 pin 22
Pin 5 Ground
Pin 7 RTS - Teensy 2 pin 23
*/

int DTR=22;
int RTS=23;
int LED=11; // Teensy 2
void setup() {
Serial.begin(38400);
pinMode( RTS,OUTPUT);
pinMode( DTR,OUTPUT);
pinMode( LED,OUTPUT);
}

void loop()
{
bool rts=Serial.rts();
digitalWrite( RTS, rts );
digitalWrite( LED, rts); // light led for activity indicator
digitalWrite( DTR, Serial.dtr() );
}

Using "Jimmy's" x10.py from http://www.averdevelopment.com/python/x10.html was also easy


john@mythbuntu:~/pyx10$ wget "http://www.averdevelopment.com/python/x10.zip"
john@mythbuntu:~/pyx10$ unzip x10.zip
john@mythbuntu:~/pyx10$ python x10.py /dev/ttyACM0 F1 On # turn on coffeepot


Thanks Paul!

John