Nfet vs Pfet for external device switching - Page 1
Forum section: electronics / projects

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 23, 2023, 08:16:25 pm
content: Hi,I'm designing little CO2 laser control board (24V input) and want to implement 2 PWM power outputs for LED strip (up to 1.5A) and for a pump (up to 1,5A).Low side switching for external devices "doesn't seems right" at best, so my original intention was to usePNP fets. But gate voltage of those fets is +-25V (absolute maximum) – way too close to supply voltage.What would be recommended path – try to limit maximum gate voltage via drop out diode (D65) and zener diode (D66) or something similar or just go with NPN?U4 –Fet driverP.S. I'm not expert in power stuff.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 23, 2023, 11:12:48 pm
content: What are the reservations about the low side driver?In any case, there are much better MOSFET drivers than the transistor pair - for example:https://ww1.microchip.com/downloads/en/DeviceDoc/mic5011.pdfIt has a charge pump needed for high side and the zener.The divers can do even more when diving a half bridge, giving a bunch of protections.

author: ajb
author_rank: Super Contributor
timestamp: April 24, 2023, 01:11:49 am
content: There’s really nothing wrong with low side switching of basic loads. If it were something with other connections where that would be a problem, sure, but an led strip or a motor are just fine. You still want high side wiring protection if you’re running those wires through grounded equipment, but that can be the overload protection built in to the power supply in many cases.That said, you can use N- or P-channel FETs in high-side switching. N-channel typically have lower on resistance and so make more efficient switches, but have the downside of needing a charge pump or similar to provide a gate voltage that’s positive wrt the supply voltage. Fortunately there are ready-made solutions like the one that dobson741 linked.But it’s worth considering if you really want a FET driver like that. Mostly FET drivers are used to achieve faster switching, which is more efficient, but also more prone to emitting EMI, especially when driving offboard loads with long(ish) wires. You can add filters and other mitigation methods, but simply not switching so fast in the first place can address the problem at the source (). It’s a bit less efficient, but that can be mitigated by lower PWM frequencies, and isn’t important for an on/off load, as long as you stay within the SOA of the FET.When using a P-channel FET on the high side, as you’ve noticed, you can’t just pull the gate to ground from 24V. D65 does kinda help that, but going from 24V to 23.3V when abs max is 25V still leaves you way too tight on margin. Remember that absolute maximum ratings are the line beyond which the datasheet and all guarantees about proper function—let alone performance—go out the window. Your design margin needs to be sufficient to absorb supply voltage tolerance/load regulation and any overshoot caused by load path inductance without getting into that territory. Furthermore, to whatever extent that diode helps you limit the max gate voltage, it reduces your ability to turn the gate off, because it limits the ability of the gate driver to pull the gate to the supply voltage to get Vgs to zero. How much of a problem that is depends on the Vgs(th) of the FET and your switching requirements.A zener on the gate is better, but should be between the gate and source, because the thing you’re trying to limit is the gate-source voltage. Low speed switching can be as simple as a small low-side transistor that pulls the gate/zener cathode towards ground by a suitable resistor.Simplest solution is still a low-side N-channel FET, though.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 24, 2023, 11:47:00 am
content: Quote from: ajb on April 24, 2023, 01:11:49 am– this is my main concern, everything will be grounded to reduce 20 KV laser EMI. But it seems there is no other way as bootstrapping will not do as pump has its own electronics and PWM will probably mess with its brains.Quote from: ajb on April 24, 2023, 01:11:49 amYeah, I knew when I was adding them that those two diodes is like pissing on raging fire...I really don't need PWM on those outputs, just thought would be nice feature, slow switchin is fine so a small relays would also do?

author: ajb
author_rank: Super Contributor
timestamp: April 25, 2023, 02:30:19 pm
content: Quote from: 3dgeo on April 24, 2023, 11:47:00 amWell if you can't PWM the pump, then you can't PWM the pump, but none of that means you can't/shouldn't just use low-side switching to turn it off and on.QuoteSure, you could use relays if you want. But a transistor would be perfectly fine too.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 27, 2023, 01:23:47 pm
content: Do I understand this correctly – the problem in my original picture can be fixed by connecting U4 (gate driver) C2 pins not to GND but to higher voltage, lets say 5V or 12V (same reference)?I have buck converter on the board that at the moment created 12V, is it OK to connect like in the picture? Will there be any negative effect on 12V line by doing this?If circuit below is valid I would like to reduce 12V rail to 5V ( I assume reducing it to 3.3V is a bit too low for this purpose?).

author: Zero999
author_rank: Super Contributor
timestamp: April 27, 2023, 05:22:56 pm
content: That gate driver IC is just a pair of emitter followers. It lacks the necessary level shifting to control a P-channel MOSFET on 24V, using a lower voltage control signal.What logic level is the PWM signal? Another transistor and a couple of resistors are required to shift the signal to your driver IC.Here's an example. In your case, Q2 and Q3 can be replaced by your MOSFET driver IC. The voltage into the MOSFET is R2*(V2-0.7)/R1, about 6.5V when V2 is 5V, in this case. Alter the ratio of R1 and R2 for a different gate driver voltage.

author: ajb
author_rank: Super Contributor
timestamp: April 27, 2023, 05:57:29 pm
content: Aside from the lack of level shifting, what you have sketched out would probably work, but there are a couple of things to think about:- If you were to try to turn the transistor on while the 12V supply was off, you would still end up violating Vgs(max). So ideally you'd want to provide some sort of lockout, which could be done in software, or by powering whatever is providing the PWM/control signal from that 12V supply.- Probably not an issue for your specific application but: Most voltage regulators can only source current, meaning they can only raise their output voltage against some sort of load that is connected to a lower voltage (usually ground). What they can't do is sink current from a load connected to a higher voltage. By placing your gate drive circuit between the +12V and +24V rail that's exactly what you've created. You could think of the buck converter and the gate drive circuit as being in parallel between +24V and +12V, which means they're in series with the load between +12V and ground. That means that the current through the 12V load is the sum of the current through the gate driver subcircuit and the current provided by the buck converter: Iload= Igd+Ibuck. Or rearranging, Ibuck= Iload-Igd, which shows that the buck converter supplies the difference between the 12V load and the gate driver current. As long as Iload>=Igd, then everything's fine, but if the gate driver current ever exceeds the load current, then the voltage on the 12V rail is going to start increasing due to the excess current.Zero999's circuit would certainly be a simpler way to go, though, since it sidesteps both of those issues entirely.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 27, 2023, 07:48:58 pm
content: 12V rail was for Nfet gates, with Pfets that rail will be 5V, not 12V. 5V further will be step down by linear regulator to 3.3V for MCU.Quote from: Zero999 on April 27, 2023, 05:22:56 pmOh, I need a gate driver for my gate driver...Logic level can be 5V (open drain) or 3.3V (push pull).Quote from: ajb on April 27, 2023, 05:57:29 pmMCU will be powered from that lower rail.Quote from: ajb on April 27, 2023, 05:57:29 pm– this is exactly what I had in mind when asking if there will be any negative effects.I assume there will be high current spikes on gate charge/discharge, but average current shouldn't be a problem with enough filtering even with only linear regulator (should "eat" voltage spikes too?) and MCU being "down the line"? I mean if, as you've written, Iload>=Igd. MCU should draw at least 50mA, status LED will add few mA.Working with Pfets is pain...

author: ajb
author_rank: Super Contributor
timestamp: April 27, 2023, 08:28:15 pm
content: Quote from: 3dgeo on April 27, 2023, 07:48:58 pmYep, the gate driver should only consume an appreciable amount of current during the brief period of time when the PFET is transitioning between off and on state. That pulse of current is unlikely to make a significant dent in the output caps on the buck regulator, and likely averages out to a pretty low level over time. Hence unlikely to be a problem for you in this case, but in other cases, or if you ended up with a gate driver that had some particularly high quiescent current and a 12V load that has a particularly low quiescent current, it could be an issue. Sounds like you're good there

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 28, 2023, 05:26:41 am
content: Quote from: Zero999 on April 27, 2023, 05:22:56 pmWhat do you mean by "The voltage into the MOSFET...", perhaps you meant "MOSFET driver" not "MOSFET"? Driver is fine with voltages up to 40V so why 2 resistors (R1,R2) are needed? Why only R2 (perhaps at a higher value) and a Q1 would not do?P.S. shouldn't be Q3 Q2 swapped?

author: Zero999
author_rank: Super Contributor
timestamp: April 28, 2023, 11:57:04 am
content: Quote from: 3dgeo on April 28, 2023, 05:26:41 amYour driver is just two emitter followers, like Q2 and Q3 in my circuit. The problem is not the driver, but the MOSFET gate voltage rating.QuoteNo, they would blow up. Again Q2 and Q3 represent the transistors in your driver. Refer to the data sheet.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 28, 2023, 02:01:26 pm
content: The best “Everything You Always Wanted to Know About MOSFET driving (But Were Afraid to Ask) guide:https://reipooom.files.wordpress.com/2011/08/mosfet-must-read-2-slup169.pdfThe applicable simplest solution is fig. 19 for 3dgeo’s case, given the seldom on/off no PWM scenario.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 28, 2023, 03:54:26 pm
content: I clearly know way too little about transistors...I've implemented it in my schematics, can I useDTC123JEas a Q1 (Q4 in my picture) as I already have it in BOM?Will FET fall/rise time suffer from this driving circuit? What would be recommended value for "R?" gate resistor?Quote from: dobsonr741 on April 28, 2023, 02:01:26 pmYou mean something like this (R1=R2=5K)?

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 28, 2023, 04:18:59 pm
content: If your PWM is not a high frequency, let's say less than few KHz, the dissipation caused by the not-so-fast gate driver is acceptable. What's the MOSFET - did you choose one already?You mentioned driving a pump - is it an inductive load? If so, I recommend more precautions on the output to suppress transients/peaks.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 28, 2023, 04:38:32 pm
content: Quote from: dobsonr741 on April 28, 2023, 04:18:59 pmPWM is not required, it would be nice feature and I'll probably implement Zero999 circuit just to see and test how it works.Pump is not intended to be PWMed, but I've added flyback diodes on LED and Pump screw terminals just in case.

author: Zero999
author_rank: Super Contributor
timestamp: April 28, 2023, 04:50:51 pm
content: Quote from: 3dgeo on April 28, 2023, 03:54:26 pmThat transistor is unsuitable because it has built-in bias resistors. You need just a plain transistor, without any built-in resistors, such as the BC847. Also stick to standard resistor values for R1 and R2: 1k and 4k3 or 4k7 will be fine.The gate resistor should be something like 10R to 47R. It's just there to damp any resonance.QuoteThat will work for DC, but it's too slow for PWM.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 28, 2023, 05:20:08 pm
content: QuoteGreat, no PWM simplifies.R1+R2 = 5K is reasonable, should divide 24V not to exceed the MOSFET's max Vgs specs, and be enough to drive the few into saturation at the desired current.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 28, 2023, 05:27:31 pm
content: Willthesetransistors do?Is there any notes on how much resistance R1/R2 shoul have (while maintaining ratio)? For example 10k and 43K or 100K and 430K instead of 1k and 4k3? What impact that would make on Pfet gate?P.S. dobsonr741 – Pfets:HSBB3103

author: Zero999
author_rank: Super Contributor
timestamp: April 28, 2023, 05:35:58 pm
content: Quote from: 3dgeo on April 28, 2023, 05:27:31 pmThey'll do.QuoteHigher resistor values will result in slower switching, but lower current consumption. The resistance seen by the MOSFET is roughly the value of R2 in my circuit divided by the hFEof Q2 and Q3 in my circuit.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: April 28, 2023, 05:48:48 pm
content: The MOSFET is a bit low spec'd in Vds breakdown. You supply is 24V, the MOSFET is at 30V. Given its CH origin, I'd build in more safety. More like a 60V type.R1, R2 = 3.3K will dissipate 43mW each when turned on, not a big drama.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 28, 2023, 06:06:46 pm
content: Quote from: Zero999 on April 28, 2023, 05:35:58 pmSo if I understand it correctly – wasted current (~4.5mA with 1k and 4k3)via Q1 (in your picture) vs rise/fall time?Quote from: dobsonr741 on April 28, 2023, 05:48:48 pmI see your point, but I like small package and price, I will look for replacement if there will be issues.As I've said I do not expect spikes from pump, adding diodes on output anyway, will be using quality PSU and have 100u power cap, also regulator is rated up to 28V so it will die firstThis is only a test board, I might even go for 12V PSU cuz it turns out 24V makes entire board way more complex than needed...

author: Zero999
author_rank: Super Contributor
timestamp: April 28, 2023, 09:00:04 pm
content: Quote from: 3dgeo on April 28, 2023, 06:06:46 pmNot quite.Q1 forms a current sink. The current is determined purely by the value of R1 and the base voltage, V2 in this case. Here's a plot showing the current is constant, as R2 is changed. Obviously there's a limit, as the current will fall once the voltage across it exceeds that of R1, by Q1's saturation voltage.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 29, 2023, 05:14:35 pm
content: I've updated shematics, now it looks like image below.What will happen if power supply voltage changes, 12V instead of 24V?As with new driving circuit there is no need to keep 12V or 5V rail I've changed buck regulator to spit out 3V3 and removed LDO.One place I still need 5V is laser PWM output (high impedance input). If I want to change PSU voltage voltage divider is not a good choice, so I came up with circuit below (R9 purpose is to let user control upper PWM voltage). PWM will be up to 100KHz, Opamp –LM321.Also in a same image I've added buzzer driving circuit, as Q4 was not suited in gate driving circuit I want to make sure I'm not missing something in this one.Plese let me know if there are any issues with these two circuits, thank you.

author: Zero999
author_rank: Super Contributor
timestamp: April 29, 2023, 05:36:42 pm
content: Quote from: 3dgeo on April 29, 2023, 05:14:35 pmYou've got the resistor values backwards.If the voltage is reduced to 12V, the MOSFET gate drive will be reduced. Remember the shifting transistor acts as a current sink, which will fall out of regulation, once the supply voltage drops too low.QuoteThe LM321 is no good for 100kHz. If it's just a squarewave, there's no need for an op-amp. You're better off going back to the 5V supply and using a 74HCT gate to get 5V from the 3.3V output.

author: ajb
author_rank: Super Contributor
timestamp: April 29, 2023, 07:12:23 pm
content: Quote from: Zero999 on April 29, 2023, 05:36:42 pmAside from the speed issue with the selected op amp, the output impedance of the circuit (1k-6kR depending on potentiometer setting) is rather high. I would assume the laser driver to have an input impedance on the order of 10k-50kR, so you might see something like a 10% reduction from the expected output power (assuming the driver even supports analog power control on the PWM input, and is relatively linear). You'd be better off putting the potentiometer between the PWM signal source and the input of the op amp, with probably no more than 200R on the output.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 29, 2023, 07:30:50 pm
content: Quote from: Zero999 on April 29, 2023, 05:36:42 pmQuote from: Zero999 on April 29, 2023, 05:36:42 pmMostly I still have no idea how that works... But as I understand with 12V supply (VIN) gate voltage will swing between 12V(VIN) and 0.82V, that is (VIN - 11.18V), right? And with voltages below 11.18V it just swing between VIN and 0?Quote from: Zero999 on April 29, 2023, 05:36:42 pmYou are right, MCU can sink 5V so no need for 74HCT as well.Quote from: ajb on April 29, 2023, 07:12:23 pmThank you for your reply, I will remove Opamp and will go with LDO.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: April 29, 2023, 08:04:18 pm
content: I totally forgot how annoying it is to prevent false trigger with open-drain output and still have option to limit PWM upper voltage.What maximum frequency that Opamp can handle? 1K/10K?

author: ajb
author_rank: Super Contributor
timestamp: April 29, 2023, 08:41:20 pm
content: The maximum frequency for an op amp is obtained from the Gain-Bandwidth Product. Divide that by the gain of the amplifier and that's your max frequency. LM321 has a GBW of 1MHz, so you can operate it at 1MHz with a gain of 1, or a at 200kHz with a gain of 5, or 667KHz with your gain of 1.5. Note that this is assumes a sine wave. The maximum square wave frequency that the amplifier can handle while still getting something that looks like a square wave at the output will be substantially lower, depending on your rise/fall time requirements. Rise time is approximately 0.35 divided by the bandwidth, but what this means for your circuit depends on what the laser does with the input signal.

author: Zero999
author_rank: Super Contributor
timestamp: April 29, 2023, 09:33:08 pm
content: Quote from: ajb on April 29, 2023, 08:41:20 pmThe slew rate limits the LM321's ability to output a 100kHz 5V squarewave, before the bandwidth is an issue.Quote from: 3dgeo on April 29, 2023, 07:30:50 pmGo back to the circuit I posted in my previous post.https://www.eevblog.com/forum/projects/nfet-vs-pfet-for-external-device-switching/msg4837529/#msg4837529Q1 is a common emitter amplifier. It behaves like a voltage controlled current sink. The voltage across R1 is VBEbelow V2. The current through R1 is proportional to the voltage across it. Assuming the hFEof Q1 is very high, the collector current is nearly equal to the emitter current, which is flowing through R1. The collector current is purely dependant on R1 and V2, until R2 becomes so high, the voltage drop across it exceeds V1 + the voltage drop across R1.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: May 03, 2023, 07:27:01 am
content: Quote from: ajb on April 29, 2023, 08:41:20 pm100kHz was a bit overstatement, I'm sure 1kHz to 10kHz will do. I still haven't came up with simpler and more effective solution.Quote from: Zero999 on April 29, 2023, 09:33:08 pmThat makes sense, thank you for all your help, though as I've said analog is not my horsyYour old postwhere you posted signal and output picture came in handy.