Author Topic: Asking for review / components suggestions: building UPS for WIFI router  (Read 607 times)

0 Members and 1 Guest are viewing this topic.

Offline glebkoooTopic starter

  • Contributor
  • Posts: 16
  • Country: ua
    • github.com:Glebka
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 :palm: (see https://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 battery
  • start 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 threshold
  • DC-DC converter, MCU, relay and voltage divider should not draw the current from battery when charger is not connected

D3 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.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1439
  • Country: ua
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
« Last Edit: July 30, 2023, 07:53:58 pm by Vovk_Z »
 

Offline glebkoooTopic starter

  • Contributor
  • Posts: 16
  • Country: ua
    • github.com:Glebka
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.
« Last Edit: July 30, 2023, 08:02:01 pm by glebkooo »
 

Offline rteodor

  • Regular Contributor
  • *
  • Posts: 129
  • Country: ro
I use a bunch of 15SQ045 (and 20SQ045) from TME in my "UPS". Including in the OR-ing circuit.
 
The following users thanked this post: glebkooo

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1130
  • Country: lt
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.
« Last Edit: July 30, 2023, 09:23:42 pm by Manul »
 
The following users thanked this post: glebkooo

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1439
  • Country: ua
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.
About 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)
« Last Edit: July 30, 2023, 09:37:43 pm by Vovk_Z »
 

Offline glebkoooTopic starter

  • Contributor
  • Posts: 16
  • Country: ua
    • github.com:Glebka
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?
Oops, D2 is copy-pasted from previous discarded design

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.

Wow, nice trick. Found a thread about it - https://electronics.stackexchange.com/questions/291841/voltage-divider-with-capacitor, +1 common trick learned

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.

Will do, thanks a lot, Manul.
 

Offline glebkoooTopic starter

  • Contributor
  • Posts: 16
  • Country: ua
    • github.com:Glebka
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.

Sorry, I am not sure I understand why small relays would not work reliably in this use case? Did you mean EMI when switching?

Quote
I recommend using MOSFETs for it
Thank you, will think about it.

Quote
Otherwise, if you want to use a relay anyway, consider switching chargers input AC voltage.

Oh,  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.html
The 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.

 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1130
  • Country: lt
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.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1439
  • Country: ua
Sorry, I am not sure I understand why small relays would not work reliably in this use case? Did you mean EMI when switching?
DC current wears contacts very fast (there is always an arc at switching off).


The 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.
Consider XH-M602. It isn't very sophisticated but rather very simple and cheap. Possibly it'll be enough.
« Last Edit: July 30, 2023, 11:37:18 pm by Vovk_Z »
 
The following users thanked this post: glebkooo


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf