4
\$\begingroup\$

I was making a board with an atmega328 mcu (to be used with Arduino libraries) to do some one wire communication stuff. Since I was etching the board anyway, I decided to try and implement a simple software off functionality, without putting much thought into it. Once I etched and assembled the board, my one-wire stuff works fine, but the software off circuit does not. I was poking around and I can't understand why it does not work.

The idea is that pushing a momentary push button (for 2-3 seconds), will connect the battery to the 5V regulator which in turn powers the MCU. The first thing the MCU does is set a digital pin high (line labeled PWR in the below diagram), to latch the N-MOSFET Q1 and bypass the push button switch. When the switch is released, the circuit should remain powered through the MOSFET.

What in reality happens is that pushing the pushbutton powers up the board as expected. The gate of the FET is driven to 5V by the MCU as expected, but as soon as the pushbutton is released, everything turns off. It seems that the FET is not bypassing the pushbutton for some reason, but I can not understand why? The FET Vgs is 1.8V, R6, R7 and D1 are there so I can use another push on the button to generate an interrupt on the BTN line, then drive the PWR line low and switch off the board.

So the question is what is wrong here? Why doesn't Q1 MOSFET stay latched once the pushbutton (connected to PWRSW header) is released? I'm certain it is not something complicated, but I just can not understand why - perhaps because I've been staring at it for too long...

Circuit Diagram

\$\endgroup\$
  • \$\begingroup\$ What is the voltage at the source (pin 2)? \$\endgroup\$ – geometrikal Nov 26 '14 at 21:29
  • \$\begingroup\$ Are you sure that the body diode of AP2302AGN (Q1) is drawn in the correct direction? I think, it's drawn in a wrong direction. But I don't think that's what prevents Q1 from staying on. \$\endgroup\$ – Nick Alexeev Nov 26 '14 at 21:29
  • \$\begingroup\$ @NickAlexeev PWR is 5V, S must be more than that, so how can it stay on? I'm guessing Vgs is actually -1.8V... \$\endgroup\$ – geometrikal Nov 26 '14 at 21:34
  • 1
    \$\begingroup\$ This application needs (or at least is much easier with) a P-MOSFET, pulling PWR low to stay on. \$\endgroup\$ – Brian Drummond Nov 26 '14 at 21:35
  • 1
    \$\begingroup\$ Thanks for help guys, I failed to see Vgs is gate voltage relative to source voltage, not an arbitrary ground as pointed out in the answer below. In my application, Vgs(th) is indeed -4V or so, so yeah... not dice. I only have N-FETs in the parts bin unfortunately.. \$\endgroup\$ – IgorEE Nov 26 '14 at 21:46
11
\$\begingroup\$

+5V with respect to GND is not high enough to turn on Q1, which is an N-channel MOSFET in the original schematic. The O.P. was thinking in the right direction, when he had looked-up the VGS. But with respect to what is the VGS taken? It's not taken with respect to GND. It's taken with respect to MOSFET's source is at +7.5V (or some such voltage required for the 7805). So, the if you drive the gate to +5V, then VGS < 0. It's negative. The N-channel MOSFET doesn't stay on, because it doesn't turn on in in the first place.

A high-side switch like this is usually done with a P-channel MOSFET and a second small transistor to control its gate. Like so:

enter image description here

(I didn't redraw all of the original circuit, but this should be enough to get the idea across.)

\$\endgroup\$
3
\$\begingroup\$

VGS(th) is relative to the source, not any arbitrary ground point in the circuit. There is no way you can pull the gate voltage high enough to turn the MOSFET on with that circuit. Consider using a PMOSFET instead.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.