Latching Power Circuit - Page 1
Forum section: electronics / beginners

author: zenekNY
author_rank: Contributor
timestamp: July 14, 2020, 10:30:16 pm
content: Hiii!I am working on a device that needs a soft latching power circuit and I am very limited on a PCB space as well as trying to keep the circuitry simple.The plan is to share a dual N channel mossfet used by a Li-Po protection IC with the soft latching circuit. but I cannot get the power to cut-off.My attempt was to interrupt an OD (Over-Discharge) line coming from the protection IC to one of the gates on the mossfet.Can you guys please take a peek at this circuit and tell me what am I doing wrong?Please let me know if you need any more information or if I am not clear enough on what I am trying to do. This circuit is just to test my idea and is a part of a bigger circuit.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: July 15, 2020, 05:15:04 am
content: Maybe you can find your answer here:https://www.allaboutcircuits.com/textbook/semiconductors/chpt-7/silicon-controlled-rectifier-scr/

author: zenekNY
author_rank: Contributor
timestamp: July 15, 2020, 08:40:32 am
content: Thank you for the suggestion, the SCR sounds like a very interesting concept.However I tend to believe that the problem lies somewhere between the OD pin of the protection IC and the gate of the MOSFET.It looks as if the gate of the MOSFET doesn’t draw enough current (if any at all) for the PNP transistor to function properly, but when I pull the Collector of the PNP(gate of MOSFET too) down to the negative of the battery using even 5M ohm resistor it cuts the power off and the transistor is not able to pull that line back up.

author: ledtester
author_rank: Super Contributor
timestamp: July 15, 2020, 11:42:27 am
content: Since a microcontroller can be put into a sleep mode where it draws very little power (microamps or even nanoamps) I would look at simplifying the problem by always having the microcontroller powered by the battery. That way it can always control whether power is delivered to the rest of the circuit.Then add another MOSFET in series with the other protection MOSFETs. This MOSFET is controlled by the micro and implements your soft power switch function.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: July 15, 2020, 11:43:11 am
content: You need bleed resistors on all mosfet gates. They will not turn off themselves unless they are pulled to ground with NPNs and pulled up with PNPs. You should also have a small resistor between any micro pin and the gate of a mosfet. This helps stop the capacitance of the mosfet from damaging the micro's output pins. Even if your micro ground's its pins when it's logic low, you should have the bleed resistor. This is because micros will high-z their pins when being programmed or booting.

author: zenekNY
author_rank: Contributor
timestamp: July 15, 2020, 01:32:39 pm
content: The problem with keeping the entire system on, is that I have a bunch of other things running.Unless I would be able to disable them all when the micro is “SLEEPING”Those would be 5V boost, OLED display and accelerometer.I thought that the easiest way would’ve been to cut the power to it all and call it the day.Would adding a third Mosfet make sense? I know that there is a power loss and heat dissipation to be taken in consideration too, so I would like to avoid any power inefficiencies if possible since the whole thing is running on a Li-Po battery and the space is very limited.As far as pulling the Gates on Mosfets UP/DOWN, I was under impression that the protection IC was already taking a care of that in some way as the suggested wiring diagram didn’t include any pullup/pulldown resistors.But I attempted to pull one of the gates down using a 5M ohm resistor, which caused the power to be cut off, but wouldn’t stay latched on after I released the button.

author: ledtester
author_rank: Super Contributor
timestamp: July 15, 2020, 02:02:28 pm
content: > The problem with keeping the entire system on, ...The uC is always on, but it controls a MOSFET which delivers power to your other things. GPIO pins configured as outputs remain driven even in sleep mode.> Would adding a third Mosfet make sense? I know that there is a power loss and heat dissipation to be taken in consideration too,I would just try it and see how well (or not) it works - it's simple to implement.If you don't want to add a third MOSFET, you can implement some sort of logical AND functionality for the gate of the OD MOSFET... i.e. the OD MOSFET is on if the OD signal is high AND the uC wants the power on.

author: ledtester
author_rank: Super Contributor
timestamp: July 15, 2020, 02:19:44 pm
content: Just had an idea... possibly that logical AND function could be performed by the uC... the OD signal is routed to a uC pin and the OD MOSFET gate is controlled directly by another uC GPIO pin. The uC turns on the MOSFET only if the OD signal is high and it wants power on to the rest of the system.

author: zenekNY
author_rank: Contributor
timestamp: July 15, 2020, 04:02:19 pm
content: My apologies, I misread your previous reply.I think that the most feasible way will be to add a third N channel Mosfet like you suggested and leave the protection IC alone.Ideally I would like to use a physical circuit which would force the entire system to power down in case something went wrong with the program but I find it difficult to integrate it, as I’m just a rookie

author: zenekNY
author_rank: Contributor
timestamp: July 15, 2020, 04:18:27 pm
content: I like the idea of the uC reading state of the OD pin and controlling the gate on the mosfet, but in this case the uC wouldn’t be able to shut itself off when the battery would discharge to a critical level and would keep slowly draining the battery, where the purpose of the protection IC is to keep it from Over Discharging.

author: Peabody
author_rank: Super Contributor
timestamp: July 15, 2020, 06:34:13 pm
content: I think Q1 is upside down. It's a PNP, so the emitter should be connected to OD, and the collector to the mosfet gate. And there needs to be a high-value pulldown resistor on the gate.So PB4 goes high, which turns on Q3, which turns on Q1 (but only if OD is high), which passes the high from OD to the mosfet gate, and that turns on the power. Isn't that what you want? If you bring PB4 low, that turns off Q3, and R4 turns off Q1, and the gate pulldown turns off the power.R5 may need to be a higher value depending on how much current OD sources.I think normally the protection mosfet gates don't have pulldown resistors because OC and OD are always active - either high or low, but never floating. But Q1 interrupts that because it can either source current to the gate, or not, but can't actively bring it low, and if you don't bring it low, it will stay high. It's just a charged capacitor, basically.Edit: Make sure you connect to the right mosfet. If you don't, power can flow through the mosfet body diode even if the mosfet is off. What's shown in your schematic is correct. Just make sure that's how you've connected it.

author: Peabody
author_rank: Super Contributor
timestamp: July 15, 2020, 09:24:19 pm
content: I'm attaching a revised version of your circuit showing (in a red box) the changes I'm suggesting. I've left off the pin numbers of the PNP because I don't know what part you're using. And I'd suggest you check that carefully because the PNPs I use don't have the pinout you show. Anyway, I think this ought to work.[ Attachment Invalid Or Does Not Exist ]

author: ledtester
author_rank: Super Contributor
timestamp: July 15, 2020, 09:46:48 pm
content: > but in this case the uC wouldn’t be able to shut itself off when the battery would discharge to a critical levelin sleep mode the uC only consumes microamps (perhaps even nanoamps) and can still respond to pin changes. This is far less than the self-discharge current of the battery itself.

author: zenekNY
author_rank: Contributor
timestamp: July 16, 2020, 01:18:32 am
content: I decided to add another Mosfet right after the dual channel one and not mess around with the protection IC, I want to be able to reset the uC without taking the case apart.I will not be able to add a battery switch to the system as I am trying to make the device dust and splash proof because it will be used in a pretty rough environment.The only thing is that I have to order some Fets and it will be a while until I get them and I will probably redo my test board.> I think Q1 is upside down.I have a little test board made up just for the power latching circuit and I have the Collector pin on PNP going to the Gate of the Mosfet so I'm pretty surethe Q1 is connected right. But please correct me if I'm wrong, I have had it connected wrong some time ago because I didn't pay attention in KiCad.> R5 may need to be a higher value depending on how much current OD sources.I used a 5M ohm resistor at one point and the pulldown was still too strong for the collector pin to pull it back up, probably like you said, due to the OD sourcing too weak of a signal/current.I attached an image of the little test board I made up, the dashed lines are jumpers on the other side of the board as it is a single sided board.

author: Peabody
author_rank: Super Contributor
timestamp: July 16, 2020, 04:49:15 am
content: Quote from: zenekNY on July 16, 2020, 01:18:32 amI was just going on what your schematic shows. It has the emitter connected to the gate. But you show it as a BCE, and I think most PNPs in SOT23 are BEC. What transistor are you using?5M is going way too far. With the 4.7K, how about measuring the voltage at the critical points when you want the power to be on, and off. PB4, OD, the mosfet gate, either side of R5.I also wonder about having the switch and the Q3 stuff going to -BAT instead of to ground. If that's correct, and it looks like it is, then my 1M pulldown resistor should also go to -BAT, not ground.Well, you've decided to go another way, but it would still be nice to get this working in case you need it again in the future. I think it ought to work.

author: zenekNY
author_rank: Contributor
timestamp: July 16, 2020, 09:12:54 am
content: Well I can keep messing around with this for another week until I get new order of parts and if it proves to work then I will just have some spare fets for future projects.The NPN transistor I am using is this one here:https://media.digikey.com/pdf/Data%20Sheets/Diodes%20PDFs/MMBT3906.pdfI understand that the 5M was too high, I just wanted to see if even with a high resistance would I get the same result and it was cutting the power off.As far as power goes, everything works fine up until and including the base of PNP transistor. I will double check myself when I get home after work, but I’m pretty sure.The voltage that I was getting on the OD to BAT- was wonky though. I remember reading like a 0.5V or something in that neighborhood. I will double check that too. I should also mention that reading voltage between OD and BAT- turns the power off as well, which is weird, because a voltmeter should be very little to non intrusive when it comes to power draw.The protection IC that I’m using is this one here:https://datasheet.lcsc.com/szlcsc/1810101017_Fortune-Semicon-DW01-G_C14213.pdfAfter looking at the Functional diagram in the data sheet in my opinion I should be getting either LOW/HIGH from OD and OC, it uses a set of comparators on the CS input line and respective LOW/HIGH should be spit out depending on the state of CS line. But it’s just my theoryAlso I looked at the Absolute Maximum Ratings table where the “OD output pin voltage” is rated at GND -0.3V to VCC +0.3V, wouldn’t those voltages not be able “saturate/close” the gate?

author: ledtester
author_rank: Super Contributor
timestamp: July 16, 2020, 11:41:11 am
content: QuoteThere's more details starting on page 14 including timing diagrams of the signals.QuoteThat spec sounds like the range to prevent CMOS latch-up - i.e. don't let the voltage on that pin exceed that range.

author: Peabody
author_rank: Super Contributor
timestamp: July 16, 2020, 01:47:27 pm
content: I think the output voltage of OC and OD is fine. It should be essentially +BAT. But the current could be the problem. The datasheet says the entire operating current of the DW01 is 3uA, and even that comes in through a 100R resistor. So the problem may be that the emitter-base current of the PNP, which is needed to turn on the transistor, is just overwhelming whatever the output capability of OD is. But it's strange that just measuring the voltage on OD would mess things up.Do you have a logic-level P-channel mosfet you could try in place of the PNP? There would be no current drain on OD with that.

author: Peabody
author_rank: Super Contributor
timestamp: July 16, 2020, 02:21:04 pm
content: I dug out my famous "18650 battery shield V3" which is a single cell charger and boost converter. It uses the typical DW01 protection, and all of that is accessible on the board. I measured both OC and OD with respect to -BAT with my meter, and got a solid 4.11V, and measuring it didn't interrupt the power. So I wonder what's going on with your DW01.

author: zenekNY
author_rank: Contributor
timestamp: July 16, 2020, 02:44:03 pm
content: > So the problem may be that the emitter-base current of the PNPThat’s what I thought, even sending it through a base of another transistor to amplify it might be another option but then I’d be piling up more components on that simple circuit.I will replace the IC with a new one, maybe it got fried in the process when I was poking around.

author: Peabody
author_rank: Super Contributor
timestamp: July 17, 2020, 01:58:04 am
content: Assuming you have a good DW01, I think the attached circuit is what I would suggest. It would replace the PNP transistor with a P-channel mosfet. That would eliminate any current demands on OD except for the 4uA that the pulldown resistor would draw. The pulldown is connected to -BAT.I think there is a wide variety of P-channel mosfets in SOT23 that have the same pinout as your 2N3906 PNP. So it should be a drop-in replacement. Something like the DMP1045U should wor

author: zenekNY
author_rank: Contributor
timestamp: July 17, 2020, 02:08:54 am
content: So here is what I did to make sure all components are in good condition:- I desoldered a PNP transistor to clear OD pin on the DW01.- I tested for voltage on OD pin and it read 3.8V with PNP removed, that lead me to believe there might be something wrong with the transistor,- went ahead and replaced the DW01 and the mosfet anyways to make sure the components that are giving me a hard time are in working order.- Both OC and OD were putting out 3.8V without the transistor,- I go to solder the PNP transistor on and put a 1M resistor on the PNP Collector/Gate line, the voltage reads 2.28Von the emmiter and the collector, 1.6V on the Base. It goes to a default ON (Not what I want).I go to hold a button to tell the uC to pull a gate on NPN high, this results in a 1V on a PNP Collector/Gate line. 3.8V on Collector and 3.7V on base.I also tried putting a 330K pulldown which too, gave me 1V on the PNP Collector/Gate line.I'm not sure why would I be getting 1.6V on a base of the PNP transistor when the NPN should be forcing it to drop to 0V through a current limiting 4.7K resistor.I'm attaching two images to show the voltages I am getting.

author: zenekNY
author_rank: Contributor
timestamp: July 17, 2020, 02:16:55 am
content: Quote from: Peabody on July 17, 2020, 01:58:04 amthis totally makes sense, I wish I didn't put in an order for components yesterday and grabbed a few P-Channel fets, but I will see if I could source a few on ebay or something.

author: Peabody
author_rank: Super Contributor
timestamp: July 17, 2020, 04:31:41 am
content: Make sure the 1M gate pulldown resistor goes to -BAT, not ground. Then take all your meter measurements with respect to -BAT, not ground. Do you get different numbers?

author: zenekNY
author_rank: Contributor
timestamp: July 17, 2020, 08:10:49 am
content: I should’ve mentioned that I did indeed measure everything to BAT-The only place the GND (Drain) is used is the uC.

author: Peabody
author_rank: Super Contributor
timestamp: July 17, 2020, 01:52:50 pm
content: Well, I think it is physically impossible to measure 1V on the gate with respect to -BAT if the pulldown is connected to -BAT, not ground. If the emitter and base are both at 3.8V, Q1 must be off if it is not defective, so the gate must be at -BAT, not 1V higher.But this raises a more fundamental issue which I should have realized is involved.I think the fundamental problem is the difference in voltage between ground and -BAT. In the ON state, there essentially is no difference because the mosfet is on. The 2.28V on OD is probably just the drop in voltage caused by the OD output having to supply a lot of current to the base resistor of Q1, and the pulldown resistor, at least more than it was designed to supply. The 1.6V base voltage is just one diode drop below the emitter, which is normal (2.3 - .7 = 1.6). And I suspect if you changed R5 to 100K, the 2.28V would rise a good bit if not all the way to 3.8V.But the problem is trying to turn the power off. Specifically, PB4 is still supplying current to Q3, so it doesn't turn off. You are trying to turn off a -BAT referenced portion of the circuit from another part of the circuit which, as the mosfet tries to turn off, is no longer referenced to -BAT.If you completely disconnect PB4 from Q3, the mosfet should turn off if its gate pulldown is connected to -BAT. If you then measure ground, or any pin on the processor, with reference to -BAT, it will be within a diode drop of 3.8V. Since the processor's high side is still connected to +BAT, everything in it should measure close to 3.8V with respect to -BAT. Everything only goes to the right levels when the ground pin is actually connected to -BAT. And since there is an internal protection diode from ground to the PB4 pin, current will flow from ground to PB4, and on to Q3, even if you change PB4 to a floating input, or even if the processor is off.So I think it tries to shut down, but as the voltage across the mosfet increases, ground rises, and PB4 rises, until some kind of strange equilibrium is reached where it's partially on.I don't know if there is a solution to this. It would still not work even if you change Q1 to a mosfet because I think the problem is in Q3. But it might work if you just do away with Q3 altogether, and drive Q1 directly from PB4. It seems like that might work since Vcc is always the same as +BAT. When the power is on, you would bring PB4 low to keep Q1 turned on. Then to turn off the power, you would just make PB4 a floating input, and then R4 should turn Q1 off. Anyway, it might be worth a try. See attached pic.

author: Peabody
author_rank: Super Contributor
timestamp: July 17, 2020, 02:35:09 pm
content: Unable to upload schematic. Don't know why.

author: zenekNY
author_rank: Contributor
timestamp: July 17, 2020, 04:23:51 pm
content: I’m sorry, I don’t know why the diagram is not going through. This is my first time on this forum so I’m not familiar, one of the images I uploaded has a thumbnail of a phisycal board under a microscope and when I click it, a screenshot of a diagram comes up, totally two different pictures.Do you think that setting the PB4 to HIGH as the first thing in the code might mess things up? Should I give it a second of delay to make sure the uC doesn’t reset within the few milliseconds it takes for the power down? Another possible strange “equilibrium”

author: Peabody
author_rank: Super Contributor
timestamp: July 17, 2020, 05:33:05 pm
content: If you go the route of eliminating Q3 and driving Q1 directly from PB4, then you would turn on the power by bringing PB4 low as the first line of code. Remember that the pushbutton is gounding the base of Q1 through the diode to turn on power, and you want PB4 to do the same thing so when the button is released the power will stay on. And of course you don't want to bring PB4 high when the button is bringing the same line low. That's a short.As for turning it off, I don't think the processor will reboot once the voltage has dropped enough that it shuts down. But if you want to build in some delay to make sure, you could set PB4 to input mode for a fraction of a second when you boot up. Of course that might mean you'll have to hold the button down a little longer.The main thing is to not turn things off through PB4 until after the button has been released, plus maybe a delay to take care of any bouncing. Then you would go into sleep mode, or just delay for a long time. It will shut down during the delay and should stay off.Uploading pictures is still broken for me.

author: zenekNY
author_rank: Contributor
timestamp: July 17, 2020, 10:56:03 pm
content: > If you completely disconnect PB4 from Q3, the mosfet should turn off if its gate pulldown is connected to -BAT.I disconnected the PB4 from the Q3 and the mosfet worked as predicted.I would've never thought of it, thank you very much for all the effort put into this, I checked the voltage between micro's pins and BAT- and they read 2.9V just like you said.I like your way of removing the Q3, the less components the better for me, I will make the changes some time this evening and will let you know, but this sounds promising.

author: zenekNY
author_rank: Contributor
timestamp: July 18, 2020, 12:09:08 am
content: SUCCESS !!!Thank you sooo much!I removed the Q3 completely and routed PB4 to the base of Q1, made a little change in the code to make sure of right timing and that the PB4 is not HIGH when button pressed.Everything works the way it should.Now I am off to redrawing the actual PCB and hopefully it will work when put altogether with the rest of circuitry.I really appreciate your persistence, it almost felt like beating a dead horse but it paid off.

author: Peabody
author_rank: Super Contributor
timestamp: July 18, 2020, 01:31:43 am
content: Congratulations on getting this working. I think it's really neat to use the protection mosfets to switch the power on and off. I don't recall hearing of anyone doing this before. I may steal it. :-)