Adding batteries to a project, how to do it safely? - Page 1
Forum section: electronics / projects

author: Frazatto
author_rank: Contributor
timestamp: February 10, 2022, 02:03:05 pm
content: Sorry in advance, I'm sure those topics already exist somewhere, but I honestly don't know what I'm looking for and searching aimless has returned nothing usefulI'm trying to add lithium batteries to a circuit that didn't had rechargeable batteries and I'm experiencing two problems I don't know how to fix or mitigate.Someone will ask, so yes, I'm using a bms and a power supply suitable to it's voltage limits.As I understand, I should just put it in parallel to the input socket, it works and it recharges, but.....If I disconnect the power supply from he wall, it starts being powered by the batteries.And if I connect the power supply to the circuit before plugging it to the wall, the batteries just drain and will only start recharging if I unplug everything and start over.How do I go around this issue?I'm sure they are caused by the same problem, current shouldn't flow back to the power supply.

author: Buriedcode
author_rank: Super Contributor
timestamp: February 10, 2022, 10:49:04 pm
content: I believe you're after a load sharing circuit. Although not explicitly to stop "backflow" it does so because it powers the load via a (necessary) diode.If you're plugging your power into a charging circuit, I'm not sure I understand the problem - such a charging circuit should prevent current flowing from battery to power input.

author: AaronD
author_rank: Frequent Contributor
timestamp: February 10, 2022, 11:59:28 pm
content: You say you have all the right parts, but not how they're hooked up. Something seems odd with your description of behavior. If you've got some things in the wrong order, that might explain it...and possibly prevent the safety stuff from doing its job.

author: mikerj
author_rank: Super Contributor
timestamp: February 11, 2022, 09:17:35 am
content: Quote from: Frazatto on February 10, 2022, 02:03:05 pmA BMS does not normally have a charging circuit built in, are you connecting it to a Li-Ion charger or a regular power supply?

author: Frazatto
author_rank: Contributor
timestamp: February 11, 2022, 05:17:47 pm
content: Quote from: Buriedcode on February 10, 2022, 10:49:04 pmOk, we are going somewhere here, so the problem is called "backflow"?And yes, a diode is the obvious first try, but it creates more problems than it solves.Tried it in the past, it's only suitable for low current solutions, the diode in this case just overheats. There are specific diodes for such solutions, but they are very expensive.Hahahah now I feel silly.....I started researching for backflow, the term "reverse polarity protection" shows up and it's so obvious now.Just need a P-MOSFET with very low RDS on resistance, any suggestions??

author: AaronD
author_rank: Frequent Contributor
timestamp: February 11, 2022, 05:51:50 pm
content: This is the kind of problem that really needs a schematic. What I'm reading from you doesn't really tell me anything except for a Bill of Materials, which is nowhere near enough information.

author: Frazatto
author_rank: Contributor
timestamp: February 11, 2022, 06:19:42 pm
content: Quote from: AaronD on February 11, 2022, 05:51:50 pmSo forgive me, for real, I would love to even give you pictures if that would help. I have to do a lot more research this way, but at least I get new information to keep going.I understand your frustration, but what I learned is that if I give very specific details, most people will just answer "yOu ShOuLdN't Be DoInG tHaT" and kill the thread.And every single time I mention lithium batteries, someone will start fearmongering the hell out of the subject, give no real suggestion and kill the thread.I'm not in United Stats or Europe, good components are expensive, when I mention I only have access to cheap Chinese stuff, someone will eventually give a sermon about how those are not reliable and, again!, kill the thread.I'm upgrading a pair of vintage PC speakers.To work with the batteries I'm using between 8~9V and any power source below 2A rating just clips the music on high notes.I have experience building a VERY similar setup to use with a Raspberry Pi and it worked great, except for the problems I mentioned of backflow.

author: AaronD
author_rank: Frequent Contributor
timestamp: February 11, 2022, 07:29:44 pm
content: Well, the parts shortage is a global thing, including the U.S. where I am. Unless it was that way for you before...I've made some DIY UPS units for Raspberry Pi's, and all of them explicitly avoided lithium batteries because I didn't want to guarantee a safety circuit. NiMH behaves close enough to lead-acid to use one of the many UPS units designed for those, except it's lighter, and even a small one of those gives me easily enough run time to debounce a shutdown signal and then shut down.I have another project in the initial concept stage that doesn't have much room for batteries and requires a lot of run time, so I think I'm stuck with lithium-ion for that. And I'm putting a LOT of effort into really understanding what I'm dealing with and how to GUARANTEE that the cells are NEVER mistreated. No excuses. So even with relatively good access to parts, I'm still taking the safety aspect very seriously myself.Lithium is natively one of the most dangerous chemistries to choose from, but when you get all of the protection right, it becomes the safest because of that protection. The trick is knowing for sure, and knowing that you know, that you actually DO have the protection right! Until then, I'd go with some other chemistry, probably nickel- or lead-based.If your speakers can run on single-ended 12VDC, then I'd be tempted to look for a UPS module that outputs 12VDC and takes a lead-acid battery, and then put a NiMH battery on it. As far as the speakers are concerned, they're always running from the new "battery" connection that you're adding to them, and the pre-fab UPS module does the switching and charging and all that. 24V, 36V, and 48V also sound to me like they ought to be available, though probably less common.And because you're using a relatively safe chemistry, you don't have to worry about it taking revenge if you somehow mistreat it.DON'T, however, expose the battery connections of an AC-output UPS! That is not isolated from the mains, and so you have to treat anything that it's hooked up to as if it were mains live.If you really want to design your own, you can start by drawing two separate schematics: one for charging and one for discharging. Don't worry about what the other needs yet; just draw each in isolation. Then compare them to see what's connected to where and what's not.Since you said that the diodes you have access to aren't big enough, what transistors (probably MOSFETs with a fast switching time and low Rds_on) and switching logic do you need to get from one schematic to the other? How fast does it need to work to avoid a dropout? (a capacitor on the output can help a lot with that) Is there something that the switching logic can use as a trigger? How do you drive those transistors anyway? Do you need a charge pump to keep the gate above the main supply rail? Or does it pull to ground instead? Etc.

author: Terry Bites
author_rank: Super Contributor
timestamp: February 11, 2022, 09:08:39 pm
content: This is going to be very specific to your project requirements and available power sources. Look into charger ICs with built in protection. See what AD ON TI and Microchip are offerring as a starting point.

author: Buriedcode
author_rank: Super Contributor
timestamp: February 12, 2022, 09:26:54 pm
content: Yeah, I realise you don't want to derail the thread, but I haven't seen you mention a charging circuit - that is, a circuit specifically to control the current and voltage limits from power/charing input to the battery.Any "fear mongering" might be warranted - just charging lithium batteries with an input voltage or a circuit designed for a different chemistry can result in fireworks. All we get a lot of "X-Y problem" posts, where a user wants to do somethign specific, but their question is the result of them actually trying to achieve something else, and their chosen method won't work, so they get frustrated when peopel point out that the real problem is their approach.Grenerally, it can be quite straight forward replacing other rechargable batteries (or appliances designed to work off alkaline cells) with Lithium batteries, mostly because there are BMS and charging modules available "off the shelf" everywhere. The danger can be when people try and DIY everything from scratch, or just drop them in without a thought as to how the battery will be treated in the circuit.I'm going to add a +1 to a schematic, or at least a rough diagram of connections you've got between the modules that you're using.

author: AaronD
author_rank: Frequent Contributor
timestamp: February 13, 2022, 02:38:03 am
content: Quote from: Buriedcode on February 12, 2022, 09:26:54 pmI would question those too. There are lots of good ones that do just drop in and work, and there are lots of bad ones that are built to optimize cost at the expense of everything else including function. Not much difference in marketing, as far as a consumer knows, because the knockoffs copy/fudge/pirate what consumers click on. Even the regulatory compliance logos can't be trusted anymore, for exactly that reason. Some of the fakes are quite convincing, even to a trained eye, until a destructive teardown reveals what it really is.Safety and other regulations are supposed to be policed by the importer, at least according to U.S. law, with the assumption that the importer is a large corporation that is easy to send a minder to and confiscate an entire shipload at once. But with today's overseas sellers working directly with individual consumers and transparently handling all of the buyer/importer's red tape on the consumer's behalf, the consumers are left unaware that they have legally become the importer of the one unit that they bought and are therefore *personally* responsible for its legal compliance. The seller is not legally responsible for anything, nor do they want to scare away a bunch of sales by saying what the legalities actually are, if they even know themselves.Shady sources have become an awful lot like the classic "paperclip optimizer" A.I., in the sense that they'll do absolutely anything that works, with no sense of morality or legality at all.That's a big part of why I want to understand for myself what I'm getting into with my own Li-Ion project, so that I *do* trust myself to DIY it, while also being my own worst critic. This also includes the parts that I DIY it from not being genuine either, so how can I keep it safe even when those parts fail in various ways? For example, a transistor that is meant to cut off a cell, can fail short-circuit instead. I need to solve that problem, and many others, before I rely on what I end up building.