StrobeDuino – Computer-controlled RGB strobe/lamp
After experimenting with Arduino and Processing serial communication i wanted to do something cool. I had some RGB LEDs lying around so i thought about making something with them. I ended up with a strobe/lamp controlled by a Processing sketch that receives the commands from a Hercules DJ Control Steel MIDI controller.
It uses 2 3W RGB LEDs, 6 constant current drivers to ensure every LED gets the proper current and an ATMEGA8. It uses a RS232 interface and a RS232 <-> USB converter to communicate with the computer.
It’s got three modes:
Normal mode – This allows the user to manually change red, green and blue and if the strobe frequency is more than 0 it blinks like a strobe (with adjustable duty cycle).
Fading mode – Fades between colors (hue).
Fading strobe mode – If the strobe frequency is 0 it acts like fading mode, but if it’s more than 0 it blink like a strobe, with adjustable duty cycle fading the strobe color.
Step 1: Parts & Tools
Step 2: The Arduino
You can use an Arduino board but I just built one myself and I bootloaded it using a parallel programmer. It uses a serial interface with a MAX232 and a RS232 <-> USB adapter from Dealextreme. I used an ATMEGA8 but this board supports also ATMEGA48, ATMEGA88, ATMEGA168 and ATMEGA328 – Note that ATMEGA48 is too small for this project and it isn’t bootloadable.
Step 3: The Arduino sketch
I attached the sketch. When compiled it’s 6390 bytes. You can configure two settings:
RGB LED pins: the digital pins where the drivers are connected. First one is Red, then Green and then Blue.
Fading hue increment: when in fading mode, this is how much to increment the hue for every cycle.
Step 4: The constant current driver
LEDs must be current driven. I made 6 simple drivers with adjustable current output (500mA max). How do these work? It’s simple. The LED is connected to the output of the opamp with a transistor to increase power. There’s a small value resistor in series with the LED. The voltage drop on the resistor is IR (Ohm’s law). For example, if 300mA is flowing trought a 1.2 Ohm resistor the voltage drop is V = 0.3 x 1.2 = 0.36V.
The opamp changes the output voltage until the difference between + and – is 0. If we attach the – between the emitter and the resistor the voltage drop on the resistor will enter -. All we need to do is to bring + to the voltage drop we want on the resistor and the opamp will adjust the output to give this drop. For example, if the resistor is 1.2 Ohm and we put 0.36V on the + input the drop on the resistor will be 0.36V and the current flowing 300mA. I put a zener diode because it would be unpractical to regulate 5v down to 0.3V – 0.4V using a voltage divider. The zener diode drops 4.3V and the trimmer is a lot more precise. The 47 Ohm resistor is there just to limit the current to 15mA in case of a fully turned trimmer. You need one driver for every LED. The main problem with those Dealextreme LEDs is that they’re common anode, so there’s no way to put them in series. So I need 6 drivers (2 Red, 2 Green and 2 Blue). The microcontroller output goes to “In”. I used two LM324 (Quadruple opamp) to have 8 opamps (2 unused). The transistor is BC337 (but you can change it). If you use BC337 you don’t need heatsinking if the total power dissipation is less than 620mW. With a 3.5V LED this means 410mA maximum current without heatsinking. If you can, heatsink it anyway.
R1 maximum dissipation is 0.35W, so a 1/2W resistor would work, but its’ better to put a 1W resistor. Why? Because the bigger the resistor, the cooler it stays. Heating causes a small drift in the resistor value wich affects the current. There’s no need for precision resistors because the trimmer compensates it but the resistor must be very stable. So keep it cold!
Part list (one driver):
R1: 1.2 Ohm 1W Resistor
R2: 47 Ohm 1/4W Resistor
D1: 4.3V Zener diode
100 Ohm trimmer
And one LM324 every four drivers.
Step 5: Setting the current source
To set the current source you need a multimeter that can measure current and a 1.2 Ohm 1W resistor. DON’T connect the LED. Instead of the LED connect in series the multimeter (in current measurement mode) and the resistor. Attach In to +5V and start turning the pot until the multimeter reads the desidered current. Now your driver is set. Attach the LED with a multimeter in series and check the current. Repeat this for every driver – I set my drivers to 300mA (my LEDs can take 350mA max).
For more detail: StrobeDuino – Computer-controlled RGB strobe/lamp
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
This Post / Project can also be found using search terms:
- simple arduino projects with leds
- arduino projects use led
- rgb led arduino projects