This Instructable is mostly about how to build the relay box, but the end result is a cool Halloween decoration. The great thing about the relay box we are going to build is that it can be used for any holiday light show. Can anyone say Christmas lights plus Trans-Siberian Orchestra ?
Total cost of the project is somewhere between $50 and $100.
SAFETY WARNINGThis project involves working with live AC currents that can kill you. Be very careful. If you don't know what you're doing, get someone who does to help you. I'm not a licensed electrician. I've wired a few outlets/switches, but I am no means an expert. I'll try my best to steer you in the right direction, but I'm not infallible. Please do comment if I've left a glaring safety risk.
Step 1: How this all began ...
Another motivation for myself was to "build a better mousetrap". The guides I saw online for building the singing pumpkin rig were sufficient to get the job done, but I saw a few problems with them. Mainly, they involved wiring the pumpkin's lamp directly to the relay board. This limits the relay board to just being used for the singing pumpkin set up. I saw the potential to use it for other purposes such as a Christmas light show, or just as a fun light show to go with your music at your next house party.
The desire to make the relay board reusable as more than just a singing pumpkin rig lead me to come up with the design in image 1. I hacked up extension cords and wired them to the relays. The pumpkin lamps/Christmas lights/whatever could be plugged into the extension cords. This design worked well, except I had a few concerns with it. 1. It wasn't very portable. The cords would get twisted and it was a bit heavy from all the wire. 2. Safety. With this design, you basically had to carry the rig by the extension cords. I was concerned that this would lead too a wire being pulled out of the terminal block. You really don't want an exposed wire with wall current flowing through it anywhere near you.
It was with all those concerns in mind that I came up with the design in image 2. It's nice and portable. It uses standard wall outlets as the AC voltage outputs so anything can be plugged into it. The outlets and the relay board are mounted to the project box so there is no concern of wires being pulled during transport.
A little bit about myself as it pertains to this projectI may make building this rig look easy. I'll try my best not to take some things for granted that others may not necessarily know. I do have a bit of an advantage in the area of skills required for this project. I have a BS in Computer Science and an AS in Computer Network Engineering. While earning those degrees I took a number of electronics and programming courses. My dad worked in construction for many years and has experience in home electric wiring. He also taught a number of the electronics courses I had in college. I used him for advise while building my rig. All that being said, I'm going to make the semi-safe assumption that avid readers of this website are intelligent people, like to get their hands dirty in projects like this, and are up for the challenge.
linksThese are the guides that I used as a reference when building my rig.
Step 2: About the relay board
It uses voltages from a computer's parallel port to trigger a bank of 8 relays. When triggered, the relays send voltage to whatever is connected to their terminal blocks.
Think of a relay as an electrical switch that is controlled by an input voltage. In our circuit, the input voltage is supplied by the PC parallel port. When a pin on the port is high, the relay switch closes. Two good explanations of relays can be found at:
bcae1.com (thanks makezine)
The relays in this circuit has three terminals. Image 2 shows the terminal block used to connect wires to the relay.
C = common. This is the terminal that is switched by the relay
NC = normally closed. When the relay is on, the voltage from the common terminal is sent out this terminal
NO = normally open. When the relay is off, the voltage from the common terminal is sent out this terminal.
You connect a wire to the terminal block by inserting the wire into the face of the terminal, and then tightening the screw on the top. Image 3 shows some wires in place.
Image 4 is another angle of the relay board.
Step 3: Gather your tools and supplies.
- Wire strippers
- Needle nosed pliers
- Various Screwdrivers
- Permanent marker
- Electric drill
- Dremel/rotary tool
I've split the supplies into sections based on what part of the project they go with.
- A parallel port relay board. $40 - $60 A couple of different sources:
circuitspecialists.com - we bought from this site
electronickits.com - sells assembled & tested boards
Or you can build one from scratch using these schematics.
- A DB25 male to female cable. This connects the relay board to the computer. Sometimes you'll see it called a "DB25 extension cable". I bought this one for about $11 with shipping. You might find one of these cables overpriced at a Radio Shack, but because no one uses parallel ports anymore Best Buy and Staples don't stock these. The length is up to you, I bought 6ft.
- A 12VDC power supply. This is to power the relay board. I used an 12V@1A AC adapter from an old scanner. You may be able to buy one from the same sites that sell the relay board.
- A computer with a parallel port. A laptop is preferable for portability, but laptops with parallel ports are hard to come by these days. There are USB "parallel ports", but I could not get mine to work with the software I used. More on that later.
- Speakers to blast the music to the world.
- Software that will play music and send data out the parallel port to trigger the relays. I used Winamp with the Discolitez plugin, but I'll cover the various other software that I've seen in my travels.
- Some artificial pumpkins with built-in lamps. We bought ours at Target and Walmart. We went to both stores because there were not enough different faces at a single store. Prices were $5 - $10 each.
- If you're adventurous, you can buy artificial pumpkins that you carve yourself at an art & crafts store like Micheal's. If you go this route, or you cannot find pumpkins with built-in lamps, you'll need to also buy/build lamps. You may be able to buy the lamps at the same arts & crafts store. Or you could build lamps by using extension cords with night lights plugged in to them.
- A project box. This will be used to house your project. I used Sterilite Large Clip Box purchased at Target for maybe $6. I picked it because it's made of nice sturdy plastic, had a nice snap lid, and was the perfect size/shape. There are project enclosure boxes sold for use in electronics projects. I wanted to go with something more readily available in any local super-store.
- 8 electrical outlets/receptacle from a hardware store. I got a 10 pack for less than $4 at Lowes.
- 1 cheap wallplate cover that matches the shape of the outlets you buy. We're going be using it as a stencil, so quality doesn't matter. Less than $1.
- An extension cord. I'm really not sure if it needs to be grounded. I didn't use a grounded one and nothing blew up. $1.50
- Electrical wire. We're not switching huge currents, so we don't need anything too thick. Stranded wire will be easier to work with than solid. I find a good cheap source of electrical wire for projects like this are grounded extension cables. I'll just cut up an 100ft cable, and have 3 lengths of nice copper wire for cheaper than I could buy from a pay-per-foot spool. Plus the ends of the cable are handy for other projects. You just have to watch out because some cheaper cords don't always have the ground cable even though they have the ground pin on the plug (I don't know how these are legal to sell). Note: it's probably a code violation to use wire like this.
- Some 6/32 hex nuts. I only used 20 nuts, but I bought a box of 100 for about $2. (hardware store)
- Some 1/2" 6/32 machine screws. I only used 4. (hardware store)
- Some wire connectors like these. (hardware store for a couple of bucks)
Step 4: Prepare the project box.
1. Provide a stable mount for the electrical outlets.
2. House all the wiring for the project.
3. Make the whole relay box easily portable.
So let's kick off this project by preparing our project box.
Make the outlet mount holesThe outlets will be mounted to the box. We need to make some holes for the outlets to come out of.
1. Flip the box upside down, we're going to put the holes on the bottom of the box.
2. Use the wallplate cover as a stencil and trace out a template for the holes. Trace out 8 sets of outlet holes. I left about an inch between each outlet. Use a permanent market so that the ink won't smudge. (image 2)
3. Use a power drill to put a starter hole in each outlet hole. Leave the lid on the box. It will help catch any plastic trash that falls through. (image 3)
4. Cut out the outlet holes. I used a Dremel with sanding bit to cut out the plastic for each hole. I tried a cutting bit, but it was too bouncy. The plastic will melt into little blobs of snew (snew - a word my dad uses for random gunk). Be careful, the blobs can be hot when they're fresh. I found that even after sanding out the plastic around my template, the outlets still wouldn't always fit. Just sand away more plastic until it fits. (images 4 & 5)
5. We will eventually mount the relay board to the project box using 4 screw holes on the relay board.
5.1 Determine where you want to mount the board. I mounted my board to the lid of the box since it was really the only place to put it because of the size of my box.
5.2 Lay the relay board flush on your box and mark the screw holes with a permanent marker.
You may change your mind where you want to mount the board, so wait to drill out the holes.
6. Have a beer (image 6)
Step 5: Prepare the wiring.
A note on wire colorsGuess what kids, electricity doesn't care about the color of the wire's insulation (the plastic wrapper around the metal wire). Wire colors are used to define standard wiring practices. The standards exist so that any electrician can walk into any house and know which wire is connected to which contact. That being said, never assume that someone has followed the standard. Always check your wires with a multimeter. Also, wire color standards may differ by geographical location.
In this project, I tried to follow the color standards used in the US. I did make some adjustments for various reasons that I'll try to explain. As I said, electricity doesn't care about wire color, but for your own sanity/safety, I suggest you use 3 different colors of wire.
Cut and strip the wire(image 1 shows the cut and stripped black & white wires)
1. Cut the following lengths of wire (lengths are approximate, you may need more or less):
8 pieces of white wire 10" in length.
8 pieces of black wire 10" in length.
2 pieces of black wire 4" in length.
8 pieces of green wire 6" in length.
2 pieces of green wire 4" in length.
2. Strip the insulation from the wires in the following manner:
10" and 4" black wires: strip 3/4" from both ends of the wire.
10" white wires: strip 3/4" from one end of the wire, and strip 1/4" from the other end.
6" green wires: strip 3/4" from one end of the wire, and strip 1/4" from the other end.
4" green wires: string 3/4" from both ends of the wire.
Wire the outlets(image 2 shows the back of an electrical outlet)
I don't feel confident enough in my knowledge of home wiring to give an overview of wiring an electrical outlet. If you really want to know how to do that ask Google or call an electrician.
A very very brief explanation of the contacts on a outlet:
Hot = the contact with the fresh electricity. Typically the black wire goes here. Usually indicated on the outlet with gold colored screws.
Common/neutral = the wire with the "used" electricity. Typically the white wire goes here. Usually indicated on the outlet with silver colored screws.
Ground = the contact that goes to ground. Typically the green or uninsulated wire goes here. Usually indicated on the outlet with green colored screws.
You connect a wire to the outlet by wrapping the exposed copper wire around the contact screw and screwing in the screw until the wire is held tight.
Take each outlet and wire as follows:
Wire the 3/4" end of a single white wire to the common terminal of the plug.
Wire the 3/4" end of a single black wire to the hot terminal of the plug.
In this project, we won't be using the ground terminal.
(image 3 shows the finished wired outlets)
Build a wire spiderI've got no clue what this thing would be called, lets call it a wire spider. Essentially, it's a group of connected wired legs that are held together with a wire-nut body.
(image 5 shows the finished wire spiders)
1. Line up four pieces of 6" green wire and one piece of 4" green wire with the 3/4" stripped end all facing the same direction.
2. Take two wires and twist the 3/4" stripped ends together. Do this again with another pair of wires.
3. Finally, put all five wires together and twist the wire-nut over top. Your spider is done. Pull on the spider's legs and make sure your connection is nice and tight.
(image 4 shows two pairs of twisted wires ready have a wire-nut screwed on)
4. Build another wire spider using the other five green wires that you cut.
Eventually, the two 4" legs of both spiders will be connected together with another wire-nut, but not yet. This may lead you to ask, why not build a big wire spider with eight wires? The answer to that is pretty simple. It's difficult and unsafe to put too many wires inside a single wire-nut. Wire-nuts are rated for how many wires of a certain gauge can be held together with the nut. (I may have broken some of those ratings while building this project.)
Step 6: Mount the outlets to the project box.
Template and drill screw holes
Electrical outlets usually come with a pair of 1" 6/32 screws. These screws are normally used to mount the outlet to a outlet box. We're going to use these screws and a 6/32 hex nut to mount the outlets to the project box.
First we have to draw some templates for where to drill holes in the box for the screws to go through.
1. Place an outlet in each outlet-hole in the project box. The outlet should face the outside of the box.
2. Looking overhead of the outlet and box, draw a dot on the bot above each of the screws.
3. After you've drawn all the dots, take the outlets out of their outlet-holes, and then drill holes through all the dots. Use a bit that is large enough for the screws to pass through, but small enough from letting the screw heads through.
4. Put the outlets back in their holes. Put the screws through their holes. Tighten a nut over the screw from the inside of the box.
5. Finally, build two more wire spider using the black wires connected to the outlets as the spider's legs. Don't forget to add a short leg to each spider using the 4" black wire that you cut earlier.
The relay box is coming along nicely. Next step ... wiring up the relay board to the outlets.
Step 7: Wire up the relay board to the outlets.
Image 2 shows a diagram of how the relays and outlets will be wired. For brevity, diagram only shows three relays and outlets, but there are eight total.
1. Connect the 1/4" stripped ends of the eight longer legs of your green wire spiders to the relay's C terminals. The order that you connect the green wires to the C terminals is not important since they are all tied together in the wire-nut. Image 3 shows the terminal blocks with the green wires in place.
2. We are now going to connect the white wires from the outlets to the NO terminals on relay board. The order in which we connect each wire to each terminal is important. This is because the relays correspond to a certain channel on the parallel port. It makes life a lot easier if you know which outlet on the box corresponds to which channel.
1.1. Label your outlets to mark which channel they will correspond to. Image 4 shows how I labeled my outlets.
1.2 Connect the 1/4" stripped end of a white outlet wires to the NO terminal on the terminal blocks. Make sure you wire to the correct channels.
Connect the extension cord
We're going to cut up an extension cord to provide the AC voltage that will be switched by the relays. I used a two-pronged ungrounded cord.
1. Cut the extension cord leaving approximately 1 foot of cord at the outlet end. We will be using both ends of the cord. The plug end will plug into a wall outlet and power the relay box. The 12V DC power supply will plug into the outlet end. It's actually optional to have the extra AC outlet built into the box, but I found it useful to only have one cord to plug in to the wall.
2. You should be able to split the two wires of the extension cord by gripping each wire with a pair of pliers and pulling them apart. Split the wires a few inches.
3. Strip 1" of insulation from the ends of each wire.
4. Have you ever wondered why prong on the extension cord is larger than the other? That's because the cord is polarized. Modern wall outlets have matching long and short plugs that will only accept the plug the correct way. This is to ensure the device you are plugging in is connected to the correct hot and neutral terminals. We want to make sure our circuit is connected to the correct terminals when we plug it in. We are going to mark the wires on the extension cord so we know which terminal they connect to. This next step is going to require knowledge of how to use a multimeter.
4.1. Take a multimeter and set it to continuity tester mode.
4.2. Connect one probe to the smaller prong on the plug end of the extension cord. The smaller prong is the hot terminal. The longer prong is neutral.
4.3. Use the other probe to determine which of the stripped wires is the hot wire and mark the insulation.
4.4. Determine which wire is the hot terminal on the other cut of the cord. You should be able to make contact with the wire inside the outlet by jamming your probe inside.
CAUTION: Don't cut corners. You may be tempted to not use a multimeter and instead just follow the two separate wires to the ends of the cord and assume that the wire on the left must connect to the prong on the left. This is a very unsafe practice when working with electricity. Never make assumptions. Another example, when working with a power supply don't assume that it's listed output voltage is 100% correct. I've seen them be wrong before. Always measure!
5. Using a wire-nut, connect together the two neutral wires from the extension cord to the two 4" legs of the green wire spider. This also completes the circuit between the two green wire spiders.
6. Repeat step 5 with the two hot wires from the extension cord and the two 4" legs of the black wire spider.
Image 6 shows the two black wire spiders connected together by their 4" legs. The image is missing the extension cord wires. I accidentally capped the wires and took the picture before I realized my mistake.
7. Wire the outputs of your 12V DC power supply to the relay board's input terminals. Use your multimeter to determine which output wire is positive and which is negative. Image 7 shows the board's input terminals with wires in place.
Step 8: Confirm your wiring and finishing touches
Confirm your wiring
The box is essentially done at this point. All the wiring is complete and you could plug it in to the wall and computer and test it. However, with any electronics project, it's always a good idea to confirm all your wiring. This page will cover the connections that you should test.
We will once again be using a multimeter in continuity mode. Perform the following tests:
1. NO terminal on relay X = Longer plug on outlet X
1.1. Connect one probe to the NO terminal on relay 1.
1.2. Connect the other probe to the long plug on outlet 1 and confirm continuity.
1.3. Repeat for all the other relays and plugs.
2. Short prong on AC input extension cord = Short plug on every outlet
2.1. Connect one probe to the short prong, then move the other probe to the short plug on each of the outlets and confirm continuity.
3. Long prong on AC input extension cord = C terminal on cevery relay
3.1 Connect one probe to the long prong, then move the other probe to each C terminal and confirm continuity.
There are a few more finishing touches to do.
Cut an wire exit hole
1. Determine where on your box you want the wires to come out, and draw some marks (image 2). You can get away with cutting a small hole near the lid of the box and just run the wires under the lid.
2. Cut out the hole with your Dremel. I decided against cutting into the lid itself; I didn't want to damage it since it's made of thinner plastic. (image 3)
Mount the relay board to the project box
1. Drill out the relay board mount holes that you marked on your box earlier. It will be difficult to mark the holes at this point due to all the wires everywhere.
2. Use some screws and nuts to mount the board. I used the 6/32 screws and nuts from earlier. I had to enlarge the screw holes on the board a little bit with my drill. If you do this, be careful not to destroy any traces on the board.
Image 4 shows the mounted board from the underside.
Congratulations! Your box is done. Reward yourself with another beer, hopefully something a little better than a Yuengling. I really like Golden Monkey, but it's 9.5% ABV makes working with electronics a little hard.
Next page, lets get some software installed to control this bad boy!
Step 9: Set up your software
In my travels, I found that people use two different models for creating music/light shows. I'll call one model "scripted", and the other "interpreted".
The interpreted modelThe interpreted model is easier to set up quickly, but the results don't necessarily look as good. In this model, the software listens to various properties of the music as it plays and interprets what channels on the relay board to activate. This is the same principal used by the visualizers on your favorite media player software. Think of this model as the plug-n-play solution. The same software will play the music and send data out the parallel port.
The results won't look horrible, but it really depends on the song. I used "This is Halloween" from the film "The Nightmare Before Christmas" in my example movie. It came out pretty well. Some other songs don't work as well. On some songs, the lights didn't really blink that often so the illusion of singing was lost. You may be able to mitigate this issue by configuring your software better.
The scripted modelIn the scripted model, the task of determining what channels to activate is done by a human. You use a piece of software that will play the music to you while you tap on your keyboard when you want to activate a channel. The software will record your tapping. This can be time consuming since you will have to listen to a song multiple times to tap out the sequences for each of the 8 channels. You will use the same software to play back the music to your speakers and the data to the relay board. If you're good, you can get pretty decent results using this method.
The hybrid modelThere is actually one more model. It's actually a mix of the two. It involves recording your own vocal track of a song. Then you use software to write a script by interpreting your vocal track. A vocal only track is used so that the software doesn't interpret any instruments in the music as voices. The illusion of the singing pumpkins is increased because the pumpkins will only flash to the vocal track. I read about this model at HalloweenForum.com
What did I do?I decided to go with the interpreted model. I did this for a couple or reasons in no particular order: laziness, time constraints, it looked good enough to me, we could have a wider selection of songs more easily.
For software, I used Winamp combined with the DiscoLitez plugin. The plugin works like a visualizer, except it sends data out the parallel port as it interprets the music. On the website, there are a couple of different version of DiscoLitez. The Winamp plugin is called "DiscoLitez Standard". There is a Pro version that looks pretty cool, but I couldn't get it to work and didn't have time to debug.
I ran into a small problem with DiscoLitez at first. Every time I tried to use it, Winamp would crassh. It turns out that Windows XP has some security policy where software cannot talk to the parallel ports unless it has special permissions. I also had to use a program called PortTalk. PortTalk works by somehow giving the needed permissions to program that wouldn't otherwise have them. In my case, I had to give these permissions to Winamp. So, I launched Winamp through PortTalk. I made a batch file that contained the command line:
allowio "C:\Program Files\Winamp\winamp.exe" /a
This is a good guide for setting us DiscoLitez and Winamp.
I went with the Winamp/DiscoLitez setup mainly due to time constraints. It does the job, but does leave a bit to be desired. Here are some programs I saw while doing research. I may upgrade to one of these in the future.
Vixen - Very mature freeware program with many features and plugins. From what I saw, it uses the scripted model. Large community of enthusiastic users. I suggest you check out the wiki.
VSA - A $60 commercial application seen in other singing pumpkin rigs. They offer a demo version on their website for download. I did not test it myself. It appears that the software uses the interpreted model, and then lets you customize the script ... so I'd call it a hybrid model.
DiscoLitez Pro - Freeware. This is a standalone version of DiscoLitez. It appears to be completely interpreted model, but you have a lot more control over how the music is interpreted than with the Standard version.
Lightning - Freeware. Another interpreted model program very similar to DiscoLitez Pro.
Here are some future enhancements that I'd like to implement one day.
Figure out how to get the relay box to work with a USB parallel port. Newer laptops don't usually have parallel ports.
Improve illusion of singing.