More uninterruptable thoughts

Just a thought – but one I’m putting together as a prelude to adding a controller… what do you think?

tmpBE7C

So the idea is simple enough – each of these boards is DIRT cheap… the MT3608 boosters are able to output 2 amps. the smaller charging board however is only able to output a little over 0.5 amps – useless for powering, say a Pi3.  So – the little board at the bottom charges the battery as long as there is incoming 5v. Similarly as long as there is incoming power, the top booster powers the Pi…. it’s output being 5.8 roughly, dropped by a diode. The middle board, powered by the battery, has a SLIGHTLY lower output voltage and so thanks to the diode arrangement does nothing. 

If the power fails, the top board outputs nothing – and so the middle board takes over.

Here’s the thing, if the battery gets well down and the power comes back up, the top board takes over powering the load, the middle board does nothing and so the bottom board can concentrate on charging the battery as quickly as possible.

Not actually TRIED this in practice – hopefully will get a chance over the weekend – any comments before I get the soldering iron out?  If you have an old laptop battery, the total cost of this up to now is around £3 or so. The plan would be to stick a Nano in a final version controlling the outputs of those MT3608 boards (they have an enable pin on the chip) and using the analog input to measure battery voltage, ensuring the PI (or whatever) is given the opportunity to shut down when the battery is low – and also (new thought having read what Tesla has done) limiting the battery charge to below full – limiting to 85% apparently does WONDERS for the battery life.

Thoughts? And yes I’ve seen lots of boards out there that do all this, yes they’re expensive – as the cheap ones by and large fail to provide UPS somewhere along the line – usually during recovery from a flat battery. so – I thought, why not DIY… I just happen to have a pal who’s a whiz at PCBs.

Update 15 October

Of course part of the reason for using TWO of these boosters is the inadequacy of the charging circuits based on the common TP4056 – but thanks to Antonio pointing me to a link to a Chinese lady paralleling them up – I then went off on a search and found these…   a cheap 3 amp circuit (the only worry is it says in the ad that it is a 4056 circuit but I’m not seeing a 4056) and a slightly more expensive multi-4056 circuit. With this one only then needs a single booster circuit which does not then need outgoing diodes. The multi-4056 circuit seems to be simple enough – all grounds common – all inputs common, all outputs/battery+ commoned. 3 amps output would typically allow for running, say. a PI and providing a reasonable amount of charge to the battery at the same time.

Thankd to this video - https://www.youtube.com/watch?v=uJmQ9W3Yqc8  we have a circuit for multiple 4056 in parallel…

tmp874F

Looking at the spec of the chip it should be able to handle 800ma without breaking a sweat – so 4 of them would give 3.2 amps.  I personally would not use those light outputs – I’d take them to the NANO (with internal pullups, bearing in mind the LED outputs are open collector). That would then give the NANO additional information.

According to THIS spec sheet – pin 8 on the TP4056 is an enable pin, normally high. They could be paralleled up and taken to the NANO – which already could control the output (via the enable pin on the MT3608) – ensuring the battery is never too discharged – but now the enable on the 4056 along with the analog input on the NANO could ensure that the battery is never fully charged – and that of course increases battery life.  I2c (2 pullup resistors) would allow for programming things like maximum charge voltage, minimum discharge voltage and more – and remaining Nano pins could if needed be used as status LEDs.

Facebooktwittergoogle_pluspinterestlinkedin

35 thoughts on “More uninterruptable thoughts

  1. You can get almost 1A charge current out of that little board on the bottom if you change the setting resistor. It's a TP4056 chip for charging and a DW01-G on the right for battery protection if you want to fiddle with it.

    Why bother with 2 boost converters? wouldn't it be enough to connect the main supply straight to the Pi and then have diode protection (just like in your drawing) for the battery part? Aka skip 1 boost converter. That's how they do it on the Adafruit boards usually, albeit on a smaller scale.
    If you have 3A on the supply that should be enough to charge at full strength and power the Pi at the same time.

    1. Thanks for that - as it happens - the higher charge isn't needed the way I do it but I guess it would do no harm to upgrade the board - out with the tiny soldering iron.

      As for the second booster... main supply straight to the PI - well because you'd need diode protection for both the battery part and the mains part - some power supplies will handle voltage going back into them when turned off - others will blow up... so - you put diode in series - but now your 5v on your mains supply is down to 4.6 with an expensive diode, 4.3 with a cheap one - neither is a good idea. NOW - if your power supply was around 5.8 - then yes - but that THEN leaves the question - how will the TP4056 respond to having 5.8 shoved into it - especially at the higher current you suggest.

      I know - "GOOGLE IT" - but if you know the answers from experience - do tell before I get the iron out.

      1. To answer your own question - the TP4056 can handle up to 8 volts... but of course - not all power supplies can be altered... so the dual booster approach still has merits - expecially as they are so cheap.

  2. Like your approach here. What happens if the power is out for a LONG time? Any protection from over discharging the battery? If you have a nano in play then you could monitor the falling battery voltage and then disconnect the battery (mosfet) at some low (2.5v?) voltage. Hopefully the Pi has shut down before this point (warned by the nano at (2.7v?). Just some thoughts here but do go for it. I think this is will work.

    1. Absolutely John - a NANO would not only indicate to the PI to turn off before the battery gets low (the Nano takes so little current I'm not concerned about it flattening the battery much) and using the ENABLE pin(s) on the buck convertor(s).. but also could potentially stop charge on the battery reaching 100% which has to be a good thing... oh and you could do all sorts of logging, I2c slave interface etc etc....

        1. Good idea but too simple... let's say the battery goes down - Pi is told to turn off by the comparator... now we're using less current the battery voltage comes u, Pi never comes up. What's needed as the battery goes down is to firstly warn the Pi, then after a delay, turn the power off. The power should then not come back on until the battery has recovered slightly otherwise you end up in a loop of off/on.... so you need hysteresis. By the time you are finished you have a complete circuit, may as well have used a Nano. Also with processing power you get options like being able to change setting, view status on an OLED etc. Looking at designs out there, many have tried the minimal route and ended up with something that just does not do the job.I'd like to see at least 10 minutes pass between a low battery and the unit coming back on - when you get power failures, it is not unusual to get a raft of them in a row so best keep the Pi off until it is all over.

            1. Not at all - those booster chips have an ENABLE pin - not that easy to get to on the boards but if you did your own thing it would be no issue - normally enabled - take high and the output shuts off. I've not yet investigated the charger chips to see if they have the same.

  3. If I were to consider this type of solution, then I'd include some device with intelligence that would control the various elements and make appropriate measurements. At least for prototyping that would let you make all sorts of changes without the soldering iron.

    However, I don't relly understand the use part of the requirement. If you have access to mains or even ethernet, then remote power is surely the way to go. That way you can have a real UPS and distribute reliable power via ethernet or a low voltage cable?

    1. A Nano will provide the intelligence.

      You are assuming that in a given situation, with existing equipment that power over Ethernet is practical - not always. Low voltage cable - are you married? Cables around the house?

      1. I accept your comments but for 'you' I don't believe we're talking one device and there are lots of cheap poe solutions using the spare pairs and not following the standards. Then perhaps no extra wires. Also it is a bit of a leap to have a fairly critical device (i.e.needing ups) which doesn't require a reliable network connection? Finally, I don't beieve the time is too far away when lighting is powered from UPS as its power needs are now quite moderate and that would offer UPS at many more locations?

        1. Hi Richard..

          We're talking in my case, a small number of devices in each of 3 remote locations. For me, yes, I could use POE but I would not want to get into discussing to a mixed skill audience, add-on POE given the variety of wiring arrangements out there - but yes, for some, POE might be a solution - assuming of course hardwired Ethernet - not a lot of use in a wireless situation and while the technical person may well scoff WIFI - most normal people do not want wires all over and will use WIFI or radio even where not really appropriate. Sensors around the house are often wireless completely - I have visions of people spending more time changing batteries than enjoying the home 🙂

          Lighting - there is a general trend to think that lighting is becoming lower and lower power. That is not my experience. Sure, it is low power compared to filaments - but compared to Compact Fluorescent? - I don't think there is anything in it - You can of course get 3w LED bulbs - and they're about as much use as a candle. I've just retrofitted some lighting in Spain as I'd gone LED and was having a clear-out of 64k (horrible cold white) lights and noted that the warmer lighting tended also to be a little dimmer. Most of my lighting now is mains powered and most of the lamps are 15-25w LED. As for LED string - the current consumption of that rapidly rises as you get more enthusiastic.

          We are of course talking two completely different things here - a UPS for a PI should be able to handle any length of outage - no matter how big the batteries, they will run out of steam eventually and the UPS needs to inform the Pi (or whatever) that the power is about to drop.

          A lot of the tiny UPS out there that I've tested simply don't make the grade, some need a button press to come back on, some can't handle the full load while charging, some don't issue any warning etc. But even the bigger ones - I've had industrial UPS systems that given a long term (24 hours) power-out have driven the battery so low that it has never recovered. I've had units which cost a lot and yet in those same units I've seen batteries expand due to excessive charge or discharge. NONE of this should be happening in any of these devices... hence I keep looking to see what's out there and continue to experiment - as in this article.

          I have some commercial units on the way for testing so expect more on this subject.

  4. Hi,
    I've built my own UPS for my RPi and OPi + HDD using this SMPS:
    http://s.aliexpress.com/AjY3QJr2
    You can hook up a lead acid battery to it and it works right away. There is no delay between changing from mains to battery power, my PIs keep running as nothing has happend.
    It has 3 indicator leds which you can use paired with an optoisollator ic to monitor everything.
    And 6/8/10 Amps of output power should be perfectly fine.

    Greetings from Germany
    Joshua

    1. It LOOKS good - but one phrase in there worries me a little "Which power to the battery charge, no requirements for the type of battery, lead, lithium and other batteries are OK!" - REALLY? So no special treatment for Lithium batteries? I think I'd want someone else to try that first... What voltage lead-acid did you use? And in the case of long-term power outage, does it give any kind of indication that the PI can use to gracefully power down - or does it just abruptly shut off the power when the battery gets to 10v?

      1. i think they copied the design from this Drok one (as happens A LOT with Drok products...): https://www.amazon.co.uk/110V-240V-Uninterruptible-Over-discharge-Protection-Cmopatible/dp/B01K9SM78K/

        there's even this which is nice...
        https://www.amazon.co.uk/Power-Inspired-Router-Uninterruptible-Supply/dp/B0187PWCLO/

        but honestly, if one has to go for the UPS way (and it's viable, as a basic UPS can be bought for less than 40$), i'd do as in this video, bypassing the inverter... https://www.youtube.com/watch?v=-Ur-D37-juo

      2. Of course you shouldn't consider putting LiPo / LiFe / Liion batteries on this supply. It is designed for lead acid batteries, as you can see on the plugs which are commonly used on lead batteries. I think it is a marketing trick or the seller has low electronic knowledge.
        I bought a 12v 2.2Ah battery from a german reseller (reichelt).
        The datasheet suggests between 13V-15V roughly to charge and 13.8V as float-charge voltage.
        Due to their design lead acid batteries are nearly unbreakable, so overcharging is no issue.

        The PSU has a small trim pot next to the screw terminals which lets you select the output voltage.

        I've set it to 13.9v and it is working just fine. The battery is float-charging.

        If mains fails it starts discharging until it reaches 10.9 Volts. After this it needs to be reconnected to mains or you have to swap the battery and start it with the small pcb mounted button next to the trim pot.

        As I said for powerloss indication I use the 3 leds which are soldered on a seperate pcb which you can see on the product photos

        One led indicates mains power, another one whether it is charging and the third if it's turned on.

        By simple connecting an optoisolator (optokoppler in german) to the mains indicator led and to a GPIO you can monitor whether mains has power or not.
        Another way is to use a non-invasive power meter (these with a coil) which can measure the power being drawn from mains and as a result can sense a blackout which triggers a shutdown.

        If you want I can send you a photo of my setup.
        I also wanted to make a youtube video about it in the near future.

        Joshua

        1. Thanks for the clarification Joshua - I'm assuming it doesn't have any specific battery protection or digital level low-power signal? For my projects I want the computer to have adequate time to shut down when the voltage is dropping, for the output to disconnect before the battery suffers and the whole lot to come back up shortly after power is restored. SO MANY of the so called Pi solutions out there fail to manage this simple trick. For me UPS means unattended. Still, lots of potential answers coming up.

      1. He's right - the +B and +out are commoned - so you'd need to parallel the b- outputs to the battery and the - outputs to the load. The only thing with using these boards as against doing your own is getting to pin 8 the enable pin if you want to control that. on mine there APPEARS to be an easy to cut track but boards differ. How much the batteries are charged could be the difference between them lasting a couple of years or many years.

        1. well, if you and Aidan come out with a pcb with all this knowledge, published on oshpark or easyeda, everyone could even buy a full kit by them and with adequate skills, solder it on their own 🙂

          or publish on tindie, as many do... 😉

          sure using premade boards, if easily interconnectable and "hackable" (like a track cut, as you say) is easier for everyone, but leads to bigger boards...

    1. as stated on that link, they're just battery protection boards, nothing to do with an ups functionality with all the bells and whistles Peter explained many times (recovery from flat, shutdown of the OS, etc)

  5. Here is a very simple circuit used with Lead-Acid batteries (They are easy to charge and they keep charge for a very long time) Do not attempt to charge any other kind of battery with circuit... they will blow it up!

    Lead-Acid UPS

    Part List:

    R1 - 39 ohms 1/2W
    D1, D3, D4 - 1N4001 or similar diode
    D2 - 13V zener rated 1W
    C1 - 220uF electrolytic capacitor rated 25V
    C2 - 10uF electrolytic capacitor rated 10V
    IC - 7805 or similar 5V regulator
    BAT - 12V lead acid battery

  6. Pete,
    Not all protection boards have charging and balance the batteries specially the cheap Chinese ones that are not real BCMs. For these you need to have constant current/voltage feeding the circuit to fully charge the batteries. This one promises a charger on it https://www.amazon.com/dp/B01I9TXMR6/ref=cm_sw_r_cp_ep_dp_q7Slzb5HVPYTQ but since there are no real specs....

    Here is a good example of someone building a UPS using the PCB, a Charging circuit and finally a relay to decouple the power source, charger and drain source using those low cost boards.
    https://www.youtube.com/watch?v=kuEgZELszLk

    Hope this helps as I am working on building my own.

Leave a Reply

Your email address will not be published. Required fields are marked *