mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 2:40 pm

Oh hang on!

If the UBEC provides 5V at 3A

The PI Takes 1.5A

That leaves 1.5A for the whole LED circuit, and if the 2003 takes 1A then nothing left. oops

I should maybe explain the whole setup, i have a 12V 6A power supply which i need 12V 1.5A to power a TFT screen, the other 4.5A is spare...

Hmmm

Trav
Posts: 20
Joined: Mon Mar 05, 2012 10:02 pm

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 2:50 pm

I just saw this topic, so I thought I would comment:
you said "Im planning on running a 1Ohm 3 Watt resistor to it to lower the voltage to 3V" and you also said elsewhere that the LED would be driven between 1.5 and 2.5 amps.
By ohms law (V = I x R where V = voltage, I = current and R = resistance) the resistor will drop 1.5 volts at 1.5 amps and 2.5 volts at 2.5 amps, so I guess you are really looking at 2 amps, so 2 volts drop from 5v to 3v.
The power produced in the resistor would be I x I x R = 2 x 2 x 1 = 4 watts at 2 amps, so you need a bigger resistor, say 5 watts, though that one will be just about OK at 1.5 amp (2.25 watts)but the value would need upping to about 1.33 ohms to give the 2 volt drop .
You are correct that you need some form of current limit to protect the LED and PSU. LEDs are current driven devices so putting a voltage cross them higher than their max working voltage lets them take as much current as they can before they or the PSU goes "pop!".

Note that the resistor will be finger burning hot, as will the LED, if running for any time. See the Thermal design on Page 4 of the LED data sheet; it can reach 120 degrees C at 2 amps if not mounted on a decent heat sink.

If I was designing this circuit I would be looking at discrete power transistors and some form of current limiting circuit rather than relying on a simple resistor, but my semiconductor design work was more than 20 years in the past, so a bit outdated, but at least Ohms law hasn't been repealed!
Good luck.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 2:52 pm

mattius wrote:Oh hang on!

If the UBEC provides 5V at 3A

The PI Takes 1.5A
Is that Pi and USB hub and USB devices ?
That leaves 1.5A for the whole LED circuit, and if the 2003 takes 1A then nothing left. oops
Ooops indeed the current flows through the LED and the SAME current flows through the 2x03 device.....
I should maybe explain the whole setup, i have a 12V 6A power supply which i need 12V 1.5A to power a TFT screen, the other 4.5A is spare...

Hmmm
So 3A out of 4.5A when running UBEC flat out, most devices work better and longer when operated at less than 95% of max ratings. Your UBEC may get warm as well. Consider looking at HDMIPi operates from 5 to 12V at roughly 0.5A, I have run one and the LCD and controller run that low a current consumption.
Last edited by techpaul on Thu Jan 30, 2014 3:03 pm, edited 1 time in total.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Trav
Posts: 20
Joined: Mon Mar 05, 2012 10:02 pm

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 2:55 pm

<edited> just saw you are using a UBEC so my comment didn't apply.
Last edited by Trav on Thu Jan 30, 2014 3:13 pm, edited 1 time in total.
1st Batch Model B (256M) running Raspbian, Pibrow case, with RaspiCam.
Model A (256M) running Raspbmc, caseless.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 2:56 pm

mattius wrote:Here is a more complete diagram, although i will probably power the pi through the microusb port to keep the fuse protection which powering through gpio doesnt give.

Edit:

Actually looking at it, i could just put the resistor on the line powering the 2003 couldn't i, that would keep that whole circuit 3V
It would be better as the circuit shows the other side of LED on GND so would never light. I would have a seperate feed for 2x03 and LED (even if off the same PSU)
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 3:01 pm

Your last circuit diagram (bottom of page 1, on my forum settings anyway) looks wrong - the LED seems to be wired to the supply negative connection.

I think we need to slow down, re-read the thread and think a bit :o

As for the UBEC that supplies 3A, that should be OK if your LED isn't at full whack. If you do draw too much power, the raspi will probably go off. but you're unlikely to burn anything.

TechPaul's suggestion about alternate devices is a good one; the ULN chips are ancient technology and I use them "for everything" because I have plenty at home. If you can find a working circuit for something else by all means use it. FETs will probably be more efficient too.

Also remember you can test parts of the circuit in isolation, without the raspi in the same room, as I mentioned earlier somewhere.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 3:09 pm

I think you need to draw out slowly and carefully a block doagram of components and anticipated power (volts and current) at each stage.

Then revisit your LED circuit with safeguards as the approx 2A peak through a ULN2x03 device is with a 10% duty cycle you need to make sure it does not exceed that for the device, external resistor and LED, everything will get hot with a mistake. What happens to I/O pins on Pi during power up they float so you could have the LED on for several seconds before your program starts so your input needs a 10k pull down resistor to ground on the ULN2x03 input for basic protection.

Slow down and test each part in turn before proceding to the next part of integration.

You need to check your power, heat and possibly cable sizes as you progress through.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 3:11 pm

mattius wrote:The raspberry pi will both be powered from the same source ( a 5V 3A UBEC ) to start with. Although i may up this to 4A should i need more brightness out the LED. With the connection just split between the two (the PI should always take its 1.5A yes? or is there a chance the LED will try and take all 3A)
Basically yes, especially if permanently on in fault condition or a short circuit. I dont know where you get this Pi is 1.5A from.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 3:36 pm

Im not even constructing the circuit physically yet, just trying to get what i need straight in my head.

So don't panic im not going up in a puff of smoke yet. I always build small subcomponents and then join them into the main circuit when im sure they work.

Apologies for my lack of coherence im a software engineer and physics twists my brain combined with having the flu and being bored lol


But if as was previously stated the 2003 looses 1A at 3V then that would leave 0.5A for the LED which is not enough as it has a minimum of 0.75 at 3V.

Open to all suggestions especially the simplistic way of doing it, not committing anything yet.

Is the UBEC the best way of doing the 12v to 5v? i know they get reasonably hot from my RC car days but not ridiculous.

I could just use 2 power supplies,

i picked up 6 x 6" TFT screens a while back for a tenner so im definatly using one of them, and a raspberry pi model b (no networking and just a usb flash drive plugged in possibly the camera module) apart from that all other components are up in the air so to speak and im hunting the best way of doing it.

Even the LED can be changed, there is no way i will need 1100 lumens probably more like 650~700.

Cheers for the help so far

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 3:49 pm

mattius wrote:Im not even constructing the circuit physically yet, just trying to get what i need straight in my head.

So don't panic im not going up in a puff of smoke yet. I always build small subcomponents and then join them into the main circuit when im sure they work.

Apologies for my lack of coherence im a software engineer and physics twists my brain combined with having the flu and being bored lol

But if as was previously stated the 2003 looses 1A at 3V then that would leave 0.5A for the LED which is not enough as it has a minimum of 0.75 at 3V.
No What was stated was
joan wrote:At 3V it'll take an amp (according to my reading of the spec).
As in that is how much current can safely pass through it. under those conditions without excessive heat buildup or chip damage level shifting the input to 5V WILL improve the current capability and some losses as transistors harder on, but still has limits especially on heat build up.

Current flows it is not lost, basic kirchoff's sum of currents entering a point is equal toi sum of currents leaving. As the current will be entering via the LED and resistor the same current will be leaving the chip (ignoring very minor input leakage currents in this case)

I still say sketch out each block, and then detail the LED circuit with safety precautions some of which have been outlined before. Better still use a FET driver and some form of current limited supply at correct voltage to drive the LED not a resistor as a heater.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 4:49 pm

Im really not understanding how to current limit the circuit apart from using a resistor, is there any example of a simple circuit i can look at?

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 5:01 pm

Have you seen that circuit in the PDF I posted earlier? Pretty simple, the resistor goes in series with the LED and limits the current for you (it'll need to be one with a few watts power rating though for such a meaty LED).

Here's a basic page on transistors, there is a "simple switching circuit" with a resistor in series with an LED and that's similar to the setup we need:
http://electronicsclub.info/transistors.htm
the main difference is your GPIO pin delivers 3V to the transistor's base, there is no need for a switch. (In fact that circuit as shown is basically the sort of test circuit I mentioned earlier, forcing inputs high or low without a raspi connected.)

I believe the ULN chips are darlington pairs by the way, which are also mentioned later in that page. Just for background info.

Also if you google for a raspi driving a relay or a solenoid or small motor, you will find virtually the same circuit. Loads of people have done a similar thing.

(Of course I can't remember where, right now.)

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 5:19 pm

If LED is 3V using a 1A or 1.5A voltage regulator from your external 5V power, with a heat sink to be on safe side.

If you cannot find a suitable 3V get a positive rail adjustable regulator with Low Drop Out, how about
LT1963A which is max drop out on 1.5A of 0.5V, which from a true 5V source you could adjust the output from 1.21V to 4.5V and get 1.5A of current, low power pot to adjust the voltage level. There are many many voltage regulators with LDO and adjustable range for all sorts of current ranges

Device has thermal shutdown and current limiting (too much current and drops voltage and current output). Also withstands reverse connection of power input and ground. Datasheet http://www.farnell.com/datasheets/1761433.pdf

Also has a SHUTDOWN pin which with a control from GPIO and pull down resistor can be used to turn off completely.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
Burngate
Posts: 6290
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 5:27 pm

I've been following this for a while ...
Have you a link to this "high power LED" that needs "3A at max current over 3.3V" ?
It may help us to help you if we know more about it.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 5:44 pm

He linked to it on the previous page. Search for Cree. There are a few voltage/current readings on there, he won't be needing the full 3A I think!

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 5:59 pm

If your ON time is 1 to 2 seconds I would suggest using a variable regulator and using the shutdown control to turn LED on and off, simple interfacing simple heatsinking. Basically a resistor on shutdown control, resistor and pot for adjusting rail probably to 3.5V max and the LED.

Your duty cycle woul be near 100% as far as a ULN2x03 is concerned and you wont get away for heating it up for 2 seconds with 1A or more going through, would need at least 2 minutes to cool down again.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 6:03 pm

At 3.3V and 3.2A at produces 1100 Lumens, if you've ever seen a Cree torch, its as bright as a floodlight, so the likelyhood of actually using full current except in a bike light or torch is highly unlikely.

However it provides the biggest range of illumination i can find, from 650 lumens at 0.75A and 2.9V right the way up to the full 1100.

I had hoped there would be an off the shelve solution, as previously stated im a programmer not an electronics guy, but i've built a few circuits in the past needs must.

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 6:24 pm

I came across this http://www.instructables.com/id/Super-s ... semble-it/

using an LM350 to regulate the voltage which i should be able to run at 2A.

So you would ignore PWM and use a pot like i was going to initially?

If i use the LT1963A mentioned, i just connect it to the GPIO pin of the PI with say a 100k resistor?

Connect the LED with a resistor before 100k? then a pot (how do you work out the size of the pot?) directly to the output from the UBEC

Thanks for your help everyone, i do feel rather thick when it comes to electronics around you guys.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 7:17 pm

First work out what you want and read the datasheets the LM350 has something like a 2 to 2.5V at 2A so from 5V you would be luck to get 2.5V to 3.0V out of the regulator.

The LT1963A has an application diagram for constant current work.

Do you want to vary current or voltage or both?

What is the ON time and OFF time you expect to use?

You need to limit current for normal use and for protection of everything else under fault conditions. Just finding example circuits and throwing components at it or just picking words you want to hear wont help.

Pull down resistors are for control lines from Pi to hold lines low when Pi is starting up and not connected to hold the circuit OFF.

The pot I mentioned was for low power adjustment path not for direct connection to the LED, you would need a substantial pot, as most standard pots are 1/3W to1/4W, you would need a 1W to 5W pot which are expensive and bulky.

Sit down and sketch out your requirements as most of what we are suggesting is on bits of the details.

First work out or experiment and find out the voltage and current ranges you need for the intensity you need and time duration you need.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Trav
Posts: 20
Joined: Mon Mar 05, 2012 10:02 pm

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 7:37 pm

Here is a simple circuit attached:
circuit.jpg
circuit.jpg (43.32 KiB) Viewed 4030 times
This is taken from another paper (http://www.centralsemi.com/PDFs/product ... he_CLD.pdf) and modified for this requirement.

the CLD is a current limiting diode, the BD182s are power darlingtons capable of 4 Amps. Both should be mounted on a heat sink as they will get hot. The 0.1 ohm resistor will dissipate about 0.4 watts max. (at 2A) the others are very low current so any low power resistor will do.
The circuit as shown should limit at around 1.5 A. either change the CLD to a 2.0ma one to increase current to 2amps, or change the 100 ohm resistor to 133 ohms.
The diode on the right is the LED (I didn't have the right symbol) and "GPIO" goes to the Pi GPIO pin you are using.
you might still need a pull-down resistor on the GPIO pin.

Caveat: this is completely untested by me!
1st Batch Model B (256M) running Raspbian, Pibrow case, with RaspiCam.
Model A (256M) running Raspbmc, caseless.

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 7:53 pm

Thanks,

Im not just throwing components anywhere, just trying to investigate all options to try and find the right option.

Im also trying to get my thick little brain round them, its easier to picture something. And yes i could draw it out, but with all the options that are flying around im not sure which is the right one. As far as modulating the brightness i can't tell, it will vary from situation to situation hence i want to be able to control it, all i know is i want to go from 0.75A at 2.9V to 1.5 at 3.0V. I can change it later to go higher if needs be.

Trav
Posts: 20
Joined: Mon Mar 05, 2012 10:02 pm

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 9:00 pm

Change the 100 ohm resistor in my diagram for a 50 ohm resistor in series with 50 ohm pot and it will do exactly that. Or a 100 ohm pot to go from 0.75 to 2.25 A.
That is for maximum currents. The PWM from the RPi can then lower the brightness from there.
I reckon there is about £5-6 worth of components in my circuit.
1st Batch Model B (256M) running Raspbian, Pibrow case, with RaspiCam.
Model A (256M) running Raspbmc, caseless.

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 10:08 pm

What is the specifications of the High power LED
That you are using, 3amps seem to be a lot
There might be a alternative using less current
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

mattius
Posts: 87
Joined: Thu Jun 14, 2012 9:55 am

Re: Driving a single high power LED using PWM

Thu Jan 30, 2014 11:21 pm

I agree Trav i like your circuit it seems simple to me.

So currently i have this component list:

2 x BD681 - http://www.farnell.com/datasheets/1685030.pdf
1 x E-152 CLD- http://www.semitec-usa.com/downloads/crd.pdf
1 x 50Ohm Pot
1 x 50Ohm Resistor
1 x 0.1Ohm Resistor
1 x KOhm Resistor
and the LED


I have the resistors lying about, and the pot, and the LED is on order.

Updated my drawing, below, guess i need to work out the powers next make sure everything is right?

Edit : The drawing has an error it is a 1.5mA CLD
Attachments
Untitled Sketch 2_bb.jpg
Untitled Sketch 2_bb.jpg (26.84 KiB) Viewed 3983 times

Trav
Posts: 20
Joined: Mon Mar 05, 2012 10:02 pm

Re: Driving a single high power LED using PWM

Fri Jan 31, 2014 9:47 am

Lying in bed last night I realised I had made a mistake in my calculations :(
The CLD should be a 3mA (or thereabouts) one and the 50ohms resistor and pot should be 150 ohms and 500 ohms respectively to give 1.5 to 2.1 amps
I had made a false assumption about the gain of the darlington transistor. :oops:
At least it was a safe mistake, as no current would have flowed at all.

To test that part of the circuit, replace the LED and second BD681 with a beefy 1ohm resistor. put a voltmeter across it and apply 5 volts to the circuit. You should see the voltage go from 0.75 to 1.5 as you turn the pot, though I would be surprised if it was exact.
If the range is too low change the 150ohm fixed resistor (I really should have labelled them) for a higher value and vice-versa.
If it is 5v or 0v, the circuit isn't working; disconnect immediately!
Also check if the 5V on the input stays stable.

Once that works, replace the 1ohm test resistor with the led and test again. Ideally it should be bright enough and vary and have about 3 volts across it whatever the pot is set at. Then you can insert the second BD681 and test that taking the input high and low switches the LED on and off, Finally attach the RPi. you might have to lower the value of the 1k resistor on the gpio pin to, say, 680 ohms to get the full range of brightness from the gpio 3volt output. You want to saturate the transistor when it is on.
PWM is the most efficient way of driving this LED as the second BD681 will either be saturated or off, so losing little power. The first one will get hotter as it will be working in the middle of its range. Both should be on a heat sink.
I can show you the calculations for any of the above figures if you are interested.

By the way, this should work better with 12V input , but the first transistor will get hotter. Test with 5V first.
Sorry for the mistake. yesterday.
Last edited by Trav on Fri Jan 31, 2014 4:07 pm, edited 2 times in total.
1st Batch Model B (256M) running Raspbian, Pibrow case, with RaspiCam.
Model A (256M) running Raspbmc, caseless.

Return to “Other projects”