PWM transistor connection - Page 1
Forum section: electronics / beginners

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 12:21:42 pm
content: I have the following configuration:Three PWMs come to the first three NPN transistor bases to regulate the light intensity of each colour of the two common anode RGB LEDs.The last NPN transistor, the one circled in red, should control the TOTAL light intensity of the RGB LEDs, but of course I don't think this kind of emitter follower configuration it's correct.How should I connect the RGB LEDs to the last transistor to make the circuit work properly? Should I instead usa a PNP transistor?Note thatVcc is 15 V.p.s. At least I managed to solve this issuevia software(adding an internal PWM which monitores total light intensity), but I really like to know what would I have to do to make the circuit above work properly!

author: ConKbot
author_rank: Super Contributor
timestamp: October 15, 2013, 04:07:44 pm
content: A few problems with this circuit.1st), why 15V for VCC?, even the blue leds in an RGB array run at ~3.5V Youre burning up a lot of power in your resistors or transistor dropping all that voltage. Unless of course they are strings of LEDs2nd) The resistors. You're going to need a current limiting resistor for each individual LED, because the voltage drop of each one varies with the chemistry of the LED, plus not all of your LEDs are on at the same time, so it might be getting 5mA or 15mA depending on the state of the other LEDs. I wouldn't be surprised if your blue LED wasn't very bright when all 3 are on, but quite bright when its the only one on. If you're multiplexing it so that only one LED is on at a time, you could probably get away with one resistor per RGB array, but the max currents in each one would vary a lot still.3rd) NPN transistors need to source current into the base to conduct. If you want to saturate your fourth NPN, your PWM output needs to be higher than the collector voltage (VCC) At the moment though, it will be in the linear region and it would be outputting the output of the PIC pin (4.5ish volts?) minus the Vbe of the transistor (~0.6v). If you want the switch to saturate with your 5V signal, you want a PNP transistor where you sink current from the base to turn it on. And and NPN (collector to base resistor of the PNP, emitter to ground) to keep the 15v from being seen by the PIC4th) if you can do it in software, what advantages does adding extra hardware add? One possible advantage I could think of is if youre feeding Q4 from a hardware PWM, it could be faster/have more resolution than a software pwm, so that at dim overall brightness you dont lose resolution in the (presumably) lower res and slow software PWM. Make sure you actually get an advantage though before you add extra hardware

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 05:39:25 pm
content: First of all thank you a lot for all your precious advices1st) Vcc is 15V because I'm going to add more than two RGB LEDs, maybe six or seven, so I will need more power.2nd) Yes, the resistors are present, I only forgot to draw them on this circuit I'm sorry.3rd) I didn't understand exactly what you said. Should I use both a NPN and a PNP transistor? I think you said I should connect the PNP base to the PIC port...and the NPN collector to the base resistor of PNP? Maybe I didn't understand, by the way how should I connect all the transistor terminals?4rd) Yes, you're right. I'm trying this configuration because I found some annoying issues in the software solution, like some light flashing on low duty cycle values. So I want to try this hardware solution because I think it will work way better!

author: Kremmen
author_rank: Super Contributor
timestamp: October 15, 2013, 06:01:37 pm
content: 3. Yes, he meant this:

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 06:10:31 pm
content: Thanks a lot Kremmen!I will try later to see if it does work!Do you have any advice about the values of the two transistor you draw?

author: Kremmen
author_rank: Super Contributor
timestamp: October 15, 2013, 06:30:32 pm
content: The resistor values are not critical at all. Mostly just to ensure the PNP turn-off and prevent grossly overdriving the NPN. 1 to 10 kohm would work for both.

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 06:51:05 pm
content: I've tried out the circuit and IT DOES WORK PERFECTLY!!!Thank's a lot!!!The only problem now is that the NPN transistor becomes HOT! Should I decrease the 15 V VCC,? But if I decrease it, will I have enough power to add six or seven RGB LEDs?

author: Kremmen
author_rank: Super Contributor
timestamp: October 15, 2013, 07:52:20 pm
content: That is moderately curious. The NPN stone should only pass the base current of the PNP plus whatever goes through the resistor... Aargh. I have forgotten to include a base resistor for the PNP - little wonder that the transistors heat up - they are shorting the base drive path.Please put another ~1k between the PNP base and NPN collector. That will fix the problem.

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 07:58:38 pm
content: Thank you, I will try.Wait, should I put the 1K resistor BEFORE the node which goes to 15V (throgh the other resistor), or AFTER the node?

author: Kremmen
author_rank: Super Contributor
timestamp: October 15, 2013, 08:01:42 pm
content: Pull the NPN collector wire loose and use the resistor to re-connect. In other words from the NPN collector to the node where the PNP base and pull-up resistor connect.

author: Tricka90
author_rank: Regular Contributor
timestamp: October 15, 2013, 08:05:18 pm
content: Perfect, thank you again.Tomorrow morning I'll try and let you know if it works.Good night, bye!

author: Tricka90
author_rank: Regular Contributor
timestamp: October 16, 2013, 02:02:28 pm
content: It works!But after some time the PNP stopped working. It is a BC327. Now with a new BC327 it all works perfectly again.Could it be some mistake in the circuit that has caused the BC327 to damage?

author: Kremmen
author_rank: Super Contributor
timestamp: October 16, 2013, 03:03:51 pm
content: Possibly the PNP took a hit when it was overdriven without a base resistor. There is no stress on the part otherwise so it should not be strained in the correct circuit but was strained a lot in the wrong one.I'm sure it will be OK now.

author: Tricka90
author_rank: Regular Contributor
timestamp: October 17, 2013, 07:44:31 pm
content: Thank you.Is it ok to simply connect it like this?This works the same way and it needs less components. What do you think about it?

author: MacAttak
author_rank: Unknown
timestamp: October 17, 2013, 09:05:00 pm
content: I believe that pull-up is needed so that the transistor on the right responds quickly enough to follow the pwm input wave. Without it, the base of that transistor is going to be somewhat indeterminate during positive regions of the pwm square wave. I'm surprised that it works reliably at all without the pull-up.

author: Hideki
author_rank: Frequent Contributor
timestamp: October 17, 2013, 09:07:08 pm
content: You say you want to use six or seven RGB LEDs. What type of LEDs are you talking about?If they are common-anode as shown in the first post, I wonder how you plan to connect them in series.