• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Driving +12 via +5 TTL logic and a PNP transistor

Not open for further replies.


New Member
Howdy All,

I'm developing a project that uses a PIC to drive a bunch of highpowered LEDs in a matrix config. The only "interesting" thing is the LEDs are RGB full-spectrum LEDs and I've written a software PWM for each color output. Basically, I'm driving 12 RGB LEDs arranged in a matrix of 2 rows and 6 columns.

I need to pump 40ma at 4.5 volts into the Blue and Green LEDs and 2V @ 40ma into the Red. I'm driving the LEDs in a common anode configuration.

The PIC drives the base of 2N3904 NPN transistors to switch the cathode and each 3904 has a current limiting resistor going from it to the LED. Because of the current demand, the row/anode is being switched using a PNP power transistor. At any given instant, a particular row of LEDs could light up demanding 720ma or so (40ma * 18 LEDs), so I need to use drivers on row and column.

Now, to my actual problem. Because of the voltage drop across the 3904, I can't use a single +5 supply for all the LEDs. I can't get more than about 4.3V across the 3904 and I need 4.5. So I decided to use a +12 supply to drive the LED. Sounds pretty simple.

However, I cannot get the PNP transistors to open/close based on feeding them a +5 or 0V signal. Basically, connecting base to GND or +5 both result in the transistor being on. The only way to turn it off is to connect the base to +12. And I am going through a resistor on the base and I'm confident (now) that I'm not dealing with a blown part.

Note: If everything is drive from a single +5 supply, the PNP behaves as expected, but the resultant current/voltage lights the LEDs too dimmly to be used.

For simplcity and testing, I've switched my power PNP over to a plain old 2N3906 (I'm only driving a single test LED right now, so I'm not overloading it). The +12 and +5 come off the same power supply (I use a 7805 to derive the +5 from the +12). I've attached a simplied schematic of the test circuit I'm now using. Resistor values are appropximate depending on which LED (R, G or B) I'm testing.

I've been doing digital stuff for a long time and even simple buffering for a while and am pretty good at selecting the right parts, calcing the current values, voltage drops, etc I need. But I've not done dual drive with a dual voltage supply before and I suspect I'm definatly missing something.

Could anyone give me a few pointers as to how to make the PNP transistor switch +12 with logic level voltages from the +5 side of the world? I'm definatly stumped and feeling a little silly asking, but I've nopt been able to figure this one out yet :-(


P.S. pardon the crudity of the schematic drawing - it was done a little memo pad and I have 0 artistic ability :)



Here are a couple of suggestions:

1) Some parts (such as the PIC) allow you to configure the output port as an open collector. Then you could use a resistor to pull the output pin up to the +12V. However, there is a limit to how high it can be pulled up and I *think* the limit on most pics is around 9V.

2) Use a 74xx07 hex buffer driver. This has 6 open collector outputs that can be pulled to something like 30V.


(3) Use another (small) NPN with its emitter tied to ground and its collector tied through a current limiting resistor to your 12V rail. The collector of the NPN is then tied to the base of the PNP power transistor (perhaps through another resistor, but maybe not needed). Then when the base of the new NPN is driven high, the base of the PNP is pulled to ground. When the micro is driving the base of the new NPN low, the base of the PNP is pulled to +12 through the current limiting resistor.

Good Luck


New Member
Yes, use a suggestion that crust mentioned. In the schematic shown, your pnp will always be on since its base will only be 0 or 5V and the collector is at 12. you need to have its base go above about 11.35V to make sure the pnp turns off. Re-think your topology, there should be a way to do what you want with fewer parts.


Active Member
In Your circuit the PNP can't work, and the +12V go to PIC output.Need an additional resistor for proper closing (1k) and a zener for level shifting.


Not open for further replies.

Latest threads

EE World Online Articles