How-To: The Lonely Christmas Tree

Uploaded by makemagazine on Dec 14, 2011

Holidays can be a stressful time for everyone. Me, I’m drowning in email right now, so
I could use a little help getting into the holiday spirit as new messages pile on. The
Lonely Christmas Tree, on the other hand, loves getting new email and lights up every
time a new one comes in. I’ll show you how to make your own.
For this project, I’ll be using an Arduino and a PowerSwitch tail, which are available
in the Maker Shed. The PowerSwitch tail lets us safely and easily control A/C current with
our Arduino.
To connect the Arduino to the internet, I’ll be using the Ethernet Shield. Now you can
make this project wireless by using the XBee Internet Gateway or a WiFi shield. Check out
my Networked On Air Light project for more information about how to use the XBee Internet
I’ll use this wire to connect the PowerSwitch Tail to the Arduino’s ground and a digital
pin, extended here through the Ethernet Shield. Now whenever that pin is brought high, the
relay inside the PowerSwitch Tail closes the circuit between the wall outlet and the lights
on the tree.
Let’s take a look at the code running this project. I have a simple PHP script on my
web server that checks for new email over IMAP, but only when our tree wants to know
if there are new messages.
On the Arduino, The Ethernet Shield makes it really easy to access a URL on my web server
without a computer. Thanks to recent improvements to the code library, it’s become so much
easier to get started with the Ethernet Shield-- now it has DNS and DHCP capabilities.
When it comes to code, I like to start off with a working example and make changes little
by little. I modified the WebClient example to check our PHP script and activate the PowerSwitch
Tail’s relay switch when new mail comes in.
You could use this basic project idea to make email control all kinds of A/C devices, from
your bedside lamp to a food processor.
Your project doesn’t have to respond to just email. You can have the tree light up
when get a new IM, to changes in the weather, or even if you get a text message.
And in fact, you can send my tree a note--thanks to the YouTube API--by leaving a comment below.