12V+UPS for Arduino nano - Page 1
Forum section: electronics / projects

author: T_guttata
author_rank: Regular Contributor
timestamp: August 07, 2021, 12:09:23 pm
content: HiI want to use an arduino nano for a project where I have 12V for the primary power supply. Thats easy, as 12V is within specs of Vin of the arduino. As far as I understand, the arduino only needs 5V and the delta is wasted inside the linear voltage regulator.I want the arduino to be powered at all times, even if the mains power fails. Therefore, I would like to add a UPS. This UPS shall have the following features:1) Powers arduino if mains power supply fails2) Battery gets automatically charged when mains power supply is ok.3) High efficiency, with a 2000 mAh battery, the arduino shall run for at least 2 weeks (336h)Any recommendations on suitable devices / ICs out there to do that task?Thanks for your help.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 07, 2021, 05:38:23 pm
content: Easy way is a 2S pack with BMS and a current limited regulator to hold it at 8-8.2V (4-4.1V/cell) with the Arduino powered in parallel.Using a switching regulator to run the Arduino would help with runtime, but for the low current an Arduino uses, most switching regulator modules will not be able to save power compared to a linear regulator.

author: tooki
author_rank: Super Contributor
timestamp: August 08, 2021, 12:29:40 am
content: In my most recent project, a Bluetooth speaker, I use the TI BQ25895 charger IC, which supports 3.9-14V input, with about 9000mAh of 3.7V LiIon cells (in parallel). It outputs (roughly) the battery voltage when running on battery alone, and when the input voltage is present, you can program the minimum output voltage to between 3-4.5V. (When charging, the output voltage will be at least the charging voltage, typically up to 4.2V). I then use various DC-DC converters to create the voltages needed in the system.Note that an Arduino Uno/Nano can run down to 2.7V, below the end discharge voltage of a typical LiIon cell. So at least as far as the MCU is concerned, you can actually dispense with a 5V boost converter altogether and let the MCU run right off the battery volfage (Vsys on the BQ25895).There are simpler charger ICs than that one, but the general principle applies.

author: Buriedcode
author_rank: Super Contributor
timestamp: August 08, 2021, 06:21:02 am
content: Quote from: T_guttata on August 07, 2021, 12:09:23 pmDo you mean it should be able to power the Arduino for two weeks continuously with no external power? If so, this is more a function of the Arduino nano than the battery. FOr 336h and a capacity of 2000mAh, assuming you can use the entire capacity over its entire discharge voltage, thats 2000/336 = ~6mA. The nano's on board regulator will have some quiescent current, and ifthe MCU is running at 16MHz, I tihnk it'll draw more than 6mA. Of course I don't know what your application is so it could be you're putting the MCU to sleep for long periods.For simplicity sake, I would lean towards batteries in series, giving >5V then using a buck or linear reg. Is it a 3.3V nano (8MHz) or 5v (16MHz) ?

author: mariush
author_rank: Super Contributor
timestamp: August 08, 2021, 06:55:41 am
content: The easiest would probably be to have two lithium-ion batteries in series charged from a battery charging circuit then power the arduino nano from the batteries or from the DC inputYou can get small charging boards from ebay, here's one that can charge 2 batteries in series :https://www.ebay.com/itm/383760467132The arduino nano uses a lm1117 linear regulator which needs at least 1v above the set 5v to work properly, so two lithium batteries in series will give you at least 6v...7.4v and you'll be fine.You can either power your nano from battery all the time, but you'll probably wear out the batteries because the charger would constantly top them up, or you could use two diodes with low voltage drop to prevent 12v from dc input to go back into the battery:12v -> charger ic board -> diode -> nano input12v -> .........................-> diode -> nano inputYou could also use one of those barrel jacks for DC input which have a disconnect feature, so when you plug in the dc barrel jack, the connection between battery output and nano is interrupted.With such a barrel jack connector, you'll want a small capacitor on the input of the nano, to hold some charge while switching between moment where battery is disconnected and barrel jack connector is fully inserted.There's also charging IC boards with chips like MCP73871 that can charge a single lithium-battery (or a couple in parallel) and also provide a load output which switches between the input voltage and the battery voltageThen, you just have to take this output voltage and boost it to 5v and power the nano through the USB input, or boost it to at least 6v if you use the input that then goes through the linear regulator.... so your circuit could be simple :12v to 5v regulator --> battery charger ic board (for 1 battery or two in parallel for more capacity) -> 3v...5v (battery or charger input) to 5vMCP73871 battery charger with load sharing :https://www.ebay.com/itm/273951944008step down voltage regulator (to take 12v down to 5v) :https://www.ebay.com/itm/393122127035orhttps://www.ebay.com/itm/272834659085step up voltage regulator (to take load / battery output to 5v and power nano through usb )boost to 5v :https://www.ebay.com/itm/333307354460orhttps://www.ebay.com/itm/283692953444ORstep up voltage regulator (to take load / battery output to 6v or more to connect to linear regulator on nano board)boost to fixed 9v output :https://www.ebay.com/itm/124195986132boost to configurable output voltage :https://www.ebay.com/itm/401621208294

author: Miyuki
author_rank: Frequent Contributor
timestamp: August 08, 2021, 07:36:24 am
content: Mean Well have a family of battery back up power suppliesFrom few watts to hundreds. Comes in various voltages.I use one 150W for the home network and NAS.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 08, 2021, 09:15:14 am
content: Thanks for your help.- Yes, I know I probably have to sent to arduino to sleep mode in order to reduce the power consumption enough. But thats another topic.- The BQ25895 charger IC seems way overkill for what I intend to do. I don't need any of the smart features.- If I got it right, I can either use one battery cell (3.7V), but then I need to step down from 12 to approx. 5V and then from 3.7 up to around 6V to use it with the Vin pin of the arduino. Or I use 2 cells (7.4V), then I only need to step down from 12V. Is this correct?I tried to draw a circuit diagram:Did I get it right?What's about those batteries:https://de.aliexpress.com/item/1005002941081413.html?spm=a2g0o.productlist.0.0.2fd6605ciTJq1U&algo_pvid=5ce3809c-eee0-41d7-97ec-50f03589efbf&aem_p4p_detail=202108080212111292576454469270012127796&algo_exp_id=5ce3809c-eee0-41d7-97ec-50f03589efbf-19Will they work?

author: mariush
author_rank: Super Contributor
timestamp: August 08, 2021, 10:40:00 am
content: I didn't ask if this project has a size limitation or if this is a commercial / personal or one-off project.If space isn't an issue and this is a one time project or a personal one, you could just go and buy a 12v lead-acid battery for UPSes (12v 7Ah or 9Ah) and if that's hard to find, even a motorbike battery (12v 7Ah typically) will work (but ups batteries are supposed to be "optimized" for continuous discharge while bike batteries are for high current bursts (motor ignition, bike lights etc)It's bigger, heavy, but fairly cheap and can be bought locally... and you can just connect the battery straight to the 12v input and keep it topping up without worries... maybe limit current through a resistor if you want to.You could power the project directly and waste some power in the linear regulator, and you risk the battery being killed once it drops below around 10.8v, because you wouldn't be able to determine the voltage before the linear regulator.You should still use a dc-dc converter and convert to 5v (or less) because a dc-dc converter will be much more efficient than a linear regulator (up to 95-97% efficient)---If you want to make your Arduino Nano as efficient as possible, then you'd want to run it directly from 5v (or less).If you power your board through the linear regulator, you're gonna waste a lot of power in the regulator itself and as consequence of linear regulator.In addition to the waste by using linear regulation, there's also a power on led on the board powered directly from the linear regulator through a current limiting resistor. That led is there to provide a minimum load for the regulator and keep it stable, besides showing the on/off state.On some schematics, there's a 330 ohm resistor used, on others it's a 680 ohm resistor ... both had a blue led, so a 3v forward voltage... this makes it a (5-3)/330-680 =2..6 mAof wasted energy in the led alone.So I'd say keep it simple, use a dc-dc step-down (buck) converter to bring your 12v to 5v (which can be used to power both the charging IC and the Arduino directly through the usb port, and when this 5v is gone, your arduino can still get power from the battery, through a step-up (boost) dc-dc converter (1. 12v->5v converter --> battery charging IC --> battery --> 3..4.2v to ~5.2v boost converter ---> low voltage drop diode to protect boost regulator from 5v when 12v is present ---> arduino and 2. 12v->5v converter ---> arduino usb )Step up dc-dc converters are cheap and fairly efficient. The ones on eBay won't be very efficient, as the inductors used won't be optimized for low currents.You can make your own with chips like AP1603 for example -https://www.diodes.com/assets/Datasheets/AP1603.pdf- that will give you up to around 90% efficiency---The Arduino 168 needs 4.5v - 5v for 20 Mhz (the maximum frequency) but as far as I know, the Arduino Nano comes with a 16 Mhz oscillator.You can check the datasheet at page 386 and you'll find there figure 33-2 which shows safe operating area for various clock frequencies :https://eu.mouser.com/datasheet/2/268/Atmel-2545-8-bit-AVR-Microcontroller-ATmega48-88-1-1315326.pdfFrom the graph, it looks like you can get at least 10 Mhz on 2.7v so you could probably get 12-16 Mhz with around 3.3vSo what I'm saying is that if you don't need the actual processing power and if you don't have stuff on the IO pins that must have 5v or very close to 5v to work, your arduino could probably run at 16 Mhz with as little as 3.6v or so.If you lower the clock to 8 Mhz or 12Mhz you could probably get it working down to 3.3v or less, which opens up the possibility of powering the project directly from your lithium battery, making boosting up to 5v not needed.

author: tooki
author_rank: Super Contributor
timestamp: August 08, 2021, 11:05:54 am
content: Quote from: T_guttata on August 08, 2021, 09:15:14 amMy suggestion is to use a single cell, because the Nano’s operating voltage range (for 8MHz at least) covers the entire operating voltage range (from maximum charging voltage to below total discharge) of the single cell, so it can be connected directly to it. This way you don’t need to doanyboosting or regulation. You just need a charger IC that can accept your 12V.I know for a fact that the BQ25895 can both charge and power a device from 12V and output voltages within the Nano’s voltage range, and indeed I’m sure there are simpler ICs that can do that, too.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 08, 2021, 11:32:54 am
content: With a huge lead acid battery the arduino will run forever, but that's not the intention.I'm looking for something generic and with a reasonnable size, which can be used for various projects. That's why I would like to have 5V, even though for the most efficient system 3.3V are better.Quote from: NiHaoMike on August 07, 2021, 05:38:23 pmWhat's about this statement?If I use the BQ25895, I would still need to boost to 5V.

author: Peabody
author_rank: Super Contributor
timestamp: August 08, 2021, 01:34:20 pm
content: In your drawing, what part do you have in mind for U3? This would be a 2S lithium charger powered from 12V?

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 08, 2021, 02:00:49 pm
content: If efficiency is not that important, an adjustable LM317 circuit with a diode on the output will work as a charger. Adjust it until the output is around 8-8.2V (better to err on the low side) without a battery connected but with the load connected.Quote from: T_guttata on August 08, 2021, 11:32:54 amMost switching regulator modules are optimized for fairly high currents and run inefficiently at low currents. You basically have to design your own switching regulator to get one that's efficient at low currents.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 08, 2021, 03:24:12 pm
content: Quote from: Peabody on August 08, 2021, 01:34:20 pmAn IC which will step down 12V to something which the charger accepts.Quote from: NiHaoMike on August 08, 2021, 02:00:49 pmLike this?[ Specified attachment is not available ]

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 08, 2021, 03:28:27 pm
content: The battery (with BMS) should be on the other side of the diode and should not be connected to the input supply. (Input supply only connects to regulator.) The current limiting resistor should be on the input of the regulator, calculated as (12V - 1.5V - 0.7V - 6V) / (current limit).

author: T_guttata
author_rank: Regular Contributor
timestamp: August 08, 2021, 04:12:14 pm
content: You mean like this?

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 08, 2021, 06:56:59 pm
content: That's more or less it. Add a potentiometer to fine tune the output voltage. Optionally, you can also add a LED with resistor across the current limit resistor to indicate when it's in the "bulk" charging state.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 08, 2021, 09:36:58 pm
content: Ok. The battery must have an integrated BMS right? So to single cell in series (https://de.aliexpress.com/item/1005002941081413.html?spm=a2g0o.productlist.0.0.2fd6605ciTJq1U&algo_pvid=5ce3809c-eee0-41d7-97ec-50f03589efbf&aem_p4p_detail=202108080212111292576454469270012127796&algo_exp_id=5ce3809c-eee0-41d7-97ec-50f03589efbf-19) will not work?

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 08, 2021, 09:54:31 pm
content: Two 1S batteries with individual 1S BMS should work, if they're matched well enough. But using a 2S BMS is the right way.

author: tooki
author_rank: Super Contributor
timestamp: August 09, 2021, 11:27:53 am
content: Quote from: T_guttata on August 08, 2021, 11:32:54 amAs I’ve explained twice alread:no, you don’t. The voltage across a single LiIon cell (including when charging) ranges from around 3V to 4.2V, all of which is sufficient to run the Arduino. Let me be perfectly clear:the Arduino Nano does not need the full 5V. I’ve done this myself, it’s not theoretical.Requiring 2S dramatically reduces the selection of charger ICs, and it forces you to lose energy in a regulator.

author: tooki
author_rank: Super Contributor
timestamp: August 09, 2021, 11:30:21 am
content: Quote from: T_guttata on August 08, 2021, 03:24:12 pmI strongly advise against charging any lithium battery with a simple voltage regulator. It’s unsafe, and it will reduce the lifespan of the battery.

author: tooki
author_rank: Super Contributor
timestamp: August 09, 2021, 11:36:27 am
content: Quote from: mariush on August 08, 2021, 10:40:00 amFYI, the atmega328p used in the nano has similar speed/voltage specs. The 16MHz version officially requires 5V, the 8MHz version 3.3V. But every 16MHz one I’ve tried on 3.3V has worked fine, and in fact worked happily down to 2.7V. I wouldn’t push them out of spec for a commercial product, but for a one off hobby project, absolutely. 8MHz is well within spec down to the typical LiIon discharge voltages of 2.8-3.0V.

author: tooki
author_rank: Super Contributor
timestamp: August 09, 2021, 11:45:03 am
content: Quote from: tooki on August 09, 2021, 11:27:53 amHere is a video demonstrating an Arduino Uno (which is the same MCU as the Nano) running on a single LiIon, and down to 2.7V.https://youtu.be/3pkfT5J0l9cOh yeah, I meant to mention: there’s also now the next generation Arduino Nano, the Nano Every. It’s more powerful but uses a tiny bit less power. Same voltage specs.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 09, 2021, 12:51:12 pm
content: Quote from: tooki on August 09, 2021, 11:30:21 amWorks just fine if the regulator limits both voltage and current, that's more or less how small solar charge controllers work. You do have to limit the voltage somewhat lower than the usual 4.2V/cell, the 4-4.1V/cell I gave works well.

author: Peabody
author_rank: Super Contributor
timestamp: August 09, 2021, 02:06:30 pm
content: I agree with tooki. You can't charge lithium batteries with a simple voltage regulator, even if it also limits current. The charge has to be initiated properly, which may require very low current initially if the battery has been discharged below 3V per cell, and more important, charging has to be terminated properly when the battery is fully charged. You can't continue to apply 4.2V per cell to a fully charged lithium battery. So I think you need an official lithium charger IC if this will be an unattended device.When I've looked at using a 2S system, I've always ended up using single cells instead, sometimes in parallel. 2S charging adds complications, including the need to balance the cells, and I've just ended up using single cells. That's particularly useful if the peripheral devices attached to the Nano can also be interfaced at something below 5V so a regulator isn't even needed - as mentioned above. That circuit could look something like the picture below. The mosfet functions like a diode, but with essentially no voltage drop, so you get maximum battery life.

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 10, 2021, 03:42:26 am
content: Quote from: Peabody on August 09, 2021, 02:06:30 pmHence why the regulator is set for a lower 4-4.1V/cell.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 10, 2021, 08:28:11 pm
content: @ tookiI don't mistrust you. The arduino will run @ <5V, but I need 5V for the circuitry after the arduino! I'm looking for a generic solution, and I assume the arduino can not step up 3.7 to 5V?@PeabodyIn your drawing: how do you step up 3.7V (LiPo) to 5V?Maybe with some of the new TI ICs?Step up:https://www.ti.com/lit/ds/symlink/lm5157.pdf?ts=1628605762631&ref_url=https%253A%252F%252Fwww.ti.com%252Fpower-management%252Fnon-isolated-dc-dc-switching-regulators%252Fstep-up-boost%252Fproducts.htmlBuck overview:https://www.ti.com/power-management/non-isolated-dc-dc-switching-regulators/step-down-buck/buck-converter-integrated-switch/products.html#p238max=12;60TPS62903https://www.ti.com/lit/ds/symlink/tps62903.pdf?ts=1628591273501&ref_url=https%253A%252F%252Fwww.ti.com%252Fpower-management%252Fnon-isolated-dc-dc-switching-regulators%252Fstep-down-buck%252Fbuck-converter-integrated-switch%252Fproducts.htmlTPS62903 would have an efficiency >80% even at a very low current of 1 mA.

author: thm_w
author_rank: Super Contributor
timestamp: August 10, 2021, 11:14:22 pm
content: They already sell boards specifically for this, but depending on load you may need to parallel additional cells.I would go for one of the 5V in 5V out versions.https://www.aliexpress.com/item/33007770861.htmlhttps://www.ebay.com/itm/383776099170?https://www.aliexpress.com/item/1005002724057002.html

author: Peabody
author_rank: Super Contributor
timestamp: August 11, 2021, 01:53:36 am
content: Quote from: T_guttata on August 10, 2021, 08:28:11 pmI guess the drawing is a bit misleading. The "5V" label on the Arduino refers to the 5V pin on something like the Nano. The actual voltage there would either be the battery voltage, or 4.7V if powered from the 12V supply.But I see in your response to tooki that you need 5V for things interfaced to the Arduino. So in that case you would need a boost converter to bring the battery voltage up to 5V. Something like an MT3608 module. They are available on Ebay, etc., for about $1.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 11, 2021, 04:50:52 am
content: I know the MT3608. I have used it to step up from 12V and it works quite well.However:1x Buck converter (12V to 5V)1x Battery charger module1x MT3608 to step up from 3.7 to 5VThen another MT3608 in case V>12V is needed...There must be a better / more efficient solution around? I'm certainly not the first one trying to use the arduino with a 3.7V battery as a backup?There are even buck converter ICs with integrated inductor from TI (https://www.ti.com/lit/ds/symlink/tpsm53603.pdf?ts=1628657303642&ref_url=https%253A%252F%252Fwww.ti.com%252Fpower-management%252Fnon-isolated-dc-dc-switching-regulators%252Fstep-down-buck%252Fbuck-modules-integrated-inductor%252Fproducts.html)

author: Peabody
author_rank: Super Contributor
timestamp: August 11, 2021, 02:09:21 pm
content: No, you aren't the first. In fact there are modules that include the charger and the 5V boost converter, and even an 18650 battery holder. But they provide for a 5V input power supply, such as USB or a USB power brick, not 12V. Are you committed to the 12V supply?

author: T_guttata
author_rank: Regular Contributor
timestamp: August 11, 2021, 04:37:49 pm
content: Well, it depends. At least for one project I need around 30V and step up from at least 12V is better than 5V.Do you have a link to such a module? Architecture could probably be very similar?

author: thm_w
author_rank: Super Contributor
timestamp: August 12, 2021, 12:10:36 am
content: Quote from: T_guttata on August 11, 2021, 04:37:49 pmDid you bother to read my post?

author: tooki
author_rank: Super Contributor
timestamp: August 12, 2021, 12:54:57 pm
content: Quote from: NiHaoMike on August 09, 2021, 12:51:12 pmReallyshitty ones maybe. Proper ones perform proper end-of-charge termination.The battery datasheets say not to trickle charge LiIon cells. It reduces their lifespan.Whether it’s safe or not (in the sense of “does it cause danger”), that depends on the cell. 18650s certainly advise against it, but do state that the battery won’t catch fire. But LiPo cells are generally not as forgiving, hence the RC packs being know to catch fire if mistreated.

author: tooki
author_rank: Super Contributor
timestamp: August 12, 2021, 01:07:05 pm
content: Quote from: T_guttata on August 10, 2021, 08:28:11 pmCorrect, it doesn’t do boosting.Why don’t you use TI’s Webench Power Designer tool to figure out what you need: enter 2.7-3V as your minimum input voltage (depending on your battery) and 4.4V as your maximum input voltage; 5V as your output voltage, and your nominal (typical) and maximum current draw. You can specify some other parameters too (like nothing smaller than an 0805 size). It’ll then spit out designs (including PCB layout, editable schematic and simulation, and parts list) that meet your criteria. I’ve had great luck with it.Remember that 3.7V is not your lowest input voltage, it’ll be as low as 2.5V (though most cells say to only go down to 3 or 2.8V), and the maximum voltage will be around 4.2V. (Again, check your battery datasheet.) I prefer to give the design a bit of headroom, hence entering parameters just a bit wider than needed.

author: Peabody
author_rank: Super Contributor
timestamp: August 12, 2021, 02:58:44 pm
content: I'm not familiar with the items linked in the post by thm_w. The ones I've used usually come up on Ebay as "18650 battery shield V3" which is for a single cell. However, they may not be suitable because they don't have a load sharing circuit (the mosfet and Schottky diode in my drawing). It's all explained in this video:I also tried the two-cell V8, but it didn't work. The one I received used the same chip for both charging and boost, and it didn't switch properly when the input power was lost, so the Arduino rebooted. There appear to be a lot of different circuits for these modules, so even if you find one that works, the next time you order you may get a completely different circuit that doesn't work as a UPS.Perhaps thm_w can say whether his modules have the load sharing function (also known as "power path"). I'd like to find a module like this which includes load sharing. With load sharing, the input power, if present, will continue to power the load directly when charging terminates.But I think all these modules have 5V input, not 12V.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 12, 2021, 04:13:42 pm
content: @thm_wOverlooked it, sry. I will order one of those and try.Just tried the TI tool:Obviously there are many options, the best in terms of efficiency / BOM count / board area / cost is:TPS613222ABOM count: 5Footprint: 44 mm2cost: $0.88efficiency: 91.8%

author: mariush
author_rank: Super Contributor
timestamp: August 12, 2021, 04:53:04 pm
content: Yeah, good luck with that ... sometimes you have to compromise and get what you can get ... that chip is not in stockI've suggested a few boost regulators just a few hours ago to someone else, these are all chips in stock at digikey and probably other distributors:https://www.eevblog.com/forum/projects/suggested-boost-converter-chip-for-3-v-to-5v-500ma-or-so/msg3625727/#msg3625727Note that those were chosen for their ability to do 500mA or more on 5v ... if you just need to power your arduino and other things, maybe 100mA or thereabouts would be enough.As an example MIC2250 that I linked there can do 2.5v to 5v at 100mA at around 85% efficiency, and with 3.3v input it's getting close to 90% efficiency. See page 4 in the datasheet :https://ww1.microchip.com/downloads/en/DeviceDoc/mic2250.pdfIt also requires very few components - inductor, diode, two resistors to set output voltage, two ceramic capacitors in input and output ... that's all ... all can be surface mount, tiny.It's also in stock everywhere :https://www.findchips.com/search/mic2250You can also get regulators that are factory set at 5v output, so you don't need adjust resistors, and save pcb space.For example see Torex XC1940 - you only need the inductor and two ceramic capacitors :https://www.digikey.com/en/products/detail/torex-semiconductor-ltd/XC9140C501MR-G/3885164It goes up to 100mA with 5v output.You have Microchip MCP1642 in two packages, both hardwired to 5v output :https://www.digikey.com/en/products/detail/microchip-technology/MCP1642B-50I-MS/5137716https://www.digikey.com/en/products/detail/microchip-technology/MCP1642B-50I-MC/5137696It trades efficiency at low currents (only around 60% efficient at 1-10mA) but it's more efficient, over 90% efficient at 100mA and more, and can do even 1A.Same reduced number of components.There's MCP2876 in a tiny package and which is also quite efficient at 100mA or so :https://www.digikey.com/en/products/detail/microchip-technology/MIC2876-5-0YMT-T5/5283860

author: T_guttata
author_rank: Regular Contributor
timestamp: August 12, 2021, 05:48:53 pm
content: Thanks! The MIC2250 indeed sounds very interesting and is in stock :-) I have put that chip on my list. I will search for one which will do 12->5V and then i will try build my own circuit.Is there a general rule of thumb regarding efficiency? Are ICs for a wide voltage range generally less efficient than those designed for a specific voltage?Edit:Anyone heard about this IC:http://www.consonance-elec.com/pdf/datasheet/DSE-CN3791.pdfIt has a wide range for input voltage.

author: thm_w
author_rank: Super Contributor
timestamp: August 13, 2021, 10:59:58 pm
content: Quote from: Peabody on August 12, 2021, 02:58:44 pmGood info about load sharing. Couldn't find any that clearly had implemented it.We don't know what is suitable as OP has not provided a max expected current draw information. According to that youtube video, at most we can draw ~40mA or so to avoid the "stuck at 3V charge" issue.I don't really believe his claim that floating a li-ion at 4.2V is a safety issue (discussionhere). But you may accelerate the degradation of the cell. For a hobby project, not really a concern, for a commercial project something to care about for sure.What we know is:"3) High efficiency, with a 2000 mAh battery, the arduino shall run for at least 2 weeks (336h)"As Buriedcode says 6mA continuous draw for the entire system.The only OP gave for 12V supply was that "30V is easier to boost to from 12V", so still could use more info here. What current draw this 30V supply requires, if its on all the time? Or if it only runs when mains power is available?About the Arduino reboot, I saw this youtube comment as well:"Hi, I found a problem with the DiyMore boards (at least V8 and V9). They reset the output (turn them off) for 500 ms everytime you connect or disconnect a input power USB C or micro USB cable. So they can't be used as UPS, as they interrupt the power sometimes."So, terrible design if that is the case, I'm sure some don't have this problem..

author: T_guttata
author_rank: Regular Contributor
timestamp: August 14, 2021, 12:02:39 pm
content: Just do add some more information:I clearly don't intend to power a high load for 336h. The intention is that the arduino does not loose memory. Example: if I use the same button for power on and off, the status has to be stored. If arduino looses power, it's lost. With the UPS I want to avoid that.Wheter the input power is 5V or 12V or even 24V will depend on the project. I'm looking for a generic solution which could be easily adapted to either of those inputs. For illumination projects for example, 12V or 24V seems to be a reasonnable input voltage as there are many LED stripes around for that voltage.What I have learned so far:I certainly need a battery charger IC, a load sharing circuit and a boost converter to bring the battery voltage to 5V. Depending on the specs I will additionally need a buck converter at the input.What I'm still not shure is which ICs to choose. The TP4056 is not available at digikey and seems that there are not many alternatives out there. The MIC2250 sounds interesting. I will have to try!

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 14, 2021, 12:43:40 pm
content: All you need is a capacitor and an interrupt to save state to EEPROM.

author: mariush
author_rank: Super Contributor
timestamp: August 14, 2021, 01:59:18 pm
content: Yeah, that would work.Alternatively, a basic calendar/time chip and a CR2032 battery would do the job. There's clock chips that have a 64 byte SRAM memory backed by battery, and you could store your button states and other stuff there.You could also go the Xbox route with a super capacitor instead of battery.

author: tooki
author_rank: Super Contributor
timestamp: August 14, 2021, 03:06:22 pm
content: Sooooo… you don’t need a UPS, you just need to save your data to non-volatile memory. There are tons of solutions for that, from the small amount of EEPROM inside an arduino itself, to a small I2C EEPROM, all the way to using SD cards.Maybe you should describe better what your actual project is. Classic X-Y problem…Quote from: T_guttata on August 14, 2021, 12:02:39 pmHow did you arrive at that conclusion?!?TI alone has 48 charger ICs that are standalone (no MCU control needed*) and have Power Path (load sharing). And that’s just one manufacturer. I know for a fact that others, like Analog Devices and Maxim do too.Digi-Key doesn’t carry the cheap Chinese manufacturers, which is why you can’t find the TP4056 there. I don’t consider that a big loss, given that most of them tend to be clones (of varying quality) of outdated designs by the big manufacturers.*many of the charger ICs designed for MCU control do in fact function standalone, with some default configuration. If one of those defaults works for you, that opens iup even more candidate ICs. The BQ25895 is an example of that: if 500mA charge current at 4.2V (for a maximum of 12h, so only for a battery that can fully charge within that time) works for you, then you can us it as standalone.

author: Peabody
author_rank: Super Contributor
timestamp: August 15, 2021, 03:01:10 am
content: One popular charger IC that Digikey carries is the MCP73831. I believe it's functionally equivalent to the TP4056. And there's the MCP73871, which has load sharing built in like some of the TI chips do, but it's a bit more complicated to use.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 15, 2021, 10:09:39 am
content: Quote from: tooki on August 14, 2021, 03:06:22 pmAs I said, I'm looking for a generic solution to power the arduino on 12V incl. a battery as a backup.I searched for alternatives for TP4056. Yes, I see that there are tons of ICs from TI and others, but most seem to have much more functionality which I don't need.Quote from: Peabody on August 15, 2021, 03:01:10 amI gave it a try (see attachment)AP62301 to bring the voltage down to 5VMC73831 for charging the battery cellMIC2250 to boost the output voltage to 5VBy the way: how can you properly insert images?

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2021, 11:37:45 am
content: Quote from: T_guttata on August 15, 2021, 10:09:39 amYou do realize that you don’thaveto useallthe functionality a chip offers, right?

author: T_guttata
author_rank: Regular Contributor
timestamp: August 15, 2021, 12:51:06 pm
content: Yes I know.For somone new to electronics, you can easily get lost with the amount of components out there. Therefore I try to start simple and then grow.Any feedback on my previous sketch is appreciated ;-)

author: Peabody
author_rank: Super Contributor
timestamp: August 15, 2021, 01:49:15 pm
content: I would just suggest that you put some kind of manual on/off switch or jumper just ahead of the boost converter. That would let you charge the battery without having to power up everything else. Also, you would need to limit yourself to using protected batteries since the circuit has no protection built in.

author: T_guttata
author_rank: Regular Contributor
timestamp: August 15, 2021, 02:04:01 pm
content: Ok, dou you mean DW01 and FS8205 as explained in the videoLoad Sharing for the 18650 Battery Shield V3?

author: madires
author_rank: Super Contributor
timestamp: August 15, 2021, 02:24:24 pm
content: Quote from: T_guttata on August 08, 2021, 03:24:12 pmYou can have both (buck converter and Li-Ion charger) in one IC, e.g. SY6912A. There are SY6912A based modules/PCBs available on AliExpress & Co which allow you to easily set the max. charging current (up to 2 A) and the number of cells (1-3).

author: Peabody
author_rank: Super Contributor
timestamp: August 15, 2021, 06:26:43 pm
content: Yes. I think most LIPO batteries come with protection built in these days, and you can get 18650s either way. So it's not really a problem. Just be sure the battery has protection built in.