Introduction: Pimp Your LED Lamp
When buying groceries at the Lidl supermarket in The Netherlands, my wife ran into a very cheap (2.99 Euro) LED Lamp with fibers at the top. In this LED Lamp there are three LEDs, one Red, one Green and one Blue which create a simple but nice effect. The picture shows what the LED Lamp looks like. The LED lamp uses three AA batteries as power.
The LED Lamp had one disadvantage. At the bottom of the LED Lamp there is a switch so switching on and off means that you have to lift the LED Lamp, with a chance of breaking the LED Lamp. This disadvantage initiated this project ‘Pimp your LED Lamp’.
The idea was to make the LED Lamp remote controllable so that you do not have to lift it – only when changing the batteries – each time you want to switch it on or off. And while I was working on it, I also changed the three individual Red, Green and Blue LEDs by three RGB LEDs so I could create more colors and more patterns.
So after completing this project the Pimped LED Lamp ended up with the following features that can all be controlled via a Philips RC5/RC6 remote control:
- Standby = On/Standby
- Mute = Factory Defaults
- Volume Up = Brightness Up
- Volume Down = Brightness Down
- Program Up = Speed Up
- Program Down = Speed Down
- Digit 0 = LEDs on in White color
- Digit 1 = Original LED Lamp pattern, changing from Red to Blue to Green
- Digit 2 = Moving White color pattern
- Digit 3 = Moving RGB color pattern
- Digit 4 = Rainbow color pattern
- Digit 5 = Random color fade pattern
- Digit 6 = Moving random color pattern
- Digit 7 = Fading RGB color pattern
- Digit 8 = Test pattern
I am a big fan of the PIC microcontroller and like to have full control of what I am creating so I did not use any libraries but created all parts of the software myself. This was also needed because controlling all LEDs via Pulse Width Modulation (PWM) n software is time consuming so the code was optimized for speed in some parts. Arduino fans can use of course all libraries that are available but I think you need to write something yourself to control 9 (3 time RGB) LEDs via PWM.
The electronics are quite simple and do not require many components so it could all be built in the original housing of the LED Lamp.
Step 1: Step 1: Lamp Ingredients
You need to have the following to pimp this LED lamp:
- 1 * LED Lamp
- 3 * RGB LEDs
- 1 * PIC microcontroller 16F1825 + 14 pin IC socket
- 1 * TSOP4836 IR receiver
- 2 * 100nF ceramic capacitor
- 1 * 33k resistor
- 3 * 150 Ohm resistor
- 6 * 120 Ohm resistor
- 3 * AA (rechargeable) batteries
- 1 * Small piece of breadboard
Step 2: Step 2: Building the Electronics
See the schematic diagram and the pictures.
The electronics consists of two small breadboards, one for the new RGB LEDs and one for the microcontroller. The new board with RGB LEDs replaces the previous board with the Red, Green and Blue LED. In the picture you see both the new RGB LED breadboard and the original LED board.
The microcontroller board is mounted on the side of the internals of the LED Lamp housing and is connected to the RGB LED board via wires.
Since I also programmed the PIC controller while I was developing the LED Lamp there is a header on the board but that is not required for normal operation.
Finally the IR received is glued on top of the RGB LED board. I did not want to make a hole in the housing of the LED Lamp and in this way it still works OK. Of course you need to be more close to the LED Lamp if you want to control it.
Step 3: Step 3: the Software
As already mentioned, the software is written for a PIC16F1825. It was written in JAL. The software performs the following main tasks:
- Controlling the brightness of the LEDs using Pulse Width Modulation. For this it uses two timers, one for creating the refresh frequency and one timer for creating the duration of the pulse, the on-time of the LED. The refresh frequency is about 70 Hz which is sufficient not to be noticed by the human eye. The LEDs can be dimmed in 255 steps. This means that the timer for controlling the duration runs at 255 times 70 Hz is about 18 kHz. Because of this relatively high frequency the part of the code was optimized for speed.
- Decoding the Remote Control messages. For this it uses a capture timer that captures the duration of the bits on each change of the interrupt. The Philips Remote Control system uses bi-phase coding and the only way to decode messages without misinterpreting the message in case of interference is by measuring both the high and low bit time.
- A random function to create some of the random patterns.
- Creating the various patterns.
- Software to store and retrieve data from the EEPROM.
- Sleep mode to halt the processor when the LED Lamp is in standby mode.
- Last but not least combining it all together to get it working.
The PIC controller runs on an internal clock with a frequency of 32 MHz. The Intel Hex file is attached for programming the PIC controller.
Step 4: Step 4: Operating the LED Lamp
When you turn on the LED Lamp for the first time, is uses the original pattern, which equals pressing Digit 1 on the Remote control. All functions mentioned earlier can be used. This operation mode is also selected if you press the Mute button since this resets the LED Lamp to its original values.
If the LED Lamp is put into standby, it continues where it was after it is switched on again. The LED Lamp always remembers the last mode of operation before going into standby since that is stored in the internal EEPROM of the PIC Controller so even after changing batteries it continues with the last selected operation mode.
The video shows the operation of the original LED Lamp on the left and the operation of the Pimped LED Lamp on the right. In the video some operation modes are shown but not all. The effect is better visible in the dark and the blinking of the LEDs is not visible with the human eye.
Of course you can use other LED Lamps for your project and I hope this project inspired you to create one your own.