power latch circuit - Page 1
Forum section: electronics / projects

author: georpo
author_rank: Contributor
timestamp: November 14, 2020, 02:59:57 pm
content: Hello everybody.I have made a battery operated circuit. Attached is the power supply stage only.The operation is simple.When the button is pressed, the P-mosfet turns on, gives power to the CPU which turns on the N-mosfet and latches, so even if you release the button, the CPU remains powered until it finishes its task and cuts the power by turning off the N-mosfet. This works OK.There are 2 cases when the CPU must turn on.Ones is by pressing the button as described above and the other is by connecting the battery.That is why I use the 4.7uF capacitor. When the battery is connected, it pulls the gate of the P-mosfet low and the power circuit latches through the CPU.But when the battery is removed and replaced the circuit must turn on again. Than is why I use the 1M resistor the drain the capacitor.All the above are working perfectly, BUT!1) The 1M+100K resistors draw some current from the battery.2) You have to wait for some minutes for the capacitor to empty before connecting the battery again. A smaller resistor than the 1M would mean more wasted power.Any good ideas?Thanks!

author: Peabody
author_rank: Super Contributor
timestamp: November 14, 2020, 03:21:43 pm
content: I don't see a way to do that. But I wonder about the requirement that the CPU starts up when power is connected - without having to push the button. Typically you don't want that to happen, and may have to take steps to prevent it.

author: georpo
author_rank: Contributor
timestamp: November 14, 2020, 09:09:59 pm
content: If the 4.7uF capacitor is empty it will pull the P-mosfet gate to 0v for some time. It is more than enough.

author: mjkuwp
author_rank: Unknown
timestamp: November 15, 2020, 04:08:43 pm
content: Can you put a capacitor between the N-Channel Mosfet gate (top of 100k resistor) and + of the battery. this starts as a short when the battery is connected turning on both FETs. Of course the micro will need to turn on quickly and latch the circuit with the output.

author: georpo
author_rank: Contributor
timestamp: November 15, 2020, 07:48:12 pm
content: Yes of course but it is the same problem from the other side.I also have to put a resistor to drain the capacitor so it can work again if I remove and replace the battery.The resistor wastes power.

author: mjkuwp
author_rank: Unknown
timestamp: November 15, 2020, 09:03:00 pm
content: I guess I am not seeing why the 4.7uF capacitor is required.also, a button could be used to pull the gate of the N-Mosfet High rather than using it to pull the gate of the P-Mosfet low.perhaps the 100k pull-down resistor can be changed to something higher - even 1M to reduce waste of currrent.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: November 15, 2020, 09:22:15 pm
content: A 1 MOhm resistor is not needed, the capacitor will be discharged by an open lower transistor or button. (for future reference, number the elements in the diagram). As soon as the CPU turns on, it will start self-locking and simultaneously discharge the transistor. You will only consume the battery with a capacitor leakage current through a 100k resistor - this is a fraction of a microampere.But why do you need to build such a garden, if modern MPU / CPU have a deep sleep mode and can be woken up by a button, they naturally wake up when the power supply is applied.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: November 15, 2020, 09:31:30 pm
content: Or use a little modification of the front detector if you want each quick battery change to turn on a circuit.

author: georpo
author_rank: Contributor
timestamp: November 16, 2020, 06:17:10 am
content: S. Petrukhin, yes the lower transistor will discharge the capacitor indeed. But when the cpu decides that it must cut the power then the capacitor will charge again through the 100K resistor.When you remove the battery, the 1M resistor will discharge the capacitor but you have to wait for some time. After that you can reconnect the battery to wake the system.The reason for all this is that the circuit above does not power only the cpu. It powers RF chips, RF amplifier, eeprom, e-paper, external ram etc etc. All these draw a lot power when they are connected to the battery. With the method above I cut the power completely and I have an external RTC play the role of the button.The point here is to avoid the wait time for the capacitor to discharge.Thanks.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: November 16, 2020, 11:17:58 am
content: You can connect the processor to a constant power supply and use sleep mode. If you use STM32, the built-in RTC is very good. And the processor will turn on power for all other consumers. Or use the single pulse generator circuit that I indicated in the previous post. This generator generates a pulse to both edge. If you use an optocoupler with a single led, its polarity together with an external diode will highlight the front or back edge. This generator will play the role of a button when the battery is connected.

author: Zero999
author_rank: Super Contributor
timestamp: November 16, 2020, 12:54:20 pm
content: Quote from: georpo on November 14, 2020, 02:59:57 pmDo you really need such a big capacitor?Get rid of the 1M resistor.Add a diode across the 100k resistor, with the cathode connected to +V.

author: Peabody
author_rank: Super Contributor
timestamp: November 16, 2020, 02:52:12 pm
content: Quote from: georpo on November 16, 2020, 06:17:10 amIf you have an external RTC turning on the power, can't you just let it power things up at the right time? If the battery is changed during the off time, the RTC won't notice or care, and will still power things up at the appropriate time. And if the battery is being changed when the RTC tries to turn the power on, its alarm output will stay low until the alarm is cleared, so power will turn on as soon as the battery is replaced. I guess I still don't understand the need to have mere battery replacement trigger the power back on.Edit: In fact, with the RTC, you may not even need the N-channel mosfet since you can control when the alarm is cleared.

author: Zero999
author_rank: Super Contributor
timestamp: November 16, 2020, 07:25:29 pm
content: The suggestion I made earlier will only work if there's something else in the circuit to discharge the capacitor. A transistor can be added to discharge the capacitor, when the power is disconnected. The resistor values can all be multiplied by 10 and C1's value divided by 10 and it will probably still work, whilst using nearly a tenth of the power, although it'll be more susceptible to noise.