Getting mbed to drive 12v LED?

16 Sep 2010

I'd like to get my mbed board to drive two (possibly three) 12V LEDs through DigitalOut ports, one port for each LED.  Obviously, I only get 3.3v out on those pins, and these drive normal LEDs fine.

The board is being powered by USB, so it would have to generate the 12V from the 5V USB input.

I'd prefer something to be *really* simple, as whilst I only wish to light 2-3 LEDs simultaneously, there will actually be lots of them which could be illuminated in different combinations.

No other IO is used, just DigitalIn, DigitalOut and the serial-over-USB to the host PC which powers the board.

Thanks

16 Sep 2010

Whats the power rating of the LED's do they specifically have to be 12v?

16 Sep 2010

The mbed can supply 3.3V on the outputs. This means you can't light up an LED with a forward voltage greater than 3.3. So you can't use white LEDs. IR, red, green, yellow blue LEDs and maybe purple LEDs you should be able to drive directly. Also, bear in mind that you can't source too much current through the mbed. According to the datasheet, the maximum current for a pin is 100mA. If you do decide to use high brightness LEDs, take care not to exceed the pin current limit and the 3.3V regulator current limit. Personally, I would try and avoid drawing more than 30mA from a pin if possible.

If you have a high power LED where the dies are connected in series to get a 12V forward voltage, you can't use the mbed board alone. You would need to look for an appropriate LED driver and probably a 12V power supply.

16 Sep 2010

You could use a suitable boost converter chip to get 12V from the USB 5V supply.

16 Sep 2010

Yup.. A boost converter will work. But you have to remember... the usb port supplies 500mA to the mbed. If we assume that the mbed doesn't use any current, the boost converter will provide 208mA at 100% efficiency. Taking into account all of the losses and power for the mbed, I'd be surpirsed if you can pull more than 100mA at 12V with a boost converter.. So if you do go this route, take this into account.

17 Sep 2010

Thanks for the replies.

I may have been mistaken about the voltage of the LEDs.  I'm looking at illuminated push buttons, ideally some quite big ones. I found a few large ones which in their description seemed to suggest they required 12v power.  However, either I was mistaken, or I've found some similar looking ones which in their data sheet say thay run off 1.85v (Red), 3.5v (Green), 2.3v (Amber), 3.5v (Blue) or 3.6v (White).  All are rated at 20mA.

If I really do need higher voltages though, your information will be helpful.

Thanks

17 Sep 2010

A 12V led is a led with a resistor wired in series so that it can be directly connected to 12V. You could always find where the resistor is and remove it or short it out.

17 Sep 2010

The brightness of an LED is directly proportional to the current through the diode. When the LED conducts, the voltage accross it is always the forward voltage. The reason a resistor is used with an LED is to limit the current (and to develop the voltage drop needed in the series circuit.) So for a red LED, if you connect it to 12V, the resistor will have 10.15V accross it. The current accross this resistor would be V/R (Ohm's Law) and this will determine the brightness of the LED. You don't want to drive the LED more than its maximum current rating so you often have to determine a suitable resistor depending on the power supply voltage.

If we want to use the red LED with the mbed we have to figure out a safe resistor value.  We know the supply voltage for the LED is 3.3V. The voltage accorss the resistor should be 1.45 (3.3-1.85). We can assume that we want 20mA for the LED (the current depends on the application of the LED and the LED itself.) If you are using the LED as an indicatior, you probably don't want it to blind you every time you look at it, so use less current. If we want a flashlight, we would probably drive the LED to its maximum current capability. So.. we know our resistor will have 1.45V across it and we want 20mA of current to flow, we can calculate the resistance needed with Ohm's Law: R = V/I -> R=1.45V/20mA = 72.5 ohms. You probably wont find a 72.5r resistor, so you can select 82 ohms or 100 ohms. See here for standard resistor values.

Anyway, I am not sure if you wanted to know all that (hopefully it can be of help to someone else). Your '12V' LEDs have a resistor in series somewhere as Hugo pointed out. You can try using them with 3.3V but they would probably be too dim. If you are daring enough, you can try to open the button to change the resistor. A seperate power supply is overkill for this application in my opinion..