Simple 5V UPS Design (not working in SPICE) - Page 1
Forum section: electronics / projects

author: aiq25
author_rank: Regular Contributor
timestamp: October 25, 2019, 07:41:19 pm
content: I'm looking to design a simple 5V UPS circuit. The UPS will have two inputs: 5V USB and 5V boost from a Li-Ion battery.I designed something in LTspice but this does not seem to work. Attached is the schematic. Please ignore the 1mOhm resistors, I put them to measure the direction of current flow.The idea is simple: M3 provides reverse polarity protection for the USB input (not required but wanted to through this in). M3 and M4 should open when there is no voltage present on the USB (denoted in the schematic as "VUSB"). M1 and M2 provide power to the load when VUSB is not present. VBST is the 5V boosted from a Li-Ion battery.The problem I'm facing is even when VUSB is disconnect from 5V (as shown in the SPICE simulation), there is somehow voltage on the VUSB line and the output voltage is not 5V, rather ~0.8V. When I disconnect the VUSB line from R13 then the circuit seems to work properly (Result 2). I think somehow there is current through M3 and/or M4 that is going to the VUSB line and powering something.I'm using NPN transistors to control the FET's. I have tried replacing them with N-Channel MOSFET's but that didn't help.I cannot figure out this problem and would appreciate some feedback.The MOSFET's I'm using are just for simulation purposes. I have tried others from the LTspice library but similar and/or same results. I don't have any parts picked out yet, just looking to get a concept working.The end UPS will have to provide 1A to the load. LTspice file is also attached.

author: jhpadjustable
author_rank: Frequent Contributor
timestamp: October 25, 2019, 08:41:41 pm
content: What's wrong with just two Schottky diodes?ETA: At all times, one of the MOSFETs in each pair will behave as exactly that, so why not cut out the middleman?To answer your question, try pulling VUSB down with ~10k to ground. Collector-base junctions are not ideal diodes. I haven't simulatedthisdesign, but the path R9-R8-Q2-R5 arouses my suspicions.

author: aiq25
author_rank: Regular Contributor
timestamp: October 25, 2019, 11:12:09 pm
content: Quote from: jhpadjustable on October 25, 2019, 08:41:41 pmI was trying to minimize voltage drop and losses.Thanks for the suggestion, will try it. I think this circuit much more optimized. I was using one of the mosfet to negate the effect of the body diode.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 26, 2019, 12:07:04 am
content: The back-to-back PMOS pair is a good idea to make a switch that will switch off in both directions. (Of course with just one PMOS, due to the body diode, one direction is never off.)The reason why your approach doesn't work is that it will actually not properly handle all 4 cases: VUSB on/off, VBST on/off. Just think about each case, and how your circuit will behave. You'll see that controlling the MOSFETs correctly is definitely not this simple. For instance, you definitely can't pull up to VUSB to control the upper PMOS pair. When VUSB is not 5V, it won't pull it up to anything, and the transistors will conduct...Of course the simplest would be to use two diodes. Schottky diodes will have less voltage drop (and thus power loss), but beware of their relatively "high" reverse leakage current. Not necessarily a problem in your application, but just something to keep in mind.Now if you're OK with the voltage drop (how low can the output of your "UPS" be to still fulfill your requirements?) you'll get with Schottky diodes, but would still like to minimize losses when on the battery, whereas you don't care when on USB, I suggest the following schematic. You may think that duplicating the bottom structure with the transistors for the VUSB path will work, but it won't. There are cases that would make it fail, and the controlling part would get even more involved than this. A bit too much for my liking, so I'm suggesting this. Would still need a few transistors... Check it out, it should work as expected (with priority for VUSB, shutting down the battery path even if the battery is connected when VUSB is present).If anyone manages to get it right with fewer transistors, don't hesitate to chime in. But make sure all cases are properly covered first.There are also integrated OR'ing controllers. I suggest looking them up; they are simple to use, integrate more protections and will reduce part count.

author: Zero999
author_rank: Super Contributor
timestamp: October 26, 2019, 08:05:21 pm
content: The good thing about many of the integrated controllers is they include a charge pump, which enables a single N-MOSFET to be used on the high side, which have a lower on resistance than two P-channel devices in series.http://www.ti.com/lit/an/slvae57/slvae57.pdf

author: aiq25
author_rank: Regular Contributor
timestamp: October 27, 2019, 12:33:31 am
content: Quote from: Zero999 on October 26, 2019, 08:05:21 pmThanks. I looked into the ideal diode controllers from TI before but one thing is that they seem to control only a single MOSFET, I wanted to use the back to back FET’s to ensure complete disconnect.Thank you for the simulation as well. For my application a shottky will work.

author: jmw
author_rank: Frequent Contributor
timestamp: October 27, 2019, 01:24:52 am
content: Is this for the fun/challenge of it? When I had this need in a design, I put in a TPS2113, which only needs the usual bypass caps and a pair of resistors in its reference design.

author: aiq25
author_rank: Regular Contributor
timestamp: October 27, 2019, 05:01:34 pm
content: Quote from: jmw on October 27, 2019, 01:24:52 amThis is more for fun and to learn to control the FET’s (I thought it was going to be simple lol).My application is really for a clock, which draws about 50-100 mA. So the diodes should be fine. I was looking for a solution that I can reuse in the future for more demanding projects.

author: langwadt
author_rank: Super Contributor
timestamp: October 27, 2019, 05:30:38 pm
content: Quote from: aiq25 on October 27, 2019, 05:01:34 pmhttps://electronics.stackexchange.com/questions/223935/understanding-an-ideal-diode-made-from-a-p-channel-mosfet-and-pnp-transistors