Asking for review / components suggestions: building UPS for WIFI router - Page 1
Forum section: electronics / beginners

author: glebkooo
author_rank: Contributor
timestamp: July 30, 2023, 07:35:39 pm
content: Hello,I am hobbyist and trying to build an UPS for my WiFi router.Need your advice on selecting a proper part for D3 or a way / a circuit to replace it, because generic diode has a relatively high voltage drop and will dissipate heat. I want to avoid this. Would appreciate if you review my design for other potential issues as well.That is a fifth iteration, the previous one ended up with fried MCU(seehttps://www.eevblog.com/forum/beginners/fried-the-mcu-on-my-diy-pcb-please-help-investigate-what-i-did-wrong/msg4909610/#msg4909610)The UPS have to do the following:power the load from external 15V PSU if it is connected, otherwise power it from batterystart charging by switching relay if charger is connected and battery voltage level is below threshold (that is controlled by MCU)stop charging by switching relay off when battery voltage goes higher than another thresholdDC-DC converter, MCU, relay and voltage divider should not draw the current from battery when charger is not connectedD3 have to prevent current flowing from the battery to the DC-DC in the case when the charging got started and then the charger gets disconnected.I thought of using NMOS / PMOS instead of D3, because they have really low Rds(on) values, but cannot figure out how to do that properly. MOSFET allows current flow in both directions when opens, so it behaves different comparing to the diode.

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 30, 2023, 07:47:48 pm
content: I guess you overcomplicate it. And you don't need MCU (and relay) to turn on and off a charger.Have you seen this:10400mAh Mini Portable UPS 5V-12V Uninterruptible Power Supply For WiFi Router Large Capacity Backup Power Adapters UPS 8800mAh

author: glebkooo
author_rank: Contributor
timestamp: July 30, 2023, 07:56:26 pm
content: The key point here is to have fun and make it by myself / learn something new.Re MCU. I want to control it over Wifi in the future, for example, ESP-01 sends a command to start / stop charging, monitors the battery voltage.But, yeah, for the simple case - two comparators and trigger should be enough.

author: rteodor
author_rank: Frequent Contributor
timestamp: July 30, 2023, 08:51:23 pm
content: I use a bunch of 15SQ045 (and 20SQ045) from TME in my "UPS". Including in the OR-ing circuit.

author: Manul
author_rank: Super Contributor
timestamp: July 30, 2023, 09:04:42 pm
content: A few observations:1.Is D3 really needed? Correct me if I'm wrong, but if CHRG+ is missing, then 5V is also missing and relay is not connecting CHRG+ with BAT. Where is the problem?Got it.2. Your 5V goes through D2. So it will not be 5V. If 5V is used as ADC reference, your ADC readings will be inaccurate and inconsistent. Why D2 is there?3. If you want, you can simplify BAT voltage divider (without mosfets). You can use high value resistors, for example 100k + 33k (or even higher) and add a small capacitor for low impedance. BAT voltage is not changing fast, so this low pass filter will not harm reading, it will only improve it with possibly lower noise. If the divider current is lower than battery self discharge current, it will not affect the battery much. 100 microamps or less is really ok.4. Add a few bulk (electrolytic) capacitors. At least on battery connection, charger connection, 5V rail near MCU. Even 47-100uF should do. The thing is that where are wires (inductances) and currents, voltage transients may happen. It is generally a good practice to have electrolytics here and there, not only ceramic capacitors.

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 30, 2023, 09:30:13 pm
content: Quote from: glebkooo on July 30, 2023, 07:56:26 pmAbout your design:Small relays won't work reliably with DC current, so if you want to switch the charger on and off at DC voltage I recommend using MOSFETs for it (or quite a large relay).Otherwise, if you want to use a relay anyway, consider switching chargers input AC voltage.As for me, I would use a simple Schottky diode ORing circuit for commutation charger and battery to the load. So, you may turn the charger on and off at the AC input voltage when needed. This way is very simple and reliable and it still gives you the opportunity to invent this bicycle:XH-M602 Universal charger controller ($6-$8)

author: glebkooo
author_rank: Contributor
timestamp: July 30, 2023, 10:01:58 pm
content: Quote from: Manul on July 30, 2023, 09:04:42 pmOops, D2 is copy-pasted from previous discarded designQuote from: Manul on July 30, 2023, 09:04:42 pmWow, nice trick. Found a thread about it -https://electronics.stackexchange.com/questions/291841/voltage-divider-with-capacitor, +1 common trick learnedQuote from: Manul on July 30, 2023, 09:04:42 pmWill do, thanks a lot, Manul.

author: glebkooo
author_rank: Contributor
timestamp: July 30, 2023, 10:24:00 pm
content: Quote from: Vovk_Z on July 30, 2023, 09:30:13 pmSorry, I am not sure I understand why small relays would not work reliably in this use case? Did you mean EMI when switching?QuoteThank you, will think about it.QuoteOh, I forgot to mention one important note. Maybe after that the design will not be so confusing.I am not trying to re-invent a VRLA battery charger here. I already have one that powers from AC - Mervesan MT-7012C -https://prom.ua/ua/p1732637268-zaryadnoe-ustrojstvo-mervesan.htmlThe problem with it is that it continues to supply some current to my battery even after it shows the battery has finished charging. Even this small current enough for my battery to start boiling. That's why I started "inventing" this cut-off mechanism with relay.

author: Manul
author_rank: Super Contributor
timestamp: July 30, 2023, 10:44:38 pm
content: Switching with mosfets can be done of course. But one will not be enough (because of internal diode). So it becomes more complicated.So the main problem is that your MCU does not really know when CHRG+ disconnects (if charging is activated). And the D3 solution is not power efficient. Also it shuts down the MCU abruptly if charger gets disconnected. It would be nice if MCU could deside itself when to shutdown, so it could do some job before shutting down.If I would go a bit fancy with this circuit, I would add a current sensor on the battery. Hall-effect current sense IC's are easy to use, like the TMSC series from TI. Some can measure bidirectional current, so you would be able to read both charge and discharge current. Having this information, the MCU will know if charger is disconnected. If battery should charge, but there is no charge current, then it means something is wrong. Just ideas.

author: Vovk_Z
author_rank: Super Contributor
timestamp: July 30, 2023, 11:33:43 pm
content: Quote from: glebkooo on July 30, 2023, 10:24:00 pmDC current wears contacts very fast (there is always an arc at switching off).Quote from: glebkooo on July 30, 2023, 10:24:00 pmConsider XH-M602. It isn't very sophisticated but rather very simple and cheap. Possibly it'll be enough.