Auto power off / soft latch circuit does not work properly

Good afternoon,

I am working on a project involving an atmega328p (Pro Mini / 3.3v version) which has the ability to shut down automatically and to be turned on by simply pressing a button, and it is powered by a 3.7v LiPo battery.

But I have just encountered the following problem (see schematic below): using a multimeter, I found out that right after connecting the battery, the VCC pin reads 3.2V, and while the positive terminal of the battery is connected to the SW_PWR contact, the voltage rises up to 3.8V (the same voltage as the battery). For now, I am unable to test the SHDN pin, which is responsible with cutting the power from VCC.

Here is how things should work:

  1. Battery is connected. VCC = 0V
  2. The user presses the power on button (shorts VBAT and SW_PWR). Now VCC should read the same voltage as the battery and the Arduino will start holding the SHDN pin HIGH.
  3. After the program finishes execution or the user presses the power on button again, SHDN will be pulled to LOW, hence the VCC pin will drop to 0V.

The project is currently on a PCB. Here is the soft latch circuit schematic: Soft latch circuit schematic. Also contains the part number of the components used.

Here is the pin description:
VBAT = positive battery terminal
GND = negative battery terminal
SW_PWR = power button. The pin will be either open or connected to VBAT when the button is pressed.
VCC = voltage supplied to the Arduino and the rest of the project
SHDN = shutdown pin. Will be connected to a digital pin of the Arduino.

Any help is greatly appreciated. Thank you.

When you release the button, does Vcc voltage drop back down to 3.2V?

When you first connect the battery, the circuit may power up on its own. That's because with the mosfet gate capacitance discharged, when power comes up it will immediately go to 3.8V on the source, but it will take some time for current to flow through the 100K resistor to charge up the gate. Until it does, the gate voltage will be below the source voltage, and the mosfet will turn on. It may stay on long enough for the processor to boot and assert SHDN. That is usually solved by installing a small capacitor in parallel with R7.

But that doesn't explain the 3.2V on Vcc. Are you sure battery voltage stays at 3.8V when Vcc is at 3.2V?

You said power would stay on until the processor shuts it down or the button is pushed again. There is nothing in the circuit that would cause power to shut down when the button is pushed. Pushing the button can only turn on the power.

Could you measure the voltage at the following points when Vcc is at 3.2V and the button is open:

Vbat
The base, collector and emitter of Q1
The base and collector of Q2
The SHDN pin

Keep in mind that the Pro Mini runs at 3.3v rather than the "raw" battery voltage. Here are the voltages I measured when the button is open and VCC is 3.2V:

SHDN - 0V (digital output pin from Arduino - OFF condition)
VBAT - 3.8V
Q1: base - 0V, emitter - 0V, collector - 3.8V
There is no Q2. Maybe you meant Q3, the other transistor: base - 0V, emitter - 0V, collector - 3.43V
Q4 MOSFET: source - 3.2V, gate - 3.4V, drain - 3.4V

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.

It is easier for you to attach your diagrams and images to your post.
OPs Circuit;

Hi,
Can you please us = rather than -
eg.
drain - 3.4V is confusing is that negative 3.4V?
OR
drain = 3.4V

If you remove Q3, what are the voltages on Q4 and Vcc?
Is Q4 connected correctly?

Tom... :slight_smile:

Hi,

After the program finishes execution or the user presses the power on button again,

How does the program detect that the power button has been pressed again?
Or do you have a controller input pin connected to SW_PWR not shown on the diagram?

Have you got the controller connected to Vcc when you are testing, if not you may need a load on Vcc to gnd to check correct operation.
You may be measuring leakage with the high impedance DMM.

Tom... :slight_smile:

The controller is supplied at 3.3V and has SW_PWR connected to a digital pin via a voltage divider (it can read the button state properly), and SHDN directly connected to a digital pin.

Sorry for the confusion. All voltages are positive.

The controller is also supplied from a 3.3V supply from a regulator connected to a 5V step up converter needed for the project, which is finally connected to VCC.

Kozma:
The controller is also supplied from a 3.3V supply from a regulator connected to a 5V step up converter needed for the project, which is finally connected to VCC.

I'm sorry, we need a complete circuit diagram?
So you have another supply for the controller as well as this switching circuit why?
What do you get when you apply Vbat if you replace the controller with a 470R resistor and leave the SHDN open?
What do you get when you then press the button?
Tom.. :slight_smile:

Here is the circuit schematic. I am afraid I can't remove the Q3 transistor.

Hi,
Sorry that is a net type schematic for PCB design, you have to search-a-word for each connection and it is not the complete diagram.

Can you draw a proper wired circuit diagram showing all your components and their connections.
Where is the ProMini that SHDN is supposed to be connected to?
[soapbox]
The diagram you have made is fine for PCB production, but just about a waste of time for troubleshooting.
Example, the diagram has a wire called SHDN, now to find where it goes I would have to look at every netname to locate where it goes, I would have to look at every netname because there is no indication of how many connections are named SHDN.
Netnames/symbols for gnd and power supply rails are fine, but signal wire connections need "wires"
If you draw a proper wired diagram, you just follow the wire and bingo, you see all your connections.
[soapbox/]

Tom.... :slight_smile:
PS, Did you prototype this circuit on its own before going to PCB, to make sure the button ON/OFF works?
If not, now is the time to get one of your PCBs and JUST populate it with the button switching circuit and get it working before you cloud the problem with other power supplies etc.

Kozma:
Keep in mind that the Pro Mini runs at 3.3v rather than the "raw" battery voltage. Here are the voltages I measured when the button is open and VCC is 3.2V:

SHDN - 0V (digital output pin from Arduino - OFF condition)
VBAT - 3.8V
Q1: base - 0V, emitter - 0V, collector - 3.8V
There is no Q2. Maybe you meant Q3, the other transistor: base - 0V, emitter - 0V, collector - 3.43V
Q4 MOSFET: source - 3.2V, gate - 3.4V, drain - 3.4V

I haven't looked at the full circuit, but:

If Vbat is 3.8V, how can the source of Q4 be 3.2V? They are directly connected according to the schematic.

Is Vcc measured at the Vcc pin of the Pro Mini? If so, why isn't the Pro Mini running and taking SHDN high?

Edit:

Nevermind about Vcc. You said the Pro Mini is running on regulated 3.3V.

See next reply.

I edited my previous reply, but should have put the new part in a new reply. Here it is:

I'm still puzzled by the mosfet. With all three pins essentially the same voltage, the mosfet can't be on.

Actually, the 3.2V might make sense if the mosfet is backwards. There is a body diode from drain to source which should be reverse-biased if the mosfet is oriented correctly. But if drain and source are switched, the diode will be forward biased from Vbat to Vcc, and the voltage drop is about right for that. Then when you push the button, the mosfet turns on fully, bypassing the diode, and you get 3.8V on Vcc. Then when you release the button, it goes back to 3.2V. But if that's the case, your 3.4V reading on the drain couldn't be right - it would have to be 3.8V. So I don't know. Anyway, can I get any other votes for this explanation?

ShermanP:
Actually, the 3.2V might make sense if the mosfet is backwards. There is a body diode from drain to source which should be reverse-biased if the mosfet is oriented correctly. But if drain and source are switched, the diode will be forward biased from Vbat to Vcc, and the voltage drop is about right for that. Then when you push the button, the mosfet turns on fully, bypassing the diode, and you get 3.8V on Vcc. Then when you release the button, it goes back to 3.2V. But if that's the case, your 3.4V reading on the drain couldn't be right - it would have to be 3.8V. So I don't know. Anyway, can I get any other votes for this explanation?

I have similar thoughts, the project appears to me to be an SMD project so swapping connections would be difficult.
@Kozma.
We need an exported jpg image of the PCB to check the connections of the semiconductors.
Can you check the diode junction in the P-CH MOSFET please, let us know where Anode and Cathode are across the Drain and Source.
Thanks.. Tom... :slight_smile:

I believe the standard, almost universal, pinout for an SOT-23 mosfet is:

1 - Gate
2 - Source
3 - Drain

But in the schematic it shows the AO3413 as:

1 - Gate
2 - Drain
3 - Source

So maybe it was a bad footprint. Anyway, I think this explains the problem.

ShermanP:
I believe the standard, almost universal, pinout for an SOT-23 mosfet is:

1 - Gate
2 - Source
3 - Drain

But in the schematic it shows the AO3413 as:

1 - Gate
2 - Drain
3 - Source

So maybe it was a bad footprint. Anyway, I think this explains the problem.

Okay. Would the circuit work if I replace the p channel mosfet with an n channel one?

Kozma:
Okay. Would the circuit work if I replace the p channel mosfet with an n channel one?

No, you have to check and rewire the MOSFET the correct way around.
Which will involve cutting tracks and using wire to swap the connections.
Tom... :slight_smile:

ShermanP:
I believe the standard, almost universal, pinout for an SOT-23 mosfet is:

1 - Gate
2 - Source
3 - Drain

But in the schematic it shows the AO3413 as:

1 - Gate
2 - Drain
3 - Source

So maybe it was a bad footprint. Anyway, I think this explains the problem.

Indeed power MOSFETs generally are very consistent in pinout, checking the datasheet shows the AO3413 is no
exception and the schematic is wrong. http://www.aosmd.com/pdfs/datasheet/ao3413.pdf

What happened I think is that the footprint chosen was for a TO220 MOSFET, where pin 2 is the centre,
substrate(*) connection, whereas for SOT-23 the centre/substrate connection is numbered 3.

When doing a schematic I always check the pinouts for the semiconductors from the datasheets and
sketch them, then I can check the resultant pbc layout agrees with this - "check twice, order once"
is advice well worth following in electronics...

(*) For a standard power MOSFET the substrate connection has to be the drain due to the vertical
current flow through the chip. The only exceptions I know are exotica like GaNFETs and lateral FETs.