Learning Examples | Foundations | Hacking | Links
This library enables you to send and receive X10 commands from an Arduino module. X10 is a synchronous serial protocol that travels over AC power lines, sending a bit every time the AC power crosses zero volts. It's used in home automation. You can find X10 controllers and devices at http://www.x10.com, http://www.smarthome.com, and more.
This library has been tested using the PL513 one-way X10 controller, and the TW523 two-way X10 controller. Both of these are essentially X10 modems, converting the 5V output of the Arduino into AC signals on the zero crossing.
To connect an Arduino to one of these modules, get a phone cable with an RJ-11 connector, and cut one end off. Then wire the pins as follows:
Download: X10.zip
To use, unzip it and copy the resulting folder, called TextString, into the lib/targets/libraries directory of your arduino application folder. Then re-start the Arduino application.
When you restart, you'll see a few warning messages in the debugger pane at the bottom of the program. You can ignore them.
As of version 0.3, here's what you can do:
x10(int strLength) - initialize an instance of the X10 library on two digital pins. e.g.
x10 myHouse = x10(9, 10); // initializes X10 on pins 9 (zero crossing pin) and 10 (data pin)
void write(byte houseCode, byte numberCode, int numRepeats) - Send an X10 message, e.g.
myHouse.write(A, ALL_LIGHTS_ON, 1); // Turns on all lights in house code A
version(void) - get the library version. Since there will be more functions added, printing the version is a useful debugging tool when you get an error from a given function. Perhaps you're using an earlier version that doesn't feature the version you need! e.g.
Serial.println(myHouse.version()); // prints the version of the library
There are a number of constants added to make X10 easier. They are as follows:
Version 0.3 is compatible with Arduino 0012.
For a full explanation of X10 and these codes, see this technote
If anyone's interested in helping to develop this library further, please contact me at tom.igoe at gmail.com