Maker Pro
Maker Pro

Can I drive a P-channel MOSFET from a 74HC138?

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
Hi,

I "somewhat" followed an Instructable and ordered a bunch of P channel MOSFETS http://www.irf.com/product-info/datasheets/data/irf9z34npbf.pdf but they haven't arrive yet so haven't tested my cunning plan which I'll detail below...

The original schematics were driving them like in this picture http://www.bristolwatch.com/ele/img/tr9a.gif i.e. a "switched on" transistor makes voltage low from VCC to Collector and turns on MOSFET, and switched off transistor makes voltage high from VCC to Collector and turns off MOSFET... that's all good I understand how that works.

But in that original design, they were driving 8 transistor/MOSFET pairs from 8 microcontroller pins... I figure I would rather just use a 74HC138 because I only need the 8 mutually exclusive.

Having inverted outputs i.e. active low, can I just connect the output pins from the 138 directly to the MOSFET gate?? "low" = MOSFET on, "high" = MOSFET off, no?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
If you're only switching 5V you should be OK. If you're switching a higher voltage then you'll need the transistor as shown.
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
awesome thanks for reply, yeah just 5V both sides of MOSFET... the "business" side of the MOSFET is grounding 64 LED's which only have 100R resistors but 1/8th duty (you guessed it, it's an LED cube...)

So do you mind if i ask hypothetically what the issue is if the voltage is higher on business side? I thought the gate was essentially separated from the rest of the mosfet?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
awesome thanks for reply, yeah just 5V both sides of MOSFET... the "business" side of the MOSFET is grounding 64 LED's which only have 100R resistors but 1/8th duty (you guessed it, it's an LED cube...)

P channel mosfets are normally used as high side switches and the gate needs to be raised to that high voltage to turn the mosfet off (because the source is connected to Vcc and the Vgs mist be 0 (or close to it) to turn the mosfet off.

If they're low side switches (connected to ground) then you would normally use N channel mosfets

So do you mind if i ask hypothetically what the issue is if the voltage is higher on business side? I thought the gate was essentially separated from the rest of the mosfet?

For a P channel mosfet you need to get the gate voltage higher to turn the mosfet off. The problem is then that you either can't turn it off, or (worse) that you exceed the maximum Vgs and kill the mosfet. The latter problem won't be an issue with 12V supply as shown in your original diagram, but the former would be.

With a 5V supply, connecting a P Channel mosfet as a low side switch would likely prevent you from turning it on fully. For just a single diode, that's not a problem, but if the current is substantial, you will find that the mosfet gets warm, and the load doesn't get the power you expect.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
awesome thanks for reply, yeah just 5V both sides of MOSFET... the "business" side of the MOSFET is grounding 64 LED's which only have 100R resistors but 1/8th duty (you guessed it, it's an LED cube...
That circuit you linked to uses a P-channel MOSFET, connected between the positive supply rail and the anode of the LED (via a current limiting resistor).

When the driving circuit pulls the MOSFET's gate low, the MOSFET turns ON, and becomes a short circuit from source to drain. In other words, it pulls its drain up to the positive supply voltage. This applies the supply voltage across the LED (and series resistor) and makes the LED light up. This arrangement could be called a "switched positive". The MOSFET does not "ground" the LEDs; it applies a positive voltage to their anode sides.

If you're talking about the other MOSFETs that are not shown in that diagram, the ones that are connected between the LEDs and the 0V rail (with the LEDs connected in an 8x8 matrix), you would normally use N-channel MOSFETs with their sources connected to 0V. A positive voltage on the gate turns the MOSFET ON and it pulls its drain down to 0V.

Both types of MOSFET respond to the voltage between the gate and the source, but the polarities are different - N-channel MOSFETs are turned ON when the gate is positive relative to the source; P-channel MOSFETs are turned ON when the gate is negative relative to the source. That's why you can connect the sources of the P-channel MOSFETs to the 5V rail and drive the gates from the active-low outputs of a 74HC138.
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
Thanks Steve and Kris...

Yeah I was kinda chopping and changing from two schematics and I guess I need to put more thought in to it...

There's this chestnuts LED cube http://www.instructables.com/id/Led-Cube-8x8x8/?ALLSTEPS which is basically the same as what I want to build, except I want a 74138 selecting the layers

And he had a problem using a single 2N2222 as low side switch for 64 LED's with the amount of current, so he used two in parallel... he says given chance he would've used a MOSFET instead.

Then I checked out this chestnuts RGB LED cube: http://www.kevindarrah.com/download/8x8x8/Cube_sch_3_16_13.pdf

His cube is quite different, but main difference is reverse polarity: so he's got high side P-channel MOSFETs, hooked up in much same was as my original example circuit at top of thread...

I figured I could just use the same for my design.... I didn't realise that the "side" mattered but I can see in breadboard testing now that it does :/

Sooooo.... is there no way to use a P-channel as high current low side switch? If not, if I use an N-channel MOSFET: if I want to use a 74138 to drive it, which has inverted outputs, should I just invert them again before feeding to gate? hmm...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Without more magic than you want to build, P Channel mosfets can't be used as a low side switch.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Normally you would use a 74HC138 driving eight P-channel MOSFETs to switch the high side, to select one of eight planes of the cube. Each plane will have 64 cathodes, which would be driven by 64 low-side switches - standard transistors that are driven from shift register or latch ICs.
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
mmm, having just soldered 64 transistors high side i think i might just express order 8 new N-channel MOSFETS... I spose I do have another 64 transistors spare transistors hmmm... and a hungry solder sucker... it's probably not that hungry though... i shall sleep on that one! :p thanks guys!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
How have you connected your 64 high-side transistors? Do you have a schematic you could post?
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
No just been drafting stuff on a whiteboard.. basically 5V, 8 x 74HC574s, going to those high side transistors (i need to check the resistor going to base, i think i worked out 1k would be ok...)... 100R's on LED 'columns', then yeah, new design '238 and N-channel MOSFET's on low side... plan to use a '138 in to CP pin on the flip flops... giving me a total of 14 pins for control (plus power and ground). I'm hoping a raspberry pi will be OK to control it... otherwise ill get an arduino. I think i have a 5V 3A power supply round here somewhere... I believe it'll pull 1 to 1.5amps...

i guess the "maths" and "datasheets" part of electronics is a bit neglected thus far in my learning journey... and my Spice and Eagle skills/tolerance is low at this point too... but thus far have been encouraged by a few little LED matrixes i've built and driven by my Pi, so i'm reasonably confident/foolhardy!

I was going to build a 4 x 4 x 4 first... but i got excited lol i'm conscious of possibility of complete failure :)
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
.... plus a sprinkling of capacitors... i can't remember if i read 100nf or 10nf for near the IC's... and like... 1000uf and a 100uf near power supply? Maybe a 100uf on each of my two transistor boards? *shrug*
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
100nF (0.1uF) across the power supply pins of the logic ICs cant hurt.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, so your high-side switches are PNPs with their emitters at +5V and their bases driven from active-low 0V/+5V logic-level signals through resistors? That's fine.

You should consider what will happen with a larger cube and/or a cube using different LEDs. Will 5V be enough? And how much current will be needed? All that switching will inject a lot of noise onto the +5V rail and you may want to have two separate power supplies - one for the LEDs and one for the logic circuitry.

A good, cheap, small N-channel MOSFET for the low-side switches is the NTD4906N (http://www.digikey.com/product-detail/en/NTD4906N-35G/NTD4906N-35GOS-ND/2194521)
 

Simon101

Oct 8, 2014
38
Joined
Oct 8, 2014
Messages
38
hmm good questions... i would have guessed larger cube with same LED's just = more current... but if one starts to get an insane level of current what does one do? I shall ponder on that one...

Thanks heaps for the MOSFET recommendation!! Very kind of you.
 
Top