Advice on designing my own MCU controlled DC-DC battery charger. - Page 1
Forum section: electronics / beginners

author: krby
author_rank: Contributor
timestamp: January 13, 2024, 10:35:52 pm
content: I think this belongs in "Beginners", please move or let me know if not.For various reasons, I'd like to build a flexible DC battery charger. The way I'm imagining it, it's is an CC CV DC-DC converter controlled by an MCU like an Arduino or Teensy. I'm very comfortable with the CC/CV profiles needed by the battery chemistries I care about, and I'm very comfortable writing the code that does this. I'd like it to be fairly high power, say 0-30VDC and 0-30A output. I've done many projects wiring up modules and components like a voltage sensor, ADC, AC current sensor, voltage divider to an Arduino, but never done my own PCB layout. I'm very comfortable with a multimeter, becoming comfortable with an oscilloscope. I've read/watched a ton of content about AC-DC and DC-DC converters and I think I understand how buck and boost converters work, including feedback.Based on my research so far, I'm not going to tackle the AC/DC conversion myself. So, I'll buy a fixed voltaeg AC/DC PSU. Then I can either design my own circuit for the DC-DC conversion controlled by an MCU, or buy an existing module and replace the typical pot with some signal from the MCU. I don't mind designing an soldering a PCB myself, I'd get it done at one of the various small-batch online vendors. I've done mostly thru-hole soldering, but I have little bit of manual surface mount and I've looked at "make your own reflow oven" projects and that looks very much within my skill level. Part of the draw of this project is a concrete goal that would force me to learn layout, design, building PCBs.Ok, so finally my questions for this group.From what I have read, a buck converter might be the easiest option. So, I'd find a >1000W PSU with >30VDC (48V is common) ourput and then step down from there.What I'm trying to figure out if if I should try and design the whole circuit from components myself or start with IC that handles feedback and such for me. One problem with the IC is that I'd really like to handle 30A of current on the output, I could compomise on this, but it would be no lower than 20A and I haven't seen a lot of ICs in that range, but I have seen 20 and 30A MOSFETs and I'm sure I could manage the heatsink and airflow for those.One final thing. The immediate use case for this is to replace an RV-style converter charger I have as part of a cobbled together DIY UPS. It's a double conversion architecture, so the converter-charger (and my new device), will first charge the batteries and then deliver stay at a "float" charge while delivering up to 20A at 24VDC that floats the battery bank and runs the DC-AC inverter.Advice is appreciated, thanks!

author: Andy Chee
author_rank: Super Contributor
timestamp: January 13, 2024, 11:12:27 pm
content: Quote from: krby on January 13, 2024, 10:35:52 pmStart with an IC. If you can't get an IC with your desired current rating, there will be a way to boost it with external MOSFETs if required.

author: krby
author_rank: Contributor
timestamp: January 13, 2024, 11:19:00 pm
content: QuoteThanks for the reply! I am new to this. This is the sort of thing I want to know more about. How would I do this? What sorts of things can I search for to learn more?Also, can I parallel ICs? If I find a 10A IC that has the Vin and Vout I need and parallel three of them? Things to worry about doing that?Not that I want more complication, but I think several ICs gives me more IC->heatsink surface area so it would be better from a heat management point of view.

author: Andy Chee
author_rank: Super Contributor
timestamp: January 13, 2024, 11:25:48 pm
content: It all depends on the IC you choose.The easiest place to start might be to use Digikey's part selector to narrow down parts that fit your criteria. Then you can read the part datasheets and application notes to get an idea of how the part is used in a circuit.

author: krby
author_rank: Contributor
timestamp: January 14, 2024, 06:34:52 pm
content: A quick search on Digikey looking for step-dpown adjustable output and output current >15A led to only a few choices. Most of them versions of theLT8648SSkimming the datasheet and then seeingand a writeup somewhere elsetells me I can run at least two in parallel.Being a beginner, my concerns are this IC seems more complicated with more features than I need, but maybe that's going to be true of any high power IC? Also, I guess I should expect most of these ICs to come in QFN packages, so I'll have to figure out how to design for that in a way I can solder it at home. Finally, it isn't clear to me how to thermal management works for that part. Is it just the connection to the PCB? Could I rely on putting this in an enclosure and forcing air over the whole thing?

author: radiolistener
author_rank: Super Contributor
timestamp: January 14, 2024, 09:28:48 pm
content: You can buy some lab PSU like KORAD with CC/CV mode and computer interface, like KA3005D. There is a sense to looking for SMPS PSU, because battery don't needs low noise and switching mode PSU allows to improve efficiency. Then write program for computer or MCU which will control PSU to stop charge by monitoring current and voltage on the battery.Note, there is no needs for DC/DC control by MCU, because this is dangerous way and can lead to circuit failure, battery damage and for charger circuit it even can lead to a fire and explosion.DC/DC conversion should be controlled with fail safe analog circuit. MCU is required here just to setup analog parameters (charge voltage and charge current) and for charge monitoring (measure voltage, current, battery temperature) to stop charge when it charged to 100% or if battery failed (broken or short circuit, fire or explode).You can replace MCU with two analog potentiometers to setup current and voltage and some analog triggers which will stop charge.

author: krby
author_rank: Contributor
timestamp: January 14, 2024, 10:48:30 pm
content: Thanks for the reply! First a bit of background:The first use case for this will be to replace an RV-style converter/charger. It's a CC/CV battery charger that stays "on" in a float mode. It's clearly built for SLA type batteries (which I have) but it's not very flexible. This converter charger is one component of a cobbled together DIY UPS I have for my home network rack. The whole system is a double conversion online topology. RV converter/charger charges the AGM battery bank, then an inverter runs full time to provide power. The inverter is powered from the converter/charger when AC mains is present, or the battery when not. It's built this way because I had the batteries and the inverter already, so adding the converter/charger was the only thing thing I needed.To this converter/charger -> battery bank -> inverter setup, I have added a Arduino Pro Micro clone running some code and a few external boards/modules to do AC on/off detection and DC voltage sensing. Over the USB port, the Arduino appears to be a HID Power Device (aka a UPS) to aNUT server, so I can have various devices react when the AC mains goes away. As an example, my NAS shuts down after 15min to increase the time-on-battery of the rest of the network rack). None of this is critical, but it's been a fun project. It was inspired because I realized I could get an Internet connection even when my entire block was off power if I could just power my "modem" and router.I said all this for a few reasons:* I have a working system. I don't "need" to do this. I'm thinking about building because I need an Arduino anyway for the UPS reports over USB and that got me thinking about more flexible battery charger / adjustable power supply in general. I want the challenge of the project, but I don't have a "solve this as easily as possible" need.* The converter/charger works, and I also have a cheap bench top PSU which I've used it for charging various things in the past. I also have a few fairly flexible battery chargers typically used by folks in the R/C hobby. I have things that will do the job, all would need the addition of my Arduino for UPS reports over USB.* One of the longer term goals of doing this would be to reduce the "number of boxes" in my DIY UPS system from two to one. Practically, this means I'd need to contain both the AC/DC and the inverter side in the same box. A may not do that right away, if/when I do I would use something like the EGS002 driver board.I assume your point about not controlling DC/DC conversion with an MCU means "don't have the MCU directly drive the transistors or MOSFETs with PWM". That seems reasonable, so "build it myself" should be an IC with some adjustment pin I can control from the MCU (which would also run my user interface and the the existing "UPS reports over USB" functions.I guess another option is to buy a pre-built DC-DC conversion module that has an analog pot for adjustment, and then use the MCU and a simple circuit in place of the pot.

author: krby
author_rank: Contributor
timestamp: January 15, 2024, 01:27:56 am
content: Another thing, I was looking only for buck converters, assuming the parts would be simpler, but I guess I could look at buck-boost parts or just boost parts too.

author: radiolistener
author_rank: Super Contributor
timestamp: January 15, 2024, 02:09:42 am
content: Quote from: krby on January 14, 2024, 10:48:30 pmyes, exactly

author: krby
author_rank: Contributor
timestamp: January 15, 2024, 02:36:17 am
content: Ok, so concretely with something like the LT8648S, output voltage is controlled by the resistor values of a voltage divider between Vout and the FB pin.So in my case, I would use something like a digital pot connected to my Arduino as R1 or R2 in the voltage divider. Right? Is that the simplest way? For the "constant current" phase of battery charging, I can just monitor actual current going to the battery (with a shunt) and adjust the target voltage until the current is where I want it, right?