So the other day I started working on a custom high power LED strip, using red, green and blue 1 Watt power LEDs. Nothing really fancy, just 7 LEDs in series per color, each driven by a 350mA constant current source at about 24 volts. I decided to throw in an Arduino for brightness control, since the cc sources have PWM dimming capability. Fun fact: I didn’t need to buy any additional components, everything I needed I had lying around somewhere (don’t ask…).
The setup is pretty straight forward: the thing is powered by 12V DC which is then boosted to 24V by some beefy boost converter. Those 24V are then hooked up to three Anvilex CCS2-350 constant current drivers. Each string of 7 LEDs – with blue haven the highest forward voltage, thus 7×3.5V ~= 24V – is connected to one of these drivers.
Dimming with the Arduino
Enter the Arduino: for testing purposes I added a classic Freeduino (Duemilanove clone), connecting it to the 12V input voltage and attaching the PWM ports to the DIM ports of the CCS2s. There are some caveats using the CCS2 and the data sheet doesn’t make it very easy to understand them (either this or I am a rather slow learner…). Anyway. The CCS2 uses the Zetex ZXLD1366 LED driver chip and this chip provides the DIM pin. This pin is some sort of “jack of all trades” and accepts analog voltages, PWM modulated voltages or PWM gating.
Fun with the ZXLD1366 specs
The ADJ pin will accept either a DC voltage or a PWM waveform. Depending upon the control frequency, this will provide either a continuous (dimmed) or a gated output current. — from the ZXLD1366 datasheet
What the hell does that mean? It means you can either
- suppy a true analog voltage or
- a PWM signal which will cause
- true analog current control at a low frequency (< 300 MHz) or
- gated output control (meaning “chopped” on/off/on/off cyles relation to your PWM signal
Since the lowest PWM frequency you can get on the Arduino is 490 MHz (not using any timer manipulation or soft PWM), we will have gated output control.
That doesn’t sound so bad – but there is another drawback to trip over: the DIM pin can withstand voltages up to 6 volts, BUT the output current will reach the designated maximum value (in my case 350mA) at a voltage of 1.25V. The chip will shutdown to power saving when the voltage drops below 0.2 volts. And (here it comes): anything between 1.25V und 2.5V will further increase the current output up to twice the maximum (700 mA). Voltage increases above 2.5V have no further effect.
Congratulations, we have just found the means of blowing up our LEDs. So I had to limit the PWM range to 0-63 (256 steps/5 Volts * 1.25V ~= 63). No problem here, we are just using some resolution.
Blowing stuff up
I wrote a small test sketch to see if everything worked an it surely did. I the replaced the bulky Freeduino with a soldered in Pro Mini that will actually fit inside the enclosure. I fired everything up again and there it was: a well audible bzzzt and then silence. Followed by some erratic flashing on the power LED side. The Pro Mini had gone out with a bang (you have to see volume in relation to the size of the components…). But why? Frantically checking everything it turned out the Atmega328 was fried. Interestingly enough, also one of the power LEDs got killed in the process. I realised that when I connected the Freeduino again and the red LED string wouldn’t come on anymore.
I replaced the faulty LED and ran everything again and it all worked fine. I then replaced the Freeduino with another Pro Mini and measured everything without the LEDs attached and it surely would work. I then reattached the LEDs and … bzzzt. Another Pro Mini dead. And another power LED. WTF?
Once more measuring everything after hooking up the Freeduino again. This time I also used my trusty pocket oscilloscope. And what did I find? I was betrayed by my love for cheap components…
So, here’s what happened: I am using a rather cheap 30W 12V power supply. It is supposed to power 21 Watts of LEDs and assuming that to boost converter operates at an optimistic 85% efficiency rate, it would need to provide a least 25 Watts of power. And it does. During a brief period when the circuit is already powered and the Arduino has booted, the CCS2 will power the LEDs at full brightness (I guess that’s by design). So the whole thing draws 25 Watts right from the start. The power supply compensates for the sudden demand, but there is a slight voltage spike of ~13V as it does. That spike is no problem for the 7805 on the Freeduino and it would also be no problem for the MIC5205 (up to 16 Volts VIN) on the Pro Mini had I been using a genuine one and not some cheap clones. The clones come with a MIC5219 or some other cheaper regulator that allows only 12 Volts at VIN.
So the regulator was fried by the voltage spike. That in turn damaged the Atmega chip and made it send more than 2.5V to the DIM pins. The LED current was doubled and one LED sacrified itself so that the others could survive. On the second attempt, uregulated voltage was flowing everywhere and even killed one of the constant current sources. Yay! No…
So, what do I take with me from this whole mess? Well, I guess I could have avoided those mistakes by thinking a little bit more before soldering. Measure twice, cut once they say. I say: But cutting is more fun than measuring :-). So better luck next time. Here are the two major learnings:
- Don’t rely on the linear voltage regulator of your Arduino, especially not on tiny, cheap Arduino clones. Either use a standalone 7805 regulator or – and that is the preferred way – use a switching step-down (or even a really fancy step-up/step-down) converter such as the Pololu D24V5F5 or the S10V4F5. They can take at least 18 Volts and are have builtin safeties.
- Use a voltage divider circuit for the PWM signal on the DIM pin. This gives you the full resolution of 256 steps on the PWM (although atmittedly you really can’t see any difference in brightness using only a single step) and it protects the DIM pin – and your LEDs – against over-voltage/current.