RGB mood lamp

YOU ARE BEING REDIRECTED TO THE NEW SITE

please update your bookmarks


Introduction

(3 sept. '06) Update: i made a new and better mood lamp.

On this page i will explain how i created my own colour changing lamp with red, green and blue leds that fades between all colours of the rainbow. It really comes out well at night when other light are dimmed. In daylight conditions the colors aren't noticed well. Although it's low budget i must say the result is nice. Here are some photo's of my lamp in action. Click on any foto to see it in a bigger size.

Red   PurpleBlue
Pink   Green

And because a video says 25 times more a second than a foto, here is a video:

So if it's low budget, what did you use? Well, mainly free stuff lying around. For the casing i used a plastic pyramid of ferrero rocher chocolates. I also used a microchip pic16f628 microprocessor i got from a free sample. Then i used some resistors and transistors i soldered out from old electronics. The LEDS were the most expensive. I used extra bright ones (red: 3000 mcd, green: 4000 mcd, blue:5000 mcd, all with a 25 degrees opening). I also purchased a battery holder for 4 AAA batteries which power this lamp for 10 hours non stop light effects.

I included a 4 port DIP switch which gives you the ability to:

  • control the speed at which the colours change.
  • choose the way colours change. Either slowly fading or abruptly jumping to another colour.
  • pause at the colour that is currently displayed until the switch is turned off again.
  • and last but no least: turning it on and off!

To give you an impression of how big the lamp is i placed it next to an ordinary shoe box.

Parts You Need

I made a small list of what you need to make your own colour changing lamp. Most parts you can get from your local electronics shop, although it will be less likely they have ferrero rocher chocolates there...

For a the values of the components you can take a look at the circuit diagram below.

General Layout

On the foto below you can see the bottom of the lamp. On top you can see the circuit board. It mainsly consists of the PIC microprocessor, the dip switch and some transistors and resistors. Below the circuit board the battery holder is placed. The circuit board and battery lamp_underholder are glued on the bottom of the pyramid with transparant DIY silicons. Between the circuit board and the battery holder, right in the middle i drilled a small hole to fit 4 wires. One cable for every color and one for the ground. I also glued thin aluminium foil on the bottom on the inside, and on top of that some semi-transparent paper to maximize the diffusing effect so the beams of the RGB leds mix better. Originally, the plastic pyramid casing was transparent. From the inside i used sandpaper to make the plastic look diffused so you get a nice glowing effect. On the foto below you can see how i arranged the leds.foto/interior_thumbnail.jpg I know it looks bad, but the great thing here is that no one is ever going to see this. I cut a circle out of transparant plastic, stuck the leds through and soldered them together in groups of four. Then i glued this on a transparant housing of a ballpoint pen i had cut in half and glued the pen on the bottom of the pyramid. This was also done with transparant DIY silicons. After i let it dry for a night the led circle didn't fall down anymore. Because i wanted to mount this lamp on a wall i had to tape the pyramid cover to the bottom. I used a stroke of black tape and i think it looks good too. See the conclusion below for a foto of the final lamp hanging on the wall. 

The Circuit Board

The electronic circuit looks like this (click for bigger version):

electronic circuit

Programming The PIC 16F628 Microprocessor


The pic is the main component of the lamp. I programmed three outputs (one for every colour) using pulse width modulation. This way i can control the brightness for each colour seperately, and it's possible to produce every colour of the rainbow (theoretically, because in reality the beams of the leds don't mix perfectly). Here is a picture of the leds in action.

electronic circuit

The pic also checks in what positions the dip switches are set and runs the predefined program accordingly. I programmed the biggest part in JAL, and the pwm routines in assembler. The source code in JAL are these files: pyramid_lamp.jal and jPWM3.jal. I tried to comment it but you still might find it hard to know what's going on, but hey, this is my first program in jal... I uploaded the hex code to the pic with this very simple pic programmer and a program called ic-prog.


Conclusion

This lamp is my first one and more of a proof of concept. It was the first time i programmed a pic microprocessor. In the near future i am planning to make more of these lamps but with other housings. I now know things i can do better in future lamps. For example buy diffused leds instead of transparant ones and with a bigger opening angle (however i solved the latter by rubbing the leds with sandpaper, but still...).

To conclude: here are before and after shots of the seating corner:

beforeafter