Want a Christmas tree that reacts to the ambient sound level in your living room? How about one that lights up with the beat of your favorite Christmas song without the need to run an audio input to the tree itself? How about a tree that reacts in time with the conversations taking place around it? This is your tree!
This tree acts as a "VU meter", like the ones on the graphic equalizer of some receivers, or like KITT's voice box in the Knight Rider TV series. It uses a plain old electret microphone as an input driving a solid state relay board. There's a sensitivity adjustment which will allow you to customize the circuit for your particular setting, and there's a bypass switch for when you'd rather just have the lights fully on. I dub it the "My Family is Sick of It Switch".
Bill of Materials
Solid State Relay (SSR) board
- MOC3041 (or equivalent) optocouplers x 6
- BT136-600 (or equivalent) triacs x 6
- 150Ω resistor x 6
- 330Ω resistor x 6
- 2 terminal PC board connectors x 8
- 6 foot extension cord x 6 (Dollar Tree had these at $1 apiece)
- Wire nuts
VU driver board
- AN6884 VU meter IC
- LM324 quad op-amp IC
- 2N3906 PNP transistor x 5
- 2.2uf capacitor
- 0.1uf capacitor
- 10kΩ resistor x 2
- 4.7kΩ resistor
- 100kΩ resistor
- 330kΩ resistor (and possibly some alternative values in the 40-500kΩ range)
- 10kΩ potentiometer (variable resistor)
Step 1: Solid State Relay Board
This part of the project was taken from this excellent Arduino driven Christmas lights Instructable. Detailed instructions and schematics can be found there. I used beefy triacs simply because I had them in my parts bin. You can certainly use smaller, less expensive triacs if they are available to you. Likewise with the optocouplers. I used MOC3041 optocouplers because I had them. They're beefy for optocouplers, and you can use less expensive ones if you so desire. You're just driving the gates of the triacs with them.
A safety warning is in order. You are using mains power here, and it is deadly. Keep in mind if you use a triac like the BT136 series, the mounting tab doubles as a main terminal! Do not touch the metal tab when your SSR board is plugged in, and carefully read the datasheets for everything on this board. I'm not trying to scare you off--it's a safe, fun build, but it does involve the mains.
As a tip, superglue will very nicely and strongly secure the blue terminal blocks to the protoboard. I also placed my resistors vertically to save space. In short, a positive signal to the optocoupler terminals will trigger the triacs, and activate anything attached to them. An optocoupler contains an LED, and the input signal has to be have a voltage greater than the LED's forward voltage, but not so great as to provide an overly large current. The 330Ω resistors assume you will be providing around 5-9V.
Finally, this board is reusable. It will interface nicely with an Arduino, for example.
Step 2: Attach SSR Board to Box and Add Cords
Affix your SSR board to the bottom of your hinged box. I used some enameled wire, ensuring that it was nowhere near the mains power, despite being insulated. I first pressed a thumbtack through a convenient protoboard hole and through the box bottom. I repeated this outside of the protoboard, and then fed a piece of u-shaped enameled wire through the holes, and twisted the ends on the bottom of the box. I repeated this process for the four corners of the SSR board.
Cut the socket end of your six extension cords, leaving at least a foot of wire. You can leave more, or even stagger the lengths of cord. Your Christmas lights will plug into these sockets, so you may want to plan now for their eventual placement on your tree. Reserve one plug end for power.
Strip about 1/4 inch of the insulation from all six socket ends and the reserved plug end.
Cut or drill holes for the cords on the side of the box adjacent to the SSR main power terminals. For added peace of mind, I cut my holes on three sides, and left a flap of the box to keep the enclosure as, well, enclosed as possible. Tie a knot in each cord, leaving enough wire to attach to the terminals. The knot prevents the wires from being pulled through without stressing the connection at the PC board terminals.
Note that your extension cords have one smooth wire and one ribbed wire. The smooth wire is the "hot", or current-carrying wire. This is the one we'll be switching. You can switch the ribbed neutral wire, and everything will still work. However, it is safer to switch the hot wire, as that stops the current flow before it enters the circuit. Therefore, attach the smooth ends of your six sockets to the six triac terminals, and attach the smooth end of the plug cord to the common triac terminal. Also note that if you have an older non-polarized cord (both blades the same size) it doesn't matter which cord you attach, because you could plug it in either way!
Connect all the neutral wires together using wire nuts. I cut some additional pieces of wire from one of the spare plug ends and bunched things together in fours and threes, because it is very difficult to connect 7 wires together using a single wire nut. Note that you can bunch your socket neutral wires together and attach them to the free terminal on the SSR board, and then attach the plug end's neutral wire to the same terminal. That's what that free-floating terminal is there for. I opted to just tie them together with nuts, and left that terminal unused.
Congratulations. You know have 6 controllable power sockets. If you haven't done so already, I would highly recommend testing the SSR board at this point.
Step 3: Build the Driver Circuit
The heart of this circuit is the AN6884 IC. If you look at the datasheet, you'll see it's just 5 comparators in series. This IC is designed for lighting LEDs, not for controlling another circuit. That's just what you're doing though, because the optocoupler is simply an LED coupled with a photoresistor in the same plastic package.
The one caveat is that we've set our SSR board up to trigger on high signals, but the AN6884 outputs a low signal! If we feed the output of the AN6884 into the bases of 5 PNP transistors set up in the common emitter configuration, we can invert the output. Finally, a use for all those PNP transistors that you never seem to use for anything else.
The input to the AN6884 is an electret microphone. The microphone is biased and high-pass filtered. But it's too weak to drive the AN6884, so we first run it through one of the op-amps on the LM324 quad op-amp chip. Remember, the amplification level of an inverting amplifier like the one in this circuit is determined by the ratio of the feedback resistor to the input resistor. Our input resistor is 10kΩ. I experimented a little here. I initially tried a feedback resistor of 47kΩ, but was unsatisfied with the sensitivity of the circuit. I eventually settled on a 330kΩ resistor. The amp oscillates a little, but I don't mind. Finally note that the sensitivity is also controlled by the 10kΩ potentiometer attached to the AN6884's input. This gives you some on-the-fly sensitivity control in the event of changing ambient noise level. If you don't like how the lights flash at a steady volume level, you can place some capacitors across both the feedback and input resistors. You'll want to make sure they're properly balanced, though.
The other key feature here is the switch. It bypasses the mic and feeds 9V directly to the AN6884's input, turning it full on. That's a nice feature for when you'd just like the lights on, after the VU novelty wears off.
Step 4: Mount Everything in the Box
I mounted the driver board to the side of the box using enameled wire as before. I cut holes for the barrel jack and the switch on the front of the box. The jack came with a nut to secure it. I hot-glued the switch in place. I cut a hole in the top of the box for the microphone
I used headers for the driver output, the power inputs, and the switch to make assembly and disassembly easier. This was especially helpful as I prototyped and adjusted everything.
Step 5: Set Up Your Tree
I used short 50 bulb light strings in white. You can use various colors, additional lengths, etc. I recommend using traditional minilights rather than LEDs because the traditional lights will naturally fade on and off. The LEDs will abruptly turn on and off, which may be a neat effect in and of itself.
Wrap the tree in layers, and plug the lowest layer into outlet 1, and so on.
You can wrap the control box in festive paper to make it less conspicuous under your tree, and you can hide the mic inside a big bow. You just have to explain to your sharper-eyed guests why one of the gifts is plugged in.
"AHA!" you say. "What about the sixth cord?" Yes. The AN6884 only has 5 outputs, and our SSR board has six inputs. You can do what you like with the sixth. Perhaps attach the input to 9V and have a set that's always on. Or ignore it. Or build your SSR with only 5 relays. I only included the sixth to be consistent with my reusable board. I thought it would be confusing to provide photos of six SSRs with build instructions for 5.