Today I'm going to show you how I made my "light painters palette" aka light box. If your into electronics and photography than this is probably something you are going to like.
-Arduino (I'm using an Arduino pro mini which requires a ftdi basic to program, But an uno or leaonardo... would work just fine)
-Tri Color LED Breakout Kit
-A Battery Holder for 4 AA's
-2 Toggle Switches
-2 10k Resistors
-3 10k Potentiometers
-3 Knobs (Red, Green, and Blue)
-IR Receiver (Almost any 38 kHz variety will work)
-IR Remote, mine came from a LED strip that burnt out. But any NEC remote works with some software adjustments (You could just buy one of these, have to check the remote codes)
-Enclosure of some sort, I used this one
-Some hookup wire
-4 little nut and bolt combo's that fit the Tri-Color LED Kit board
-LED bevel (doesn't even really fit the IR receiver, but oh well)
Drill and an assortment of bits
Flux and Solder
Wire cutters and strippers
Dremmel tool or jewelers saw
Double sided tape
Step 1: Hardware
To build it just drill a bunch of holes in the lid to your enclosure, mount the parts with their included hardware. Be careful not to space the potentiometers to close or they might not fit, my was too close for comfort. I mean that was totally planned. I'd suggest orienting the microcontroller so the analog inputs are on the side of the potentiometers, and the digital inputs are on the side of the switches. Use the double sided tape to secure the battery holder to the bottom of the enclosure. The power switch seemed to fit nice on the side. Give enough wire between the battery and power switch to the lid so you can open it easily. I also tried to make sure to wire the components through the bottom of the Arduino so if I needed to probe around I had some room. I used a spare piece of protoboard for a power and ground rail, however that's not necessary. You could just solder a huge ball of wire ends together. Flash the microcontroller with the software I've got here, drop in some batteries, close up the lid and your done!
The Potentiometers have three solder points, one side to 5V, one side to Gnd, the center to an analog input. If the sides are backwards then just flip the last two values in the mapping function after the analogRead functions in the software. This will reverse the clockwise vs counter-clockwise brightening/dimming relationship. I'd suggest a clockwise turn makes the LED's brighter.
The switches are SPDT, so one side goes to 5V, one side has a wire to the digital input and a 10K to Gnd. The 10k is a pulldown resistor which just makes sure the switch stays in determinate state all the time.
The IR Receiver has 5V, GND and Data lines from right to left (check your data sheet to be sure, I've burnt a couple of these for sure). The data line can connect to any digital input pin.
The LED's breakout kit has a 5V, Gnd, and data lines for each of the three colors. Be sure to wire these to a PWM pin, maybe not pin 5 and or 6 because I think they mess with the delay function and you might not be able to turn that LED all the way off. What ever is closest to the mounting spot.
The batteries get wired to the Raw and Gnd inputs. Send the positive lead through the power switch first.
Make sure however you wire it that it matches the software parameters!!
Step 2: Software
The two switches give the box 4 different modes.
Both switches pointed towards knobs: Color Select
The knobs control the brightness for the three individual LED's. Mixing the knobs gives you the rest of the rainbow. I bet this would be a great teaching aid for an art class.
The switches are pointed opposite one another: Color Fade
This mode fades between the LED's at a speed proportional to the position of the potentiometers. If one is turned all the way down it keeps that LED off. This way you could choose a little red and a lot of green if your light painting some tree on a wall... If you want each letter in something your writing to be a different color you just determine how fast you write each letter and try to time the knobs to that. The difference between switch 1 down and 2 up, and 1 up and 2 down is that it will mix the colors in one mode and will fade to black between colors in the other. So you can make a rainbow streak or more defined red, green, and blue streaks.
Both switches pointed towards IR receiver: Remote Controlled Mode
This mode listens to the remote. When you download the IR library it has an example file that reads codes sent from any remote and displays the NEC code. I used this to reverse engineer the remote and use if for my box. I couldn't build a better remote than this for sure, unless I wanted to time it to some music or something, maybe next holiday party.
The remote has an array of different color buttons you can jump around between. Off turns the colors off. On doesn't do anything, but any color is on.
It has a flash mode which I programmed to take the input from the potentiometers and flash that color. I also programmed the code sent from my Nikon D5100 camera remote to do this same thing, and timed it with my shutter! So its basically a remote operated color flash too.
You can dim or brighten each color with the top left two buttons. It just divides or multiplies the current value for the duty cycle of the pulse width modulated signal in half, or times 2. If you dim it all the way to black, however, you have to hit a color button to turn it back on (multiplying 2 times 0 = 0).
The strobe mode uses a pseudo random number generator to decided the delay between successive flashes, how I assume a strobe light works. You have to hit off to escape that program.
The fade mode does a relatively fast fade between the LED's. For this one you again have to hit off, to turn it off. Its a little tricky because you have to hit the off button right after the fade cycle completes to have it be reading the IR receive function. You can also just turn off and on the unit to get it to stop.
The smooth mode does a really slow fade between the LED's. This is a nice mood light setting. Once again you have to hit off for it to stop. This ones extra tricky to stop because the fade cycle is so long you have a much smaller chance of hitting off at the right time. If anyone has a nice interrupt IR receive function or knows a better way to program the box I'd love to check it out. This was my first attempt at programming a remote controlled anything. You can just turn off and on the box to get it to stop or flip a switch and wait for it to time out...
Whats next? I'm working on dynamic light painting with night time lapse's... I've got to slow the fade down a ton and build a whole bunch more box's. Maybe connect them on a Xbee network, take a hike around some natural features to place the box's, wait till night and let the lights shine!
Participated in the
Make It Glow Contest