J
It looks so good housed
in a small jewelry box
that my wife allows it to
reside on our bedroom
dresser.
INSTALL THE SOFTWARE
Download and install the Arduino IDE (
integrated development environment) software
from arduino.cc/en/Main/Software, and if
it doesn’t include a USB serial driver for the
onboard FTDI chip, download and install the
latest driver from ftdichip.com/drivers/vcp.
htm. Launch the IDE and select your Arduino
board type under the Tools → Board menu.
Download Creatrope’s X10 send/receive
library from makeprojects.com/v/30 and
copy the X10 folder to your Arduino libraries
folder, the
Contents/Resources/Java/librar-ies subfolder under your Arduino application
folder (to navigate to the libraries folder,
right-click on your Arduino application and
select Show Package Contents). The X10
folder should now sit alongside EEPROM,
Ethernet, and other included library folders.
TEST AND PROGRAM
Now comes the acid test: checking the
Arduino’s X10 send and receive functions.
Disconnect and remove the macro module from its box, and connect a USB cable
64 Make: makezine.com/30
K
between it and your computer. If you use
a Diecimila, ensure that the plastic jumper
near the square USB port is positioned on
the 2 pins closest to the port, to supply
power to the Arduino (this is not necessary
with a Duemilanove). Connect a phone cable
between the module’s RJ11 jack and the
PSC05, and plug the latter into a wall outlet.
Restart the Arduino IDE and load the
X10_receive example code by selecting it
under the File → Examples → X10 menu
(Figure K). Click the Verify button at the far
left of the Arduino IDE menu bar, wait for the
X10_receive code to compile, and then click
the Upload button.
Open the Serial Monitor under Arduino
IDE’s Tools menu. If you’ve done everything
properly, commands and status messages
from any X10 hardware you’ve plugged into
your power line will appear in the Serial
Monitor (Figure L).
We have reached the really fun part, where
we exercise the Arduino assembly as a true
X10 macro module. To begin, replace the
loop function in the checkout example with
new code that listens for macro triggers on
the power line and responds by sending a
sequence of X10 control commands. Figure M
shows an example, and you can download the
full C++ sketch at makeprojects.com/v/30.
Open, compile, and upload it (or a variant)
to your board from your computer as you