Author Topic: PWM transistor connection  (Read 8398 times)

0 Members and 1 Guest are viewing this topic.

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
PWM transistor connection
« on: October 15, 2013, 12:21:42 pm »
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 that Vcc is 15 V.

p.s. At least I managed to solve this issue via 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!
 

Offline ConKbot

  • Super Contributor
  • ***
  • Posts: 1399
Re: PWM transistor connection
« Reply #1 on: October 15, 2013, 04:07:44 pm »
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 LEDs

2nd) 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 PIC

4th) 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 ;)

 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #2 on: October 15, 2013, 05:39:25 pm »
First of all thank you a lot for all your precious advices  :)
1st) 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.  ;D
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!  :)
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM transistor connection
« Reply #3 on: October 15, 2013, 06:01:37 pm »
3. Yes, he meant this:

Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #4 on: October 15, 2013, 06:10:31 pm »
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?
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM transistor connection
« Reply #5 on: October 15, 2013, 06:30:32 pm »
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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #6 on: October 15, 2013, 06:51:05 pm »
I've tried out the circuit and IT DOES WORK PERFECTLY!!!  :D
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?
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM transistor connection
« Reply #7 on: October 15, 2013, 07:52:20 pm »
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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #8 on: October 15, 2013, 07:58:38 pm »
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?
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM transistor connection
« Reply #9 on: October 15, 2013, 08:01:42 pm »
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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #10 on: October 15, 2013, 08:05:18 pm »
Perfect, thank you again.
Tomorrow morning I'll try and let you know if it works.
Good night, bye!
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #11 on: October 16, 2013, 02:02:28 pm »
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?
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM transistor connection
« Reply #12 on: October 16, 2013, 03:03:51 pm »
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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Tricka90Topic starter

  • Regular Contributor
  • *
  • Posts: 50
Re: PWM transistor connection
« Reply #13 on: October 17, 2013, 07:44:31 pm »
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?

 

Offline MacAttak

  • Supporter
  • ****
  • Posts: 683
  • Country: us
Re: PWM transistor connection
« Reply #14 on: October 17, 2013, 09:05:00 pm »
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.
 

Offline Hideki

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: no
Re: PWM transistor connection
« Reply #15 on: October 17, 2013, 09:07:08 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf