Electronic – Controlling 10 high power LED with a Raspberry Pi

gpioledraspberry piresistorstransistors

I'm trying to figure out how to control 10 Luxeon Rebel LED (700mA) from a Raspberry Pi. I want to be able to turn them on and off from code, but I don't need to have two or more LEDs turned on at once, always one LED at a time.

First of all, I don't know much about electronics, so that's why some questions might seems obvious. I did some research and before ordering all the parts I would like to know if I made mistakes.

I plan on using this BuckPuck Driver to drive the LEDs. I though that I could put the LEDs in parrallel, and use a 2N2222 transistor as a switch. Is that the best way to go ?

To find the value of the resistors R2, R4, R6, etc, I used the gain found on the datasheet (30), and the base emitter value (0.6V/1.2V). The GPIO of the Raspberry PI being 3,3V it's 3.3 – 0.7 = 2.6V and 23.3 mA = 111 Ω. Is that correct or do I misunderstand something ?

Do I need a resistor between the LED and the transistor, and if I need one, how do I found the value ?

Finaly, I would like to be able to dim the light using PWM, it seems to be feasible with the CTRL and REF pins of the BuckPuck, but I don't really understand how it works.

Here is a schematics showing only three LEDs (with 10 LEDs the image was too small).

schematic

simulate this circuit – Schematic created using CircuitLab

Thank you !

Best Answer

The BuckPuck is a step-down ("buck") converter. You must provide it with a voltage at least 2.5V above the forward voltage of the LEDs. The LED has a typical Vf of 3.2V, so you want your input voltage to be at least 5.7V. Call it 6V or higher. The BuckPuck will take an input voltage all the way up to 32VDC, although the efficiency drops a bit.

It is regulated to provide constant current. In other words, the BuckPuck will vary its output voltage so that the current remains the same. The buckpuck doesn't care if you have one or three LEDs in series, it will simply create whatever voltage necessary to push 700mA through the circuit. Of course, this output voltage cannot be greater than 2.5V less than the input voltage.

Because of this, you don't need any limiting resistors in the LED paths. This also means that you want to select your FETs (or transistors) to have small resistances when switched on ( \$R_{ds-on}\$ in the datasheets)

However, this presents a problem in your multiple-path design. If you turn off one of the LEDs before turning on another, then there is nowhere for the current to go. The output voltage will shoot up to the maximum possible, as the BuckPuck tries to keep pushing 700mA.

A solution is to turn on one of the LEDs just before turning off another one. MOSFETs take time to turn on and turn off, so you may need to add a delay in your code to ensure that there is always a current path available.

As for as PWM dimming, basically you just switch the CTRL pin on and off fairly rapidly. The datasheet says that you need to keep the PWM frequency under 10kHz. I would keep it down to around 1kHz, or even slower. What you're doing is turning the LED on and off faster than the eye can detect. What you end up seeing is the average brightness.

However, you can only do this directly if you have 5V logic outputs. The RPi has 3.3V outputs. The datasheet gives the following examples, which won't work for you because you don't have 5V logic:

enter image description here

Read Page 4 of the datasheet very carefully. Also note that the microcontroller ground (the RPi ground) is tied to LED-.

Conveniently, the REF pin provides 5V for your use. You need to switch this 5V into the CTRL pin. One option is to use a small optoisolator (optocoupler), such as the Sharp PC713V0YSZXF.

If you don't know how to use an optoisolator, I would look for answers here :)

Good luck.