Several months ago I stumbled across Toon Beerton's web site
describing the construction of a "Mood Lamp" utlizing an RGB LED and a
programmed PIC microcontroller. His project intriged me and I decided
to build the lamp.
This page will deal with the
assembly of Toon's LED Mood Lamp. Each step will be accompanied with a
photo in order to allow the reader to fully understand how the lamp is
constructed.
Three NPN transistors capable of carrying >500mA, e.i. - 2n2222, NTE123, BC337
Six 10,000 ohm, 1/4 watt resistors
Three 1 watt (I used 2 watt resistors) resistors, one 4.7 ohm, one 10 ohm, and one 15 ohm
One 4 position DIP switch
One small heat sink (for the LED) - one from an old 486 CPU will work fine
One power supply capable of suppling 5 volts at >500mA
One Ikea Mylonit lamp (two sizes available)
Glue (epoxy or equivalent)
One metre of hook-up wire (22 gauge or similar)
Some nuts and bolts to mount the LED
Some fibre or plastic washers to insulate the mounting bolts from the LED
Tools:
Low wattage soldering iron (15 - 30 watts)
Small needle-nosed pliers
Small flush cutters or equivalent
Small vise or similar to hold circuit board during construction
Drill and bits (if mounting LED to a heat sink)
Schematic
Step 1:
The first step is to get your RGB
LED and mounting hardware organized. I found a heat sink from an old
486
CPU which turned out to be the perfect size to fit the bottom of the
lamp. I used a couple of 3/4" 6-32 machine screws and nuts to
fasten the LED to the heat sink. The nuts and screws I used are brass
'cause that's what I had handy at the time. The white washers in the
picture are plastic washers which I placed under the heads of the
machine screws so there wouldn't be any possibility of shorting the
connections on the LED.
Step 2:
Now we mount the LED onto the
heat sink. I centered the LED on the heat sink and marked where I wanted
to drill the mounting holes with a pencil. The aluminum heat sink is
actually quite soft and is easy to drill through. Once the heat sink is drilled, mount
your LED onto the heat sink (or whatever you're using), utilizing the
machine screws and plastic washers. Note how the plastic washers keep
the machine screws from bridging the connections on the LED.
Step 3:
Time to solder some wires to the
LED. I used some 22 gauge solid wire I had left over from other
projects. Be very careful not to over-heat the LED.
Step 4:
After soldering wires to the LED I glued the heat sink to the bottom inside of the lamp. I used Elmers "Ultimate Glue",
which seems to work better than epoxy. Unfortunately, I didn't pay
attention and some of the glue ran down the inside of the lamp. My
bad...
Step 5:
Now comes the fun (hard?) part -
assembling the circuit board. I laid out most of the components
required. I ended up substituting a couple of resistors, and the PIC
I.C. and DIP switches are missing, but basically what's in the picture
is what's needed. I tried to make a layout of the components on the
circuit board using Word first, but I wasn't too successful.
Ultimately, I ended up arranging things on the circuit board until
things made sense. Not the most efficient may to do things...
Oops! I was going to use the 2n3904
transistors pictured above until I realized that they can only handle a
maximum of 200mA. Instead, I dug out some old metal canned 2n2222
transistors out of my junk box. They can carry up to 800mA.
Assembling the circuit board is not
rocket science, but some sort of planned layout and a steady hand (for
soldering) is required. My component layout is rather inefficient, if I
build another lamp I will look into utilizing some sort of PC board
software to help design a better layout. I wanted room for a 5 volt
regulator circuit, as it is difficult to find a 5 volt wall wart
power supply. Below is a picture of the circuit board partially assembled
with most of the components components except for the PIC chip. Note the extra 2
watt resistor - I couldn't find a 4.7 ohm, 2 watt resistor so I put two
10 ohm resistors in parallel to get the desired resistance.
Step 6:
Time to program the PIC. This is new territory for me. I'm using a serial port programmer from Spark Fun Electronics, and I'll be using IC-Prog for the programming software. Here's a shot of the programmer.
Wow! Programming the PIC is easy with IC-Prog. Note
- Just make sure you chose the correct PIC when setting the program up.
I initially chose the 16f628 PIC. The PIC did not work in the circuit
after I programmed it. After an hour of head scratching I realized that
my chip was a 16f628A. I reconfigured the programmer application for
the proper chip number and reflashed the chip. The PIC worked properly
after that. Download source code here.
Step 7:
Test it. I rigged up a real sloppy
power supply and test circuit to confirm the circuit board would work.
Of course it didn't initially. I had (1) - The PIC chip programmed
incorrectly, and (2) - A cold solder joint on the gound for the emitter
used for the red LED driver. After I corrected those issues everything
worked fine.
The completed circuit board. If I was to build another one, I would
reduce the size of the two-watt current limiting resistors. They don't
get very warm during operation. I'd also eliminate the dip switch, as I
just like having the lamp go through it's random color fades. Note - I
rounded the corners of the board in order to have it fit nicely into
the base of the lamp.
The back of the completed circuit board. I install a 0.1uf capacitor
across the incoming power on the PIC to ensure there would be no
problems with oscillation or noise coming from the power supply. I need
to get a nice low-wattage, fine tip soldering iron. It was difficult
not to cause solder bridges with the soldering iron I used.
Step 8:
Mount the circuit board in the base
of the lamp. I used a hot glue gun to fasten the board to the lamp.
Then hook up a 5 volt power supply and enjoy the light show! I had so much fun with this project, that my next project is going to be "A Jar of Fireflies".