2
\$\begingroup\$

I think I got too ambitious with an earlier post, so lets back it up a bit.

I would like to use a 3.3V output from a Raspberry Pi to high-side switch a 12v load. I thought this was possible with a combination of PNP and NPN transistors following the example here, but I'm not sure if this can be adapted to 3.3V base and 12v collector. Is it possible to replicate this with 2N2222 and 2N2907 transistors, given a load less than 800mA?

If that's not an option, then I guess I should follow this post and go the route of using a MOSFET here, but it's not entirely clear what properties I should be looking for in a MOSFET. Do I need a drain down current greater in magnitude of my load (ex, will a -3.7A drain down current be sufficient for a 800mA load) and a gate source voltage lower than my base (ex, 3V)?

Thanks

\$\endgroup\$
  • 1
    \$\begingroup\$ it must be a P channel. The gate voltage is give by the bipolar T1 when it is ON you have ~ 10 V. Enough to turn it on the P channel. How much power do you want to waste on the mosfet ? \$\endgroup\$ – matzeri Jul 31 '16 at 17:18
  • \$\begingroup\$ Well I would only want to go the MOSFET route if it was my only option. The only other alternative i know of is a 5v relay with an op amp. So would the circuit here be following that example or do the PNP and NPN resistors need switched? Click \$\endgroup\$ – DrTarr Jul 31 '16 at 17:33
5
\$\begingroup\$

If you are serious about the 800mA high side sourcing current compliance and want to stay with BJTs, you'll need something more. A TIP32C is pretty cheap and sold by Jameco for 39 cents (+shipping) or go onto ebay for still cheaper sources. It comes in a TO220 case, which is what you want here.

Keep in mind that VCEsat can be high in these power BJTs, and you should plan on about 0.5V or so. This suggests about 500mW (including base current) dissipation. (For most BJTs in a TO220 case, I wouldn't worry so much about a heat sink at this level. It should be okay in air or pressed down on a board. But it's still a good idea to check the data sheet, just to be sure.)

The circuit could look about like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Q2 is operating as a current sink here. I'm assuming there is about 100 ohms of output impedance in your Raspberry pi output pin (likely) so I don't think you need to worry much about ringing. R1 is there to turn Q1 OFF when Q2 goes OFF. It's value isn't critical. R2 probably could be about 60 ohms, but 56 is a standard value. RLOAD is just a dummy to represent your 800mA load.

Your output won't quite reach 12V, of course. There will be a VCEsat drop of perhaps 0.5V, so only expect about 11.5V or so there. Hopefully, that's okay.

In the above case, the 2N3904 will ALSO be dissipating heat. I figure about 9V across VCE at 43mA is close to 400mW, if operated continuously. This worries me, though you might skate by with it. It does suggest perhaps a different choice for Q2 that is also in a TO220, though.

Or else a different topology (one requiring one more resistor and a different arrangement.) Something perhaps like this:

schematic

simulate this circuit

In this case, Q2's collector will be low (around 0.2V) when ON and the VBE of Q1 will be about 1V or so. So the drop across R3 will be about 10.8V, roughly. With 40mA, this implies a value of about 270 ohms. I set R2 to provide about 3mA then, too.

Q2 will only be dissipating nearer now to 200mV at 43mA, so about 8mW. Much, much better and this will be zero problem for any small signal NPN BJT. But R3 will now be dissipating perhaps a quarter to a half watt or so (10.8V across it), so you need to make sure it is sized to 1/2 watt or more.

\$\endgroup\$
  • \$\begingroup\$ Just for clarification, is the real difference between the two that either Q2 or R3 has a considerable heat load? I suppose either are fine as long as I use a 1/2W resistor or a 2N2222 instead of a 2N3904 NPN transistor? \$\endgroup\$ – DrTarr Aug 1 '16 at 17:47
  • \$\begingroup\$ There are other differences, but sure -- you could look at it like that. It's often cheaper to just get a TO220 BJT for Q2 in the first circuit instead of a half watt or one watt resistor (one watt here, I think.) But there are other differences. If the I/O pin were "stiffer" (more like a low impedance power supply) then the first circuit might experience momentary high frequency oscillations the other one probably wouldn't. But I don't think that's a problem here. The second one is more like what you see on the web. You won't see the first one often. But it works, too. \$\endgroup\$ – jonk Aug 1 '16 at 17:51
2
\$\begingroup\$

Since you want a simple switch and not PWM, the solution with a NPN and PNP is good. However on your schematics, replace the NPN base resistance by 1kohm, replace the other resistor by 1kohm and choose a stronger PNP, the 2N2907 is only 600mA capable. Also it's a good practice to put a resistor (say 10kohm) between the base and the emitter of the PNP (base not floating when NPN is off)

\$\endgroup\$
  • \$\begingroup\$ Very awesome feedback guys!! This is exactly what I've been looking for. The circuit I was working with was missing the R1/R2 pull-up resistor, as well as the resistances need to be changed quite a bit. Thanks for the help, I'll be giving it a shot this weekend. \$\endgroup\$ – DrTarr Aug 1 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.