LED PWM

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
rd1196
Can't get enough of electronics!
Can't get enough of electronics!
Posts: 83
Joined: Mon Aug 30, 2010 8:05 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

LED PWM

Post by rd1196 » Thu Mar 31, 2016 11:04 pm

Hello, similar to my motor PWM Im trying to design a PWM to achieve a more linear dimming effect for different LED lighting applications. I have a circuit right now to test that consists of three LED's in series powered by a max voltage of 28V, at 28V the current through the LED's is 3mA which gives it the desired brightness.

I drew up two versions of this PWM in LTSpice and simulated them, the first one is the npn version which is essentially the same circuit used to control the motor (discussed in another thread). The simulation gave the desired current behavior but in that arrangement the LED's are constantly connected to the 28V supply and current only flows when the transistor allows it, so I tried doing an alternative version using a pnp where its constantly connected to ground and the transistor allows current from the +ve supply to run. It took me a while to get the transistor to behave the way I wanted it to but I reached a solution that makes the current flow the way I want it using an npn to control the flowing pulses to the base of the pnp. Im willing to bet theres a cleaner way to do this and Im hoping I can get some feedback from you guys.

I have attached a screencap of both circuits, the alternative circuit is that one Im trying to improve and if theres any confusion or anything youd like me to clarify or point out please let me know. The PWM itself should be designed to work regardless of the size of the LED circuit (circled purple). I plan to use a 2N2905A and 2N2222A for the pnp and npn respectively (simply because I have them handy and LTSpice has them for simulation as well and they seem to work fine during simulation), if you find those transistors are overkill or too weak for the job and have any suggestions please do let me know.

Thanks
Attachments
LED PWM TEST.JPG
LED PWM TEST.JPG (68.78 KiB) Viewed 18124 times
Last edited by rd1196 on Fri Apr 01, 2016 11:49 pm, edited 2 times in total.

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by brad » Fri Apr 01, 2016 12:15 pm

Could you explain a little more about the linear effect that you're looking for?

I ask this because I can't see how the PNP or NPN circuits would result in a more linear effect since the PWM remains the same.

rd1196
Can't get enough of electronics!
Can't get enough of electronics!
Posts: 83
Joined: Mon Aug 30, 2010 8:05 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by rd1196 » Fri Apr 01, 2016 11:48 pm

Well if you just dim the LEDs by changing supply voltage with a potentiometer the dimming rate is all over the place, you can go up to 5V on the supply and nothing and then from 6 to 7 you reach the maximum brightness, so I decided to use a PWM so the dimming is more uniform.

The PNP/NPN issue I have is not related to the PWM circuit itself, its just that if you use the NPN and have the LED circuit between the VCC and the collector pin then theres a constant Voltage supply hooked up to the LEDs (even though there is no Voltage drop because there is no current) so I was looking for a way to have the LED circuit between the transistor and ground. I tried simply switching the transistor to a PNP but it didnt behave quite as I wanted it to so after a bit of tinkering around I ended up with that second npn transistor helping control the PNP.

Here are what the waveforms look like for both circuits, theres the voltage at the node before the last LED and the current through the LEDs


on a separate note I just designed a circuit board for The Great Race (Ill post the design soon to that thread to see what you guys think) and Im hoping to build a nice enclosure for it, this could be great to light up the button labels and a title and whatnot.
Attachments
LED_Voltage-Current_(pnp).JPG
LED_Voltage-Current_(pnp).JPG (70.12 KiB) Viewed 18116 times
LED_Voltage-Current_(npn).JPG
LED_Voltage-Current_(npn).JPG (72.42 KiB) Viewed 18116 times

rd1196
Can't get enough of electronics!
Can't get enough of electronics!
Posts: 83
Joined: Mon Aug 30, 2010 8:05 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by rd1196 » Tue Apr 05, 2016 1:35 am

Quick update, I made a couple of changes and managed to get rid of that second npn transistor on the alternate version of the circuit. The circuit works the way I want it to so Im not in much hurry to make any more improvements for now other than looking a little bit closer to the duty cycles. At one extreme of the pot you reach a min of about 8% duty cycle and around 99% on the other, I think for a lighting application it is better to have those reversed (being able to reach 0 but sacrifice a little bit on the max duty cycle).

If you guys have any thoughts let me know
Attachments
PNP_Version_PWM.JPG
PNP_Version_PWM.JPG (40.43 KiB) Viewed 18109 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by brad » Wed Apr 06, 2016 9:37 pm

Very sorry for my absence here. I have been meaning to take the time to write a reply.

I have a number of questions for you:
:arrow: Why are you running it at such a high voltage (28V) and where are you getting that supply from? Normally an aircraft DC electrical system runs on 28V but I can't think of other common sources of 28V
:arrow: Why do you want to have the LED's connected to the ground side? The only thing it will really change there is input and output impedances but for this application you really don't need to worry about that.
:arrow: Why did you replace the NPN with a PNP, you could still use an NPN even if you had the LED's on the ground side.
:arrow: Does it make a difference in your circuit if you remove the 1K resistor R1?

Sorry for all the questions, but if you could give me answers to these, hopefully I can do my best to answer yours in a way that will help get the best design out of your circuit :)

rd1196
Can't get enough of electronics!
Can't get enough of electronics!
Posts: 83
Joined: Mon Aug 30, 2010 8:05 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by rd1196 » Thu Apr 07, 2016 2:35 am

Well I havent really used LEDs before so I was just browsing around and I guess I saw that value a couple of times so I just put it there and then just left it and since Im just simulating for now I didnt really think about it much haha but Im guessing a 9V battery or other values and some tweaking around with the resistor wouldnt be much trouble for when I buld a prototype or use it on an actual project.

I guess it just seems a bit safer to have the LEDs grounded and eventually give them voltage rather than the alternative? but it has no issue in functionality from what i can see on LTSpice so I guess it really isnt an issue.

I tried still using the npn but just switching the load from the collector wire to the emitter wire but it didnt quite work so with my inexperience I assumed it couldnt be done.

It did make a difference actually once again the transistor wasnt working the way I wanted it to if I just had it hooked up to the output of the PWM.

Quite honestly I guess there are small reason for the changes, but Im really just playing around with the transistors and the 555 to get comfortable using them and understanding how they work and the motor project didnt reem to need much tweaking so I thought LEDs was a cool application too. So the changes Im asking for with respect to the original PWM circuit arent really "must do's" Im just trying to play around with the behavior of the circuit with various changes.

I think Im getting it now and I found some books to help me with semiconductors and such but thanks for the help!

PS Ill keep you posted on the PCB design I have for the great race and if I get to it maybe a nice casing for it too

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LED PWM

Post by brad » Fri Apr 08, 2016 9:06 am

Okay great, thanks for answering those questions :)

Now let’s see if I can help out at all.

You certainly won’t need the 28V in there, in fact just as you say, you could use a 9V battery. If we run a bit of math:

I’ll assume the forward voltage drop of the LED’s is 2V each. Therefore the 6K resistor will have 28V - 2V - 2V - 2V = 22V dropped across it. This gives a current flow of:

22V / 6K = 3.67mA (When the transistor is fully turned on or ‘saturated’)

With such low current your LED’s in real life won’t be very bright. You also won’t need to use a high power transistor.

I would also say that the LED’s won’t mind where they are connected, remember it is the potential difference that we are concerned with. So if the transistor is off, it will not matter if the LED’s are on the ground side or the positive supply side - they will have zero current going through them.

R1 is still a bit strange to me. Can you explain specifically the difference in operation for when you have R1 connected compared to when it is not connected?

If you want a really basic circuit I would go with something like this:
230-Resized@1x.png
230-Resized@1x.png (41.37 KiB) Viewed 18098 times
Or to be a little more design conscious I would have a resistor for each LED:
229-Resized@1x.png
229-Resized@1x.png (44.07 KiB) Viewed 18098 times

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 14 guests