Pyramid Mood Lamp
Introduction
On this page i will explain how i created my first diy colour changing lamp with red, green and blue leds that fade between all colours of the rainbow. I programmed a microcontroller and recycled a plastic pyramid shaped shell in which ferrero rocher chocolates were sold. It's powered by 4 AAA batteries and has several different types of operation.
And because a video says 25 times more a second than a photo, here is a video:
It really comes out well at night when other light are dimmed. In daylight conditions the colors are barely noticable. Although it was originally intended as a proof of concept, i must say the result turned out nice. Here are some photo's of my lamp in action. Click on any picture to see it in a bigger size.
Bill of materials
I mainly used components lying around gathering dust. For the casing i used a plastic pyramid package that came with those tasty ferrero rocher chocolates. I also used a microchip PIC16F628 microprocessor. I bought extra bright light emitting diodes (red: 3000 mcd, green: 4000 mcd, blue:5000 mcd, all with a 25 degrees opening angle). I also purchased a battery holder for 4 AAA batteries which power this lamp for a whopping 10 hours of non stop light effects. Some basic transistors and resistors and you're good to go. Most parts you can source from your local electronics shop, although it will be less likely they have ferrero rocher chocolates there...
For a the values of the electronic components you can take a look at the circuit diagram above. (click for a bigger version)
General Layout
On the foto below you can see the bottom of the lamp. On top you can see the circuit board. It mainly 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
holder are glued on the bottom of the pyramid with transparent DIY silicone caulking. 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 clear. On 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.
I know it looks bad, but the great thing here is that no one is ever going to see this (except for you, right now). I cut a circle out of clear 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 some silicone caulk from a diy shop. After i let it dry for a night the led circle didn't fall down any more. Because i wanted to mount this lamp on a wall i had to tape the pyramid shell to the bottom part. I used a piece of black tape and i think it looks good too. See the conclusion below for a photo of the final lamp hanging on the wall.
Programming The PIC 16F628 Microprocessor
The pic also checks in what positions the dip switches are set and runs the predefined program accordingly. These four switches give you the ability to:
- control the speed at which the colours change.
- choose between either slowly fading or abruptly jumping to another colour
- pause at the colour that is currently displayed
- and last but no least: turning it on and off
I programmed the biggest part in JAL (a higher, pascal like language for PIC microcontrollers) and the pwm routines in assembler for speed optimization. The source code in JAL are these files: pyramid_lamp.jal and jPWM3.jal. I tried to add some useful comments to the code , yet it might be hard to know what's going on since this is my first program ever in JAL. I uploaded the hex code to the PIC16f268 with this very simple pic programmer and a PC program called ic-prog.
Conclusion
This lamp was my first one and more of a test. I learned how to program a pic microprocessor and things i could do better in future lamps. It came out nice in the dark but was too weak to be really noticed in day light. To conclude i give you before and after shots of the seating corner:









