GPIO high-side driver fail

LED PNP high-side bad design.
Figure 1. On the face of it, this looks like a reasonable means of achieving a high-side switch. But watch those diodes!

The NPN common emitter configuration makes it easy to make a low-side to switch loads connecte to positive supply. It seems logical to assume that a PNP transistor could provide a mirrored circuit to make a simple high-side switch. The circuit of Figure 1 will work fine provided that \( V_{SS} \leq V_{MICRO} \) (or whatever voltage the micro is running on).

PNP high-side fail.
Figure 2. The protection diodes on most logic chips creates a sneak-path to positive supply. This will keep the PNP transistor permanently turned on and may damage the chip.

If If  \( V_{SS} > V_{MICRO} \) then the output protection diodes built into the chip provide a sneak path for the base current. The e-b junction of Q1 will be forward biased and current will flow through it, R1 and D1 to the micro supply. Q1 will turn on and LED will light and will not switch off.

We can fix this at the expense of adding an NPN low-side switch.

NPN-PNP high-side driver.
Figure 3. To drive a high-side transistor from a GPIO pin we need a level translator. An NPN transistor does the job nicely.

In Figure 3 the micro drives Q2 as in a normal NPN low-side switch. When Q2 is turned on current will flow from the base of Q1, through R1 and Q2 to ground. Q1 will turn on and the LED will light.

Figure 4. An opto-isolated high-side driver.

In Figure 4 the problem has been solved by using an opto-isolator. Now there is no chance of the 12 V supply back-feeding into the micro.

Note that in this example the grounds are common between the two circuits. They could, however, be separated for complete isolation. See “A basic application” on Opto-isolators – intro for an example.

Please link to us if you find the information helpful ...<br>Tweet about this on Twitter
Twitter
Share on Facebook
Facebook
Pin on Pinterest
Pinterest
Digg this
Digg
Share on LinkedIn
Linkedin
Share on Reddit
Reddit
Share on StumbleUpon
StumbleUpon
Share on Tumblr
Tumblr