P-Mosfet Vin/USB5V auto switch - Page 1
Forum section: electronics / projects

author: ant452
author_rank: Newbie
timestamp: November 27, 2012, 02:39:26 pm
content: Hi All,Long time EEVblog viewer first time forum poster.I was after some help understanding the following circuit (attached).The circuit snippet comes from the Arduino Lenoardo (http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf) board but the same is implemented in many places. I paraphrased the regulator part but I think you'll get the idea.The purpose of the circuit is to disconnect the USB power when Vin is applied & 1/2 Vin is greater than 3.3v - this is the OP-Amp part which I'm ok with. If Vin > 6.6v the OP-Amp output and hence the P-MOSFET gate is HIGH (ie +5v)I'm getting stuck on the P-MOSFET part (or just over analysing).The P-MOSFET is a logic level P-MOSFET with a Vgs threshhold (Vgsth) of -1.5vFor P-MOSFET Vgs < Vgsth to be turned on.So...Case when Vin appliedWhen Vin > 6.6v the OP-Amp output and hence the P-MOSFET is HIGH (ie +5v), so Vg = 5vthe +5v rail will be at its 5v, so Vs = 5.Hence Vgs = 0, which in not < Vgsth of -1.5v so the P-MOSFET is OFF.OK, that sits fine with me, thats what we want power the circuit from VinCase when USB appliedVin = 0 so the OP-Amp output and hence the P-MOSFET is LOW (ie 0v), so Vg = 0v>Q1>Will the +5v rail be at 5v? If so how? I mean the idea is that it should not be and hence we switch on the MOSFET to give us 5v.Anyway if we assume +5v rail = 5v, so Vs = 5Then Vgs = -5v thus Vgs < Vgsth and the P-MOSFET is on and hence supplies 5v to the +5V railOK, but I don't understand fully, hence the above questionAlso for P-MOSFET I thought the source to always be more positive than the drain and current flow was from source to drain is this correct? or once the MOSFET chennel open can you force current either way?..I was thinking maybe the P-MOSFET should be connected the other way... Source to USB & +5v rail to Drain with Op-Amp remaining connected to Gate. this would mean the Vgs relation ship is between USB power and Vin which sort of makes sense.Then when USB power on and no Vin, Vgs=-5 hence P-MOSFET on, thus connecting USB power to +5v railAnd when Vin applied Vg=5v so Vgs is 0 (if USB connected) or +5 (if no USB) either way P-MOSFET is off which is the desired state as the circuit would be powered from VinOk I'll stop there sorry for the long post I'v also probably made an obvious error, over analysed and confused myself- and possibly others.If your able to help me out to understand this that would be greatThanks//Andy

author: dr_p
author_rank: Frequent Contributor
timestamp: November 27, 2012, 03:08:03 pm
content: Quote from: ant452 on November 27, 2012, 02:39:26 pmop-amp output is zero, but Vgs is -5V, cause Source is at +5V potential.

author: ant452
author_rank: Newbie
timestamp: November 28, 2012, 01:00:45 pm
content: Thanks dr_pBut forCase when USB appliedhow does Source, Vs at +5v?If only USB connected how does the +5v rail connected to source (Vs) become 5v in the first place. I mean the P-MOSFET has to be on to allow USB power to connect to the +5v rail... a bit of a chicken and egg scenario...could it be related toDrain-?Source Diode Characteristics, Vsd 0f -1.2???will have to test this out once back home, currently away for a bit and missing a breadboard

author: dr_p
author_rank: Frequent Contributor
timestamp: November 28, 2012, 05:27:51 pm
content: I'm quite noob at FETs, so I'd rather not say anything more cause I'm not sure it's right. Maybe someone else can enlighten you.

author: alexig
author_rank: Contributor
timestamp: November 30, 2012, 02:40:32 pm
content: Quote from: ant452 on November 28, 2012, 01:00:45 pmI think you are right, this means that at worst case 3.8V will be at Vs (so -3.8Vgs) which will turn on the Mosfet and then it will bypass the diode all together as it's the least resistance path to give 5V.