# Transistor + MOSFET high side switch

After doing some research, I found the attached schematic to make a high-side switch. However, this was designed for a 12V system, whereas I’m working with 3.3V (or 5V *) voltages. Also, I’ve never used FETs before, so I have a few questions:

a) How do I determine what transistor and P-channel MOSFET I need to look for. I have zero, none, no idea what I need to look for as far as specs.
b) How do I determine what the various resistors need to be? I’m assuming they are related to what the transistor and MOSFET need, but as with point (a), I don’t know how to figure those out.

The idea here is that I will be switching the 3.3V (or 5V *) voltage that feeds the 4-pin connector that goes to the LED string. It’s literally going to act as if it’s a mechanical ON/OFF switch, so no high frequency toggling.

• I’m still trying to determine whether I want to run this system at 3.3V or 5V and I am going to start a different thread with the design and questions.

(Decided to stick with only 5V)

The critical value to look at is the RDS_ON of the FET when it is switched on at your target voltage (VGS). For a 3.3V system you’d be looking at VGS = -3.3V, for 5V VGS = -5V. You want that resistance to be as low as possible to reduce losses.

So you want to be looking for a logic-level P-channel MOSFET (IRLxxxx for example).

As for the NPN, that is much less critical. It’s basically working as a simple inverter - you provide a logic 1 and it switches on connecting the gate of the FET to ground. If you’re switching the same voltages as you’re driving the switching with you don’t really need it, but it’s convenient to keep it as otherwise a logic 1 would turn OFF the circuit rather then ON.

The resistor values aren’t that critical either. R2 limits the base current to the transistor, so 10K is usually fine. R1 is the pull-up resistor that keeps the power in the off position when the NPN isn’t activated. The smaller this resistor the faster the switch-off will be. If you have it too big the power will kind of fade off, and the FET may start getting hot as it turns off. The lower the value the faster the FET will turn off, and the less heat will be dissipated by it when you switch off.

R3 you don’t actually need at all. I guess it acts like a dummy load when there’s nothing attached, and bleeds off any charge from whatever it’s all driving when it switches off, but I have never used one.

majenko:
The critical value to look at is the RDS_ON of the FET when it is switched on at your target voltage (VGS). For a 3.3V system you’d be looking at VGS = -3.3V, for 5V VGS = -5V. You want that resistance to be as low as possible to reduce losses.

So you want to be looking for a logic-level P-channel MOSFET (IRLxxxx for example).

I knew I forgot something. It needs to be able to drive about 3A as the LED string tops out at 2.54A when at 100% duty cycle. So I’ll have to hunt for some of those. Does it matter if the values are larger than what the circuit is running at?

majenko:
As for the NPN, that is much less critical. It’s basically working as a simple inverter - you provide a logic 1 and it switches on connecting the gate of the FET to ground. If you’re switching the same voltages as you’re driving the switching with you don’t really need it, but it’s convenient to keep it as otherwise a logic 1 would turn OFF the circuit rather then ON.

Yeah, I need a logic 1 to turn it ON. What happens when the unit resets and the pin is tri-stated?

KirAsh4: Yeah, I need a logic 1 to turn it ON. What happens when the unit resets and the pin is tri-stated?

Simplest solution to that is to add a 100k resistor from the gate to ground. That way when the pin becomes tri-state, the resistor holds to gate low resulting in the transistor turning off. If you set the gate floating while it is turned on, current flowing through the channel can actually hold the charge on the gate keeping the transistor turned on until the gate charge slowly leaks away.

EDIT: some how I missed your circuit diagram all together. It shouldn't actually matter if the NPN transistors base is left floating as no current will flow into the base so the transistor should switch off, then your resistor on the gate of the FET to the supply voltage will turn the FET off by discharging the gate. However, adding a large pull down resistor (~100k) to the base of the NPN won't do any harm, and will ensure that the transistor is switched off when the pin is tristate.

KirAsh4: the LED string tops out at 2.54A when at 100% duty cycle.

It's 2.54A all of the time (at any time) it's on (low duty or high duty).

KirAsh4: What happens when the unit resets and the pin is tri-stated?

The FET is pulled high, it's at source potential. Make the NPN input LOW first thing.

What's the 4? drain resistor for? A test load?

I was going to mention a base->ground resistor actually, but got carried away with the rest of it

Having a current rating higher than you need is good. Being able to cope with voltages higher than you’re working with is good. But the RDS_ON value at -5V VGS is still critical.

You’ll want to apply Ohm’s law to it and check the power dissipaiton. P = I2R, so if the RDS_ON is say 20 milliohms at -5V then at 2.54A that would be 2.542 x 0.02 = 0.129W, so be sure the MOSFET you have is happy with that kind of current.

(BTW, 2.54A is nothing to a MOSFET. I have 4.8A rated MOSFETs as SOT-23 - a power MOSFET can handle tens, or hundreds of amps.)

KirAsh4: the LED string tops out at 2.54A when at 100% duty cycle.

It's 2.54A all of the time (at any time) it's on (low duty or high duty).[/quote]

How do you figure that? It's an RGB string, and if only one channel is on, at full 100%, that's only 0.864A. Worse if I'm only driving a few of the LEDs as opposed to the full string. So how do you figure it's always at 2.592A? (My typo, that should've read 2.592A in my previous post.)

Tom, would you mind drafting up a schematic for that?

On your existing schematic, add a 100k resistor from GND to the junction of R2 and Q1(base)

KirAsh4: How do you figure that? It's an RGB string, and if only one channel is on, at full 100%, that's only 0.864A. Worse if I'm only driving a few of the LEDs as opposed to the full string. So how do you figure it's always at 2.592A?

How do you not figure? If one channel draws 860mA (let's not split hairs) at 100% then it draws 860mA at 10%, too.

Same thing: With a constant 5V to a 1K resistor there's 5mA current. With a 5V 1kHz square wave to a 1K resistor there's 5mA current (not 2.5mA) during the time that it's "on". With a 5V 1kHz 10% duty repetitive pulse to a 1K resistor there's 5mA current (not 0.5mA) during the time (10msec) that it's "on".

The current is not a derivative of the duty cycle.

[quote author=Runaway Pancake link=topic=182221.msg1350311#msg1350311 date=1376261482] How do you not figure? If one channel draws 860mA (let's not split hairs) at 100% then it draws 860mA at 10%, too.[/quote]

Yeah, I know that. But the string won't always be at that ~2.6A. If I light up one channel only, it will only draw 1/3 of that.

However, as far as the duty cycle is concerned, you are correct, whether it's 100% or 10%, the peak draw is always the same.

What I'm seeing is probably more of an average draw at anything less than 100% duty cycle, likely because my DMM can't keep up with the duty cycle.

Just a note, you may want to use the following symbol when you are drawing the P channel MOS FET.

Gotcha. I used the symbol the Adafruit library had for a P-Channel MOSFET. I see that Sparkfun's symbol is a closer match to what you posted above.

Another possibility is to use one of the L298 motor shields. Parallel all 4 inputs and outputs for 4amps. http://www.aliexpress.com/wholesale?shipCountry=us&shipCompanies=&SearchText=l298+board+module&exception=&minPrice=&maxPrice=&minQuantity=&maxQuantity=&isFreeShip=y&isFavorite=n&isRtl=all&isOnSale=n&isAtmOnline=n&CatId=0&SortType=price_asc&initiative_id=SB_20130812052022&needQuery=y \$5 for one, lot of 5 are about \$3.5 each.

No can do. This is a custom design and it needs to fit inside of a 7/8" diameter tube. I have about 2.5" of length to work with, stacking two PCBs to accommodate everything (AVR, micro SD, USB connector, buck/boost circuit, battery charging circuit, all supporting bits and pieces of components).