Introduction: Motion Controlled Light Show

About: Not a hacker, just a hack.
The idea for this project has been knocking around inside my head for the past few years. I finally decided to get off my butt and do it. Be warned: it is a long instructable because it's a multi-part build, and I'm a bit verbose when writing these things.
This whole project developed out of a color organ that inspired additional complexity and more features. The finished product creates a motion-controlled light show synchronized to an audio source. It started off small - just a color organ - but rapidly grew to take on new features and to incorporate more complexity. I just wasn't satisfied with blinky lights. It had to be spinning blinky lights that are super bright. It's similar to those commercial rigs that you've probably seen. I could have just picked up a system like that, but any time I can make something instead of buying it, I'll opt for the maker mentality!

I would place the difficulty of this project in the intermediate category. There isn't a whole lot of programming involved, but you'll need to do some careful soldering work or (if you're equipped) make your own PCBs to finish the project. I did everything on proto-board, but in retrospect, it would probably have been easier to troubleshoot if I had taken the time to make some custom PCBs for everything.

From start to finish, this project took several months (although that included experimentation and waiting for parts to arrive from China). If you aim to just make a copy, and not experiment at all, it should take you significantly less time, although I wouldn't try and do it all in one sitting!

You will need to draw on a variety of skills, including: soldering, programming arduino, building a circuit on perfboard, and trying not to blind yourself by looking directly at the LEDs. I'm still having trouble with that last one...

Inspiration for this project was found in many different places. I will attempt to list all of them here. If I missed any, my apologies, and just add a comment so I can give you credit!


Step 1: General Parts List

This project took several steps to complete, and I worked on it over the course of a few months. I built it up in stages, so I have broken this instructable up into stages. I will give the overall parts list here, broken up by each mini-project, and I will reiterate the parts necessary for each step.

If you approach it as I did, you can space out the purchases of all the parts you need. Another strategy which helped me save quite a bit of money on parts was to scavenge old electronics (which I've been doing for the past few years). My main source for components is eBay - if you plan ahead, you can get quite a bargain! When I'm not in a hurry, I don't mind waiting 4 to 6 weeks to get 100 transistors for a buck...

Color Organ circuit (to convert audio to analog light signals)

Miscellaneous parts:
  • Quad Op Amp (I used an LM324)
  • 14-pin DIP socket
  • 3 200K variable resistors
  • 3 NPN transistors (I used PN2222)
  • 3 LEDs of your favourite colours (I started with red, amber, and blue, then switched to diffused green after I saw spots when checking the response of the circuit).
  • 3 current limiting resistors matched to your power supply and choice of LEDs.
  • 3 general purpose diodes (I used some from my parts bin. I have no idea what they are. The project suggests 1N4002)
  • a headphone extension cord (from the dollar store)
  • perfboard
  • pin headers: 3 pin male header, 2 pin male header, 2 pin female header, 4 pin female header (I cut mine from a larger header)
  • hookup wire in various colors

Resistors: (I used mostly 1/4 watt, and a few 1/8 watt with no problems)
  • 8 x 1 MOhms (brown-black-green)
  • 3 x 100 KOhms (brown-black-yellow)
  • 3 x 33 KOhms (orange-orange-orange)
  • 1 x 4.7 KOhms (yellow-purple-orange)
  • 3 x 1 KOhms (brown-black-red)
  • in case you missed it above, you'll also need to include 3 current-limiting resistors matched to your LEDs and supply voltage)*
Polarized Electrolytic Capacitors:
  • 1 x 47 uF
  • 1 x 4.7 uF
  • 3 x 10 uF
  • 1 x 0.22 uF
  • 1 x 0.1 uF

Ceramic Disc Capacitors:
  • 1 x .1 uF (104)
  • 2 x .01 uF (103)
  • 2 x .0022 uF (222)
  • 2 x .047 uF (473)

High Power LED strobe light
  • 555 Timer
  • 200k trimpot
  • 2N2222 transistor
  • N channel mosfet (I used a spare IRF020)
  • 0.01 uF ceramic capacitor
  • 10 uF electrolytic capacitor
  • Resistors (4K7, 1K, 100K, 1 Ohm 1/2 watt)
  • 3 x 1W high brightness LEDs
  • Heatsink or metal plate to mount the LEDs.
  • Thermal compound

High Power LED drivers
  • 1 x CD4066 4 channel analog switch
  • 9 x IRFZ44 N-Channel MosFet (probably overkill - anything that's rated for a few amps should be sufficient)
  • 9 x 2N2222 NPN transistors
  • 9 x 2N2907 PNP transistors
  • 9 x 2.2 Ohm 1/2 watt resistors (make sure they're half-watt, or you might risk burning the circuit)
  • 9 x 10 K Ohm resistors (these can be 1/4 watt with no problem)
  • 9 x 1M resistors
  • Male and female pin headers
  • Perf board
  • 9 High power RGB LEDS (I used 6 lead LEDS to give me more flexibility in design. You can use common anode if you want).
  • 9 Aluminum heatsinks for the LEDs
  • 9 1/2" Copper pipe end caps (as additional heat sink)
  •  Electrical tape
  • A ready supply of stranded-core wire (this allows the wire to bend with the movement of the lights) 
Servo Trigger Circuit
  • LM358 Op Amp (pretty much any op amp should work)
  • 2 x 10K resistors
  • 10 uF capacitor
  • optional variable resistor to adjust sensitivity without changing any code.
Arduino and Servo Shield
  • Arduino Uno (I used a different brand due to shipping cost, but choose whichever you prefer)
  • Renbotics Servo Shield (or, if you don't mind changing the code, the Adafruit 16 channel PWM servo shield)
 *if you do end up doing this project with the Adafruit shield, please let me know so I can add your code to this 'ible*
  • Random lengths of hook up wire. I tend to get mine in the liquidation section of the electronics store, where they have random off-cuts of multiple conductor wire.

Another bonus to waiting for parts to arrive is that it gave me time to play around, refine the design, and really plan out what I wanted to achieve with this project. However, there was also a drawback - as I waited, I dreamed up ways of making the finished project more complicated. Thus the extremely long instructable.

Step 2: Tools

This project uses a pretty basic set of hand tools. If you don't have these, well, I'm surprised, actually! Go buy them, borrow them, or make them. I have a garage full of tools, and I didn't end up needing many of them for this project!
  • Solderless breadboard
  • Needle-nose pliers
  • Utility knife
  • Side cutters
  • Helping hands
  • Soldering Iron
  • Solder
  • Heatshrink
  • #0 flathead screwdriver (to adjust the variable resistors)
  • drill & bits
  • optional wire strippers. I don't own 'em, and I make do with my utility knife. More of a multi-tasker, you know?

Step 3: Make the Connector Cable

I'll start with this step, as it's pretty easy. You need to find a way to inject the audio source into your circuit, while still letting your speakers be connected! There are all sorts of ways of doing this. You could get two audio jack connectors, and a male-to-male cable. You could use RCA jacks and matching cables. Really, how you choose to do it is up to you.

I chose to buy a "headphones extension cable" from my local dollar store. It was only two bucks.

Bring home your cable, and find a spot in the middle, and cut that sucker up! Don't worry, this is really hard to mess up, and if you really make a mess of it, you can just cut a bit more off your cable and start over. If it really goes badly (and I can't image anything of that magnitude happening), you'll only be out two bucks, and it would probably be a good idea to practice with a smaller project before tackling this one!

Once you've cut it, identify the wires for right, left, and ground. Mine was happily color coded - red for right, grey for left, and black for ground. Put the two cut ends together, and slide a piece of heatshrink over the cable. Strip each wire, add some heatshrink, and solder the ground to the center of the 3 pin male header, and left and right to either side (which side you choose makes no difference - just make sure ground is in the middle). Then tidy up your work by heating the heatshrink. Doesn't that look nice and professional!

This cable will connect to your audio source (iPod, computer, gramophone, whatever you're using) on one side, and to your amplifier on the other side. If you're using a different audio source or amplifier, choose an appropriate cable.

I decided to go this route because at my local electronics shop, audio jacks were a buck a piece, and I'd still need to buy a hook up cable for each side of the project. Total cost would be 6 bucks - the dollar store version was only 2 bucks. Possible drawback? These things are usually ultra-cheap and may not stand the test of time.

Step 4: Modified Color Organ

Color Organ Parts List:

*please note* the color organ circuit was built and tested using a 12V wall wart, which actually outputs around 16 volts. Make sure your parts are rated for the power you're using. The author will not be held responsible for any exploding capacitors or magic smoke released from chips or transistors.

Miscellaneous parts:
  • Quad Op Amp (I used an LM324, but any should do)
  • 14-pin DIP socket
  • 3 200K variable resistors
  • 3 NPN transistors (I used PN2222)
  • 3 LEDs of your favourite colours (I started with red, amber, and blue, then switched to diffused green after I saw spots when checking the response of the circuit).
  • 3 current limiting resistors matched to your power supply and choice of LEDs.
  • 3 general purpose diodes (I used some from my parts bin. I have no idea what they are. The project suggests 1N4002)
  • a headphone extension cord (from the dollar store)
  • perfboard
  • pin headers: 3 pin male header, 2 pin male header, 2 pin female header, 4 pin female header (I cut mine from a larger header)
  • hookup wire in various colors

Resistors: (I used mostly 1/4 watt, and a few 1/8 watt with no problems)
  • 8 x 1 MOhms (brown-black-green)
  • 3 x 100 KOhms (brown-black-yellow)
  • 3 x 33 KOhms (orange-orange-orange)
  • 1 x 4.7 KOhms (yellow-purple-orange)
  • 3 x 1 KOhms (brown-black-red)
* in case you missed it above, you'll also need to include 3 current-limiting resistors matched to your LEDs and supply voltage*

Polarized Electrolytic Capacitors:
  • 1 x 47 uF
  • 1 x 4.7 uF
  • 3 x 10 uF
  • 1 x 0.22 uF
  • 1 x 0.1 uF

Ceramic Disc Capacitors:
  • 1 x .1 uF (104)
  • 2 x .01 uF (103)
  • 2 x .0022 uF (222)
  • 2 x .047 uF (473)

I had most of these parts on hand, scavenged from old electronics. If you need to purchase parts to build your own, you can either buy the kit from Jameco (but please pay careful attention to how I've modified the circuit!), or source parts from your favourite supplier. If you have to buy all the parts, please let me know what it cost you! I can't give an accurate cost estimate... Sorry. Maybe 15 bucks? 5 bucks? 40?

Step 5: Color Organ (PT II)

I started with the color organ from Make Magazine's great schematic. I laid it out on a breadboard, then played with it for hours. Watching those three little LEDs light up with the music was very satisfying, but eventually (as with all my projects), it just had to be bigger, stronger, and more powerful! And, of course, more complicated.

Take a look at the schematic, then put it all on a breadboard and test it out. Choose either the right or left channel as input, and connect the center pin (ground) to the ground on your breadboard. Put on some of that top 40 stuff with a beat, and check it out. Be sure to play with the behaviour by changing the settings of the variable resistors. Once you're happy with the result, assemble the final version on perfboard.

I tried out Virtual Breadboard's VBB Express to create a layout, then copied onto my actual breadboard. I'm sure there are better software solutions for doing this (I'm taking the opportunity to try out new tools with this project).

I created the schematic using CADSoft Eagle, but it's my first attempt. Thus, there are likely problems in the file somewhere (especially if you intend to use it to create a PCB). Caveat Emptor! If you come across any problems, or you end up making a PCB layout with the eagle schematic, please post in the comments so I can add it to the instructable (giving credit to you, of course!)

/* A little bit about the circuit follows. You're welcome to pretend you're a compiler, and just ignore this...                     
 * I recommend you play with the capacitors when you've  got the circuit on a breadboard,
 * and find something that suits your taste. In fact, play with a bunch of things. If 
 * you end up completely messing up your circuit, you can always start again from the diagram. Trust me - I did
 * that more than once (and a few times on the perf-board, which was not fun!)
 */


Step 6: Strobe Light (optional)

Okay, that last part was intense! Now let's give ourselves a bit of a breather by trying something a little less complicated for the next step.

I had a strobe light I had built previously kicking around, so I decided to incorporate it into the finished design. The parts list is pretty small, and it's a pretty straightforward circuit. I know it's poorly designed (I'm pretty sure I'm far exceeding the current rating of the 555 timer, but meh).

If you have the parts on hand, you can build it. If not, you can always add it later. If you really don't want to have a strobe light, then just ignore this whole part.

Parts
  • 555 Timer
  • 200k trimpot
  • 2222 transistor
  • N channel mosfet (I used a spare IRF020)
  • 0.01 uF ceramic capacitor
  • 10 uF electrolytic capacitor
  • Resistors (4K7, 1K, 100K, 1 Ohm 1/2 watt)
  • 3 x 1W high brightness LEDs
  • Heatsink or metal plate to mount the LEDs.
  • Thermal compound (probably a good idea, but I'm still waiting for mine to arrive. There seems to be good heat dissipation through the aluminum plate the LEDs are mounted to without it).

Throw it together, plug it in, and see what happens. If you do the same as I did (and I did this a few times), you'll connect the power supply incorrectly and fry a 555 before you realize your mistake. Lucky those things are cheap and readily available!

*warning* It's not a great idea to look directly into the strobe. You'll have purple dots in your vision for a while afterwards. Of course, now that I told you not to, it's probably the first thing you'll do, right? I thought so...

The video has trouble showing the strobe (the strobe rate and framerate of the camera are not matched). It does give you an idea of the brightness, though.

Step 7: LED Driver Circuit

I really need to give all the credit for this part of the build to instructables user dan. I've used his constant-current driver circuit in many different projects, saving myself from buying an expensive buck-boost pack or other power adapter. I've never had any difficulty with this circuit, and I've made several from scavenged parts. When you've invested exactly nothing in a circuit, any success at all is just amazing!

So, if you haven't already, go check out dan's great instructable. We're going to make the same circuit nine times. We will need three for each light - one for each colour of our RGB high-power LEDS. As it turns out, I'm not the first person to have this idea! Depending on your supply voltage, you may need more. It is possible to build three driver circuits for each individual LED to have the widest variety of configurations possible, but this will be limited by your patience. I am sticking to building one driver per colour. Of course, with three sets of lights (with three LEDs each), I'll end up with a total of 9 driver circuits. You'll notice that there's no heat sink on the MOSFETs. I'm only driving the LEDs at half-current, and the supply voltage closely matches the required voltage of my three LEDs in series. If you're not using the same setup, it might be a good idea to put some heatsinks on your mosfets. Mine never get hot, so I'm not worried about it.

If you're curious about how the drivers work, check out the instructable, and check out the application using an input to control it.

It took me some time to troubleshoot my driver board after building it. I had a few cold-soldered joints that weren't connecting properly. This is one of those places where I wish I had taken the time and expense to figure out how to build a PCB. Unfortunately, I don't have a laser printer, and I didn't want to lay out the money for everything I'd need just to do this one-off. Maybe next time...

Step 8: Writing the Code

While this project will use the Arduino to control the servos, it's not asking a whole lot from the available processing power. Some future improvements to this project include using some CD4053s and a TLC5490 to allow the arduino to switch the lights on/off, and to change the signals controlling the light's output.

One weakness I've found using the driver circuits I cobbled together is that they don't work with PWM output. That means that I can't mix custom colours as easily as I'd like. I may in the future figure out a way to circumvent this limitation, but for now, I'm happy with how it works.

While this is my first attempt at writing code for the Arduino, it's not my first ever program. So there will likely be many errors, but the concepts will hopefully prove to be soundly designed. As with all my projects, if you notice something that could be done better, please don't hesitate to share!

The circuit to convert audio to trigger the program came from https://www.instructables.com/id/Yet-Another-Daft-Punk-Coffee-TableDisplay/ step #7. Be careful to add the 10K resistor between pin 2 and ground (it's missing fom the schematic). I won't repeat all the instructions here, as lincomatic has done a better job than I could. You should really check out his great instructable! The only modification I did was to put a variable resistor between the output of the circuit and the input of the arduino, allowing me to adjust the sensitivity manually rather than only through software (although both methods work).

Parts:
  • LM358 Op Amp (pretty much any op amp should work)
  • 2 x 10K resistors
  • 10 uF capacitor
  • optional variable resistor to adjust sensitivity without changing any code.

In order to get acquainted with writing code for Arduino, I read through Brian Evans' fantastic Beginning Arduino Programming book. I also used the arduino programming notebook as a handy reference, and perused the Arduino CookBook. /* as a side note, my local library has a great program for suggesting book purchases, meaning I didn't have to pay a lot of money to get access to these great resources! */

If you're more experienced than I am, you may want to put the code on something smaller than an arduino. All you need is I2C for the servo shield, and one ADC input. If you manage to get it working on something smaller, please post a comment and share. Or, better yet, make a follow-up instructable so I can do it too!


Step 9: Servo Pan/Tilt Mounts

So now you'll have to put together some way of panning and tilting your LEDs. I used 14 ga household copper wire to build the armature to hold the LEDs, and I tried to center the weight of the unit in the middle of the rotation to minimize wobbling. There's really no right way to do this (although I did find several wrong ways!) I'm still adjusting the mounts.

One of the main things I did was to use one inch sections of silicone aquarium tubing on the end of the feet to keep them from sliding all over the place. These little units can be quite lively when the music's really jumping, and I don't want them walking off the edge of a table (again)...

The copper wire for legs will allow me to mount these creatively in the future. I may end up wrapping the legs around something to help secure them in place (once I figure out the best place to put them).

Parts:
  • 6 mini servos. Mine are Tower Pro brand.
  • Lengths of 14/2 copper wire or some other type of mounting device
  • Glue (I used "No More Nails" with limited success)
  • Aquarium tubing
  • Electrical tape
  • Patience

Step 10: Attach All the Pieces and Test!

Now comes the fun part! Connect everything together and test it out. Don't be frustrated if it doesn't seem to work properly - mine didn't work right off the bat. Take your time and your multimeter, and check everything that seems to have trouble. I broke it down into sections and worked on one until it was functioning, then moved on.

You should have things connected in this order:
1) Audio input to color organ and trigger circuit.
2a) Color organ output connected to driver board.
2b) Trigger output connected to Analog pin on Arduino
3) LEDs connected to driver board
4) Servos connected to servoshield

Don't forget to give everything a common ground! I'm using 9V for my leds and color organ, and 5v for the arduino and servos. Without connecting all the grounds together, you'll notice some very odd behaviour (my servos were going crazy when there wasn't an audio signal playing).

Now might be a good time to take a break and enjoy the fruits of your labour. My light show is pretty cool even though it's currently sitting on my desk, occasionally shining directly into my eyes, and extremely fragile.

Step 11: Packaging It All Up

Choose a project enclosure and some wire. I used ethernet wire, because: it's cheap, it's long, it's stranded core, and it's what I had on hand. By combining the +5V and Ground wires for the servos, I ended up only needing 8 conductors to each unit. That's handy, because that's exactly how many wires are in an ethernet cable! Follow a standard pattern when wiring each light so they're interchangeable and you won't make different mistakes on each one (at least your mistakes will be consistent).

The wires you'll need are:
  • +5V
  • Ground
  • +9V
  • Horizontal servo signal wire
  • Vertical servo signal wire
  • Red Ground
  • Blue Ground
  • Green Ground
Choose some sort of standard color mapping for what goes where. I used male and female pin headers to make it easier to connect and disconnect everything. Also, I was loathe to cut off those nice connectors from my servos!
I Could Make That Contest

Participated in the
I Could Make That Contest