Big mosfet troubles - Page 1
Forum section: electronics / beginners

author: bryce1
author_rank: Regular Contributor
timestamp: April 27, 2013, 10:36:01 am
content: Hi guys,I designed my first circuit and manufactured a small batch of pcbs. But it seems I did not really understand p-channel mosfets well enough.Here is the situation (attiny gets 3.3V):attiny ---------------- G 1|10k| 3 D ------ max 1A|VCC -------------------S 23.7-5.5VIf I pull down the attiny pin (output/sink), then I have 0V on the gate and drain gets power.But if I drive the pin HI-Z, gate gets around 3.8V which does leaves the mosfet open and drain still gehts power.Is there any SOT23 device that does what I want (just turn on and off)?I'd hate to through 30pcbs away

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 10:43:11 am
content: Which MOSFET did you use?You would need something likeNX2301Pmaybe?Check voltage at the gate when you think it should be off, maybe its just a software error...

author: bryce1
author_rank: Regular Contributor
timestamp: April 27, 2013, 10:51:27 am
content: The IRLML6401. But I don't know if there exists a p mosfet that does what I want. If so, please tell me.It is not a software error. The pin switches correctly. The problem as I understand it is this:- 0V on the attiny means Vgs 5V => mosfet on- with HIZ, gate does not go to full 5V but only to 3.8V => mosfet still on

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 11:08:20 am
content: That should work. Measure voltage between gate and source. There must be something else going on.

author: bryce1
author_rank: Regular Contributor
timestamp: April 27, 2013, 11:14:21 am
content: Why? If there are 5V or more, Vgs is still -1.1V and the mosfet is on.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 11:19:54 am
content: Ah I see whats your problem.You are trying to drive high side P mosfet with 3.3V logic signal referenced to GND.Oh well, your only hope would be MOSFET that has a bit higher Vgs(th).But then the variable supply voltage will be an issue as it will be moving the threshold voltage around.For a fixed 5V supply, you could try to find a MOSFET that has Vgs(th) a bit higher than 5-3.3=1.7V. Probably around 2V.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 11:31:44 am
content: And what you see is probably an effect of the ESD protection diode on the attinys output, that is a diode that goes to its Vdd (3.3V). Your trick with High Z will not work because of it.If you look at the attinys output as referenced to MOSFETs source, it will look like:For 5.5V supply: High = -2.2V Low = -5.5VFor 3.7V supply: High = -0.4V Low = -3.7VSo you need your Vgs(th) in the range of -2.2V and -3.7V for it to work, something like -2.5V.Look atIRLML5203PBF, that may save you.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 11:39:43 am
content: Normally you dont switch P-MOSFETS like this, you would have to have the microcontroller supply connected with load on the positive rail, not on gnd to work like this.You would normally use something like a NPN BJT to switch the P-MOSFETs gate to ground to avoid the protection diode on the output of microcontroller stopping the voltage from going higher than Vdd+diode drop when off.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 27, 2013, 11:59:47 am
content: Here iswhat is happening to you.If you can find an SOT-23 MOSFET with Vgs(th) slightly above 2.2V you will be saved.

author: bryce1
author_rank: Regular Contributor
timestamp: April 27, 2013, 08:01:18 pm
content: Thx for your answers. I just don't seem to find the right part.

author: ConnorGames
author_rank: Regular Contributor
timestamp: April 28, 2013, 12:11:46 am
content: It would need a few bodge wires, buthttp://www.mouser.com/ProductDetail/Exar/XRP2523ISTR-F/?qs=qEsBbuNSbDkgI9wVGNO8cQ%3d%3d(XRP2523ISTR-F) might do the job.EDIT: I misread the pin-out of the FET. This answer doesn't make sense. I thought this would be able to be bodged in fairly painlessly, esp. compared to the diode solution which involved cutting traces, but I was wrong.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 28, 2013, 12:56:26 am
content: If you want to try to bodge a bit, you may be able to stick a diode or two or a zener between pin and gate+pullup to shift the voltage on the gate above the turn-off threshold on high...

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 28, 2013, 03:02:32 am
content: Here's a couple more ideas...1) Run your ATtiny at 5V. This way the ESD protection diodes don't conduct when you tri-state the output pin.2) Replace the MOSFET with a pin-compatible pre-biased PNP transistor. I thinkthis oneis pin-compatible. You likely won't be able find a PNP transistor in a SOT-23 package that can do 1A, however. The one I linked to can do 500mA.The attached simulation is for case 2. Note that D1 and D2 are the MCU's ESD diodes. R4 is the 10k resistor in your schematic. R1, R2 and T1 are the pre-biased PNP transistor, all packaged in a single SOT-23. R4 can be left unmounted if you can deal with the transistor not being completely off when the MCU tri-states it output.Edit: The part I linked to has a 1k base resistor instead of a 10k resistor, which is what I used in the simulation. A 1k resistor won't work.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 28, 2013, 07:09:29 pm
content: Quote from: TerminalJack505 on April 28, 2013, 03:02:32 amThat is actually not a bad idea. Maybe you can replace the 3.3V regulator with 5V LDO and fix any resistor values for LEDs etc...Anyway, lesson lerned the hard way:Thou shall prototype before running big manufacturing batchesIf only because simulations sometimes lie:

author: bryce1
author_rank: Regular Contributor
timestamp: April 29, 2013, 06:31:34 am
content: Not possible, because I need the stable 3.3V for USB and I get 3.7 - 5 from the supply.

author: Skippy
author_rank: Contributor
timestamp: April 29, 2013, 08:41:24 am
content: Could you replace with an n-channel mosfet and invert the output from your pin?

author: bryce1
author_rank: Regular Contributor
timestamp: April 29, 2013, 10:01:02 am
content: I tried a n-Mosfet (FDN335N) between the p-Gate and the uC, now the p-mosfet is always off...What am I doing wrong?

author: MasterOfNone
author_rank: Regular Contributor
timestamp: April 29, 2013, 11:09:47 am
content: If all else fails then desperate times calls for desperate measures.Replace the MOSFET with a pin compatible PNP transistor (not pre-biased). Add the correct value bias resistors to your circuit refer to the post by TerminalJack505’s for suggested values:Cut the track on the PCB to the base of the transistor, so that the transistor base is isolated.Use two standard through hole resisters for the bias resistors. Solder one end of the each resistor to the transistor base pin.Solder the other end of one the resisters to the correct side of the 10K on the PCB. Solder the other end of the remaining resistor to 5V. The circuit should look like TerminalJacks’s.Remember to use wire links on the resistor to extend the length if needed. Use sleeving to cover the leads of the resistors to stop the from shorting. Glue the resistors down.If you cannot cut the track then lift the pin on the transistor from the PCB to isolated the base, or possibly place some type of isolator on the pad.Then last but not least, knock your spurs together and shout hey-ha.

author: Dave
author_rank: Super Contributor
timestamp: April 29, 2013, 11:25:21 am
content: Quote from: bryce1 on April 29, 2013, 10:01:02 amYou have switched drain and source on your N-FET.

author: bryce1
author_rank: Regular Contributor
timestamp: April 30, 2013, 08:31:24 pm
content: indeed i have