Introduction: 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.
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
You will need the following tools:
- Soldering iron (to solder)
- Dremel/Dremel-like tool (to drill and cut the enclosure)
You'll also need some solder. Now on to the parts.
If you haven't got an Arduino or you want to make yourself a board for this project, you'll need:
1x 10K 1/4W Resistor
2x 1K 1/4W Resistor
4x 1uF 25V Electrolytic Capacitor
1x 100uF 25V Electrolytic Capacitor
3x 100nF 25V Multilayer Capacitor
2x 22pF 25V Ceramic Capacitor
1x 16MHz Crystal
1x MAX232
1x ATMEGA8/ATMEGA48/ATMEGA88/ATMEGA168/ATMEGA328 (NOTE: ATMEGA48 can't have a bootloader and it's flash is too small for this project)
1x RS232 DB9 Connector
1x Power supply connector (depends on your power supply)
For the LED driver you need:
6x 1,2 Ohm 1W Resistor
6x 47 Ohm 1/4 Resistor
6x 100 Ohm Trimmer
6x 4,3V Zener Diode
2x LM324
I used 2 3W RGB LEDs I bought from Dealextreme.
The enclosure is from Futura Elettronica (an Italian company), product code AUS11.
I attach a ZIP with all the project files in it.
- Soldering iron (to solder)
- Dremel/Dremel-like tool (to drill and cut the enclosure)
You'll also need some solder. Now on to the parts.
If you haven't got an Arduino or you want to make yourself a board for this project, you'll need:
1x 10K 1/4W Resistor
2x 1K 1/4W Resistor
4x 1uF 25V Electrolytic Capacitor
1x 100uF 25V Electrolytic Capacitor
3x 100nF 25V Multilayer Capacitor
2x 22pF 25V Ceramic Capacitor
1x 16MHz Crystal
1x MAX232
1x ATMEGA8/ATMEGA48/ATMEGA88/ATMEGA168/ATMEGA328 (NOTE: ATMEGA48 can't have a bootloader and it's flash is too small for this project)
1x RS232 DB9 Connector
1x Power supply connector (depends on your power supply)
For the LED driver you need:
6x 1,2 Ohm 1W Resistor
6x 47 Ohm 1/4 Resistor
6x 100 Ohm Trimmer
6x 4,3V Zener Diode
2x LM324
I used 2 3W RGB LEDs I bought from Dealextreme.
The enclosure is from Futura Elettronica (an Italian company), product code AUS11.
I attach a ZIP with all the project files in it.
Attachments
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.
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.
Attachments
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
BC337
And one LM324 every four drivers.
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
BC337
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).
Step 6: The Power Supply
You need a 5V power supply. Determing the current needed is easy: first determine the current flowing in the LEDs. My StrobeDuino has got 6 LEDs, 0.3A each, so 1.8A total. Now just add 0.2A (Microcontroller current + security margin). I need a 2A power supply. I used an ATX power supply I had lying around. ATX power supplies turn on when PS_ON (pin 14) is connected to GND and turn off when it's disconnected.
Note that the 5V line MUST be loaded with something like a resistor or a lamp. I used a 68 Ohm 5W resistor i had lying around. It's between +5V and GND.
Step 7: The Enclosure
The enclosure is plastic with two aluminium panels and some ventilation fissures. The LEDs are mounted on the front panel with some heatsink compound from Dealextreme. On the back panel I put an ATX Molex connector and the RS232 connector. The back panel is also used as heatsink for the BC337s.
I also put a 12V fan that sucks air from inside to outside. This lowers the internal pressure and fresh air is sucked from the ventilation fissures. This approach is much better than just blowing air into the enclosure.
Then I placed some adhesive buffers on the bottom.
I also put a 12V fan that sucks air from inside to outside. This lowers the internal pressure and fresh air is sucked from the ventilation fissures. This approach is much better than just blowing air into the enclosure.
Then I placed some adhesive buffers on the bottom.
Step 8: The Processing Sketch
This Processing sketch reads the data from the MIDI controller and sends it to the strobe. The configuration is pretty self-explanatory. Power the strobe, run the sketch and wait the green screen. Now you can control it from the MIDI console.
Attachments
Step 9: The MIDI Console
I used a Hercules DJ Control Steel console, but you can change the CCs in the Processing sketch to adapt it to every console. The image below illustrates my mapping.
Step 10: The Final Result
Here's a video and some photos of the finished thing.
It looks good :)
It looks good :)