Instructables

Tweeting Christmas Tree

Featured
Picture of Tweeting Christmas Tree
It's Christmas season once again and that means its time to get together with all of your friends and family to share in the joys of the holiday spirit. In past times, with all of the food, drink and merriment, it has been easy to get too lazy to get up off the couch and change the tree's lighting. Fortunately, we are living in the modern era, and this no longer needs to be a problem. With the assistance of our good friend, the Arduino and a Twitter-enabled cellphone, you can now update the tree as you slouch in a food-induced coma on the couch. Simply tweet the colors you would like to see lit and the tree will light up like Christmas magic.

 
Remove these adsRemove these ads by Signing Up

Step 1: Go get stuff

Picture of Go get stuff

You will need:

- (x2) Arduino Uno
- (x2) Wireless SD shield
- (x2) XBee transceivers
- 8 x 6 x 3 project enclosure
- Laser cut panel (file) ***
- (x4) sockets
- 12 awg stranded wire
- 22 awg red and black solid core wire
- (x1) Multipurpose PCB
- (x4) 9V relay (2A @ 120V)
- (x4) 2N3904 transistors
- DPDT rocker switch
- 9V battery connectors
- 9V battery
- 9V battery holder
- M-type power plug
- Lamp cord
- Wire nut (large enough to hold five 12 awg wires)
- (x4) 6-32 x 1/2"
- (x4) 4-40 x 1-1/2"
- 4-40 x 1/2"
- (x4) 6-32 nuts
- (x5) 4-40 nuts
- (x4) adhesive rubber pads (optional)
- USB A/B cable
- A computer

*** If you don't have a laser cutter, you can use a cutting service like Ponoko or print out the file and use it as a cutting guide for making the panel with more traditional tools.

Step 2: Assemble Arduinos

Picture of Assemble Arduinos
26C.jpg
26D.jpg
26E.jpg
Place the wireless SD shield onto the Arduino.

Next, place the XBee transceiver into the socket of the the wireless SD shield such that the antenna is closer to the edge of the board.
Very interesting project. I started to do something like this with battery powered xmas lights, freebasic. twidge, and the parallel port, but had other projects to work on. .
alspad2 years ago
could you put in the arduino code.
randofo (author)  alspad2 years ago
See step 16
Myself2 years ago
(I'm posting this separately from the other comment so that the resulting threads are separate.)

As a side note, take a look at the "ADC and digital I/O line support" section of the XBee manual. The XBee could drive the transistors directly, making the Arduinos in this project entirely superfluous. The PC-side program would simply have to place the units into API mode and send the appropriate Dx commands.

Although if your PC doesn't have a UART (I see in the photo that it's a modern Mac), then using an Arduino as a USB-to-serial converter is a practical, albeit expensive, way to do it.

However, that's all splitting hairs. The project works, it's very well documented, and the photos are clear and plentiful. Nice writeup!
Myself2 years ago
I'm concerned that the lack of snubber diodes on the relay coils means bad things for the drive transistors and potentially the Arduino itself.

Relay coils, like all coils, are inductive. When you place voltage across a coil, current starts flowing through it, building up a magnetic field in the coil. When you remove the source of current, that magnetic field tries to collapse, but the energy in the field has to go somewhere. It forces the current to continue flowing until the field is dissipated, raising the voltage if necessary. This effect is how switchmode power supplies work.

If you've turned on the current with a transistor, then when you turn the transistor off again, the voltage will spike until the transistor conducts anyway, damaging the transistor. Your circuit might endure a thousand on-off cycles before anything obviously bad happens, or it might smoke right away. When the transistor fails, the rest of the energy might get dumped into the Arduino.

To prevent this, put diodes in parallel with the relay coils, but orient them so that they're not normally conducting. When the coil de-energizes, the inductive kick is opposite in polarity, and it will flow harmlessly through the bypass diode, rather than beating up the transistor. It's essential to provide this free-wheeling diode on every relay or solenoid coil! Motors exhibit the same effect, btw.
Robot Lover2 years ago
I love it! You should probably put a 1k ohm resistor limiting the current to the base of each transistor.
adapt2 years ago
hey everyone post your tree's twitter handle so i can wake up on xmas and turn all your lights off/on/nutty
Awesome project, looks really neat and professional. Ive wanted to do something like this for years, but never thought of twitter integration. Truly ingenious, and much beyond my abilities, very good work.

However being an electrician, I just want to warn you of a few things. Your connections on the receptacles need a stak-on connector because their stranded (although that will work fine assuming no strands are moving around) but my major concern is the lack of a ground. Sure Christmas lights don't have them, but you never know what could happen, and I strongly recommend installing one. Or install receptacles that don't have a ground prong. And because your plugs are polarity specific, check your lines coming in. 110v on a neutral will destroy (sometimes violently) some equipment (as I learned when I modified a string of LED lights to fit in a non polarized plug, not pretty) Also, because you have 20A T-Slot receptacles, an your relays are only good for 2A, I recommend a 2A fuse for each plug, just to protect your kick ass project :)

I was also wondering why you opted for a 9V battery instead of an actual power supply such as a wal wart? It wouldn't be hard to place the transformer inside of the project box and connect 110v to it in there, so you still only have a lamp cord.

But Very good instructable. You covered every step thoroughly and made it easy for anyone to build this (which I'll be doing soon :)) keep the good ideas flowing and stay safe this Christmas.
@bobrigewitch  When someone states that they have credentials in a certain area, it implies that the information they give is accurate and truthful. Since your post contains incorrect advice regarding electricity, I am compelled to respond to set the record straight.

I happen to be an electronics engineer with electrical certification and 26 years in the industry. I will be as brief as possible, and will discuss only three of the assertions.

Ground - Your "major concern" with the project not having a ground is unfounded. Many appliances and consumer goods do NOT have a ground, toaster, coffee maker, shaver, vacuum cleaner etc. As you pointed out, the Christmas lights have no ground - there is absolutely no benefit or added safety from including a ground. Since you "strongly recommend installing one", please explain why.

Do you know why the ground pin is longer than the two flat blades on a 3-prong plug? It's so that the equipment's safety (ground) is last to be disconnected when unplugged.

Polarity - You stated "110v on a neutral will destroy...some equipment..."   
                              ***  This is 100% dead WRONG  ***   
There would not be a single piece of electrical equipment that would be harmed by having its neutral and "hot" terminals interchanged. With Alternating Current (AC) the polarity of plus-minus or positive-negative, is swapped back and forth 60 times per second. The only reason one terminal is designated as "neutral" is because it is electrically attached to ground at the distribution source that provides power to the building. The purpose of "bonding out" the neutral like that is purely for safety. Outlets/plugs with the larger slot/pin is to preserve this safety feature by creating a polarity scheme. For instance, a light fixture would have the shell of the socket connected to neutral in case someone's fingers touched the metal threads on the base of a lightbulb, in case the power was still on while changing it. Not all electrical devices make use of the polarity feature (it's optional) and you'll still see many plugs with same-sized blades. Polarised plugs are becoming almost the standard now, but that has more to do with plug fabrication reasons rather than the product's electrical requirement.

Fuses - I do agree that 2A fuses would be handy for each outlet, but the reason is entirely for the protection of the 2A relays, NOT because of the capacity of the outlets. Again, MANY household items do not contain fuses (toaster, vacuum, lamps), but many electronic devices do in order to protect ultra-sensitive circuitry, but those are not replaceable by the user.

My apologies for the long post, but people need accurate information when dealing with electricity.

VERY nice instructable by the way - well thought out and well documented with excellent pictures. A pleasure indeed.   ~Dave
I thank you for your criticism, I guess I wasn't clear enough on a few things, allow me to explain.

Ground - My concern with ground is that some appliances use a 3 prong plug, and those appliances have a ground because the engineer who designed it felt it should have one, and since his plugs have a 3 prong receptacle, it is possible that these grounded appliances would be plugged into this unit, therefore there should be a ground to accommodate for these circumstances.

Polarity - I agree 110v on the neutral and 110v on the hot will result in 0v potential, however incorrect polarity would mean there would be 110v on the neutral and 0v on the hot, resulting in 110v that is reverse bias. They design polarized plugs (one blade wider than the other) because some equipment can be harmed from this situation.

Fuses - your right, they would be more for the protection of the relays, however that directly corresponds to the load that can be placed on the relays. My idea was just "2A Protection"

I am new to this site and just thought I'd help. Also next time allow me time to defend myself instead of bashing my knowledge Dave. Merry Christmas.

Actually, in AC, polarity doesn't matter to the circuit.  AC is constantly switching polarity.  The best way to describe it is to use the physics concept of "frame of reference".  A person's body is usually grounded.  This means any voltages are relative to, or referenced to, ground.  This means that to us it seems neutral is 0 volts and hot switches back and forth between 110 and -110 volts.  The appliance is not referenced to anything, so to it, one wire is 110 volts higher than the other, and then they switch with each other.  It doesn't know which is hot and which is neutral.

The polarized plug is just for people's safety.  Since people are referenced to ground, neutral is safe at 0 volts to us while hot is dangerous at between +110 and -110 volts.  This way, engineers can make sure it is much harder for people to come into contact with hot wire than the neutral one since they know which will be zero volts relative to the user.
I guess your right there. Thanks for the clarification. Although my 'why' is wrong being sure of correct polarity still isn't a bad idea.
Robot Lover2 years ago
It totally says that this was submitted by radioshack on the great create website!
Lindie2 years ago
Very nice!
Grissini2 years ago
Sweet project as usual. I'm curious, why 2 arduinos and python rather than an ethernet shield or wifi shield. Also, thanks for using alot of easily accessible RadioShack parts. I'm kinda thinking that's why 2 arduino and a computer.
randofo (author)  Grissini2 years ago
I tried to stick with easily accessible Radioshack parts ;-)
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!