Introduction: Remote Controlled LED Ribbon
For a long time I had the plan to add more lighting to one wall of my
living room, the LED ribbon was bought from a Chinese supplier on eBay, more than a year ago. Now finally I got this done and want to share the results with you.
LED ribbons are flexible circuit boards with SMD LEDs which can be used for versatile lighting applications. Most of the ribbons are suited for a supply voltage of 12V and come in lengths of 5m with power requirements ranging from a few watts per meter to 15W and more per meter.
Adjusted to the forward voltage drop of the LEDs there are normally 3 LEDs in series connection with a current-limiting series resistor, each of these groups then connected in parallel to the supply voltage rails along the ribbon. The ribbon can also be cut between these groups of 3 LEDs to fit your very needs.
Step 1: Mounting the LEDs
The LED ribbon has an adhesive tape on the back and can be glued onto any flat surface. I used an aluminum profile which you can buy at a hardware store (mine is from Bauhaus and comes in 2m long pieces, a=14.5mm b=11mm c=1.5mm).
When attaching the ribbon to the profile make sure that the electrical contacts are well isolated from the aluminum profile. Even though the aluminum is covered with a protective oxide layer, you otherwise risk a short circuit.
I cut the ribbon into 2m pieces and attached these separately to individual pieces of aluminum profiles. At the end I soldered a connective pair of wires between adjacent profiles.
The profiles themselves are mounted on my wall using curtain rod holders from IKEA.
Step 2: Testing the Circuit and Software
But I just had to add something more to my light-strip. I wanted to be able to dim it and if possible from an infrared remote control. Dimming is done by pulse-width modulation (PWM) from an Atmel ATtiny25 microcontroller (I am not using Arduino, but only the controllers directly). The PWM signal directly drives the gate of a power MOSFET, which controls the current through the LED ribbon by switching the ground-side of the LED ribbon. In order to avoid any flickering the PWM frequency has to be chosen high enough.
Currently I am using the following settings:
- 8MHz internal oscillator
- phase-correct PWM on Timer 0
- 64 PWM steps
- resulting in about 60kHz PWM frequency
Additionally a standard receiver for infrared remote controls is attached to PB3 of the ATtiny. I found a nice IR remote control library, IRMP, which supports a wide variety of remote controls. Since I had a control for another LED ribbon from a chinese reseller, I chose to use the on/off and dim-codes from this control, but you can choose whichever remote control you have.
The first built of the circuit was on a breadboard for testing purposes, before I moved everything onto a 3-island stripped veroboard.
Step 3: Putting Everything Together
- ATtiny25 microcontroller
- suitable power MOSFET, e.g. IRFZ44
- 78L05 voltage regulator
- 10kohm resistor (for the reset line)
- 150ohm resistor (for the optional indicator LED)
- infrared remote receiver
- 100uF electrolytic capacitor
- piece of perfboard
The source code for the controller is attached, together with a precompiled binary which relies on the same type of chinese remote control I use. If you use a different type of remote control you need to first find out the codings of the remote control and then change the corresponding lines in the file 20131217_tiny_LED_dimmer.c:
// chinese multicolor LED remote #define LEDPROTOCOL 2 #define LEDADDRESS 65280 #define LEDUP 92 #define LEDDOWN 93 #define LEDONOFF 64
Compiling the code shows that it will fit even in the smallest Attiny device:
- Program: 1762 bytes (86.0% full)
(.text + .data + .bootloader)
- Data: 46 bytes (35.9% full)
(.data + .bss + .noinit)
We have a be nice policy.
Please be positive and constructive.