1s and 2s lipo discharger (RC Application) - Page 1
Forum section: electronics / projects

author: trilerian
author_rank: Regular Contributor
timestamp: October 18, 2023, 02:52:19 pm
content: I have had requests to design a 1s and 2s lipo discharger. The requests are based around another racers design, but he no longer makes it.I haven't quite got the schematic together from the current design as the unit looks like it has been "fixed" at least once, but I am attaching a basic diagram. There are wires that are bypassing parts of the board and another voltage regulator on it for the 3.3v display. My guess is the resistor divider off the first regulator wasn't working correctly? I don't know. Also when I received the unit the mosfets were burned out, like almost completely gone. I did fix those and the unit currently works.This will be my first design using mosfets. And really, this probably still belongs in the beginner forum, because well, I'm still a beginner, but I would like to make a project thread.So mosfets... The mosfet in the design is the IRL2910pbf (EOL, but Mouser has plenty in stock). It is an N channel logic level fet. Has a 1v Vgs and measurements for RDS on at 4v, 5v, and 10v. So I assume that it is fine to run off the 5v pwm pins straight from the 328P and doesn't need a gate driver. My requirements are to be able to discharge at 40 amps, but since the current unit does that, I assume it is fine.One thing I need to understand is how to control the discharge current. My guess is that there is a duty cycle control code in the mcu. Let me explain how I think this works, then someone can say I am on the right track, or off in left field.I think that you take the output of the current sensor and use that to control the duty cycle to get a constant current that you can set different functions for. IE, discharge at 5, 10, 15, 20, 25, 30, 35, 40 amps.Also, I would like to incorporate a touch screen tft, probably with an sd card and blutooth so results (will be 15 second intervals of voltage readings) can be printed to a portable blutooth printer. It would be really cool if I could make this into a graph, but yeah...And a big thing. The load. The current unit uses a cpu heatsink as the 0Ω resistor. I assume since this is being controlled by the mosfets and mcu, that it isn't an issue.As I type this out, this really doesn't seem all that difficult, but I am still new to electronics and microcontrollers. So the programming will incorporate things I haven't done, namely having different functions to choose from to run. And I have not worked with mosfets yet, nor have I written code for duty cycle but that seems simple enough. The enclonsure though, that is a different story. My fabrication abilities pretty much stop with 3d printing and I don't think I can afford to have someone make me enclosures. So that will be fun.EDIT: I did find these smd mosfets. 6N04L030I think these will fit the bill as well.

author: trilerian
author_rank: Regular Contributor
timestamp: October 18, 2023, 04:51:42 pm
content: The polarity is wrong on the battery in the first basic schematic.Here is the correct polarity.Also, this is basic, I know I have to add a bunch of components.

author: trilerian
author_rank: Regular Contributor
timestamp: October 19, 2023, 07:53:44 pm
content: I have requests to put IR measurement in this. Seems easy enough to do as a separate function, take battery voltage, put battery under load and do calculations. But how would I go about this while the battery is under continuous load during a discharge cycle? I'll have to run a second set of leads straight to the battery terminals for measuring voltage, which isn't a big deal, and I will probably add the the third wire so I can measure each cell individually.

author: trilerian
author_rank: Regular Contributor
timestamp: October 20, 2023, 01:31:16 am
content: I have made some progress on my schematic tonight. To be honest, this project is a little overwhelming for me, but I am trying to take this one step at a time.And, I think I am updating the mosfet again. IRL8721 is what I am thinking now. I still need to add my tft display and figure out what I need for blutooth, then add programming pins. I have a ili9341 display being delivered tomorrow, that is what I intend on using, so I will get to tinker with that to get it working.

author: hbozyq
author_rank: Contributor
timestamp: October 20, 2023, 10:42:26 am
content: IMO a simple electronic load will do the job, with a hysteresis comparator using to end discharging.MCU can be added to achieve advance feature like Battery capacity testing or auto fan control.Check this:https://www.eevblog.com/forum/projects/dynamic-electronic-load-project/

author: tunk
author_rank: Super Contributor
timestamp: October 20, 2023, 11:18:35 am
content: Not sure a CPU heatsink+fan can handle 300+W (8.4V*40A).

author: trilerian
author_rank: Regular Contributor
timestamp: October 20, 2023, 12:44:55 pm
content: Quote from: tunk on October 20, 2023, 11:18:35 amI know they are only rated for ~100w of heat dissipation, but the unit I was sent to start my design was using it without issue. We normally use 5 1ohm 100watt power resistors in parallel hooked to our chargers to discharge.Quote from: hbozyq on October 20, 2023, 10:42:26 am

author: trilerian
author_rank: Regular Contributor
timestamp: October 22, 2023, 12:23:54 am
content: So.Does anyone know any good tutorials for programming an ili9341 tft display? I wired it up and I can get the example screen test from Adafruit to work, and I can get the touch test for the onboard xp2046 to work, it is only a raw output. But, I have no idea how to actually use this thing, and none of the other Adafruit touch examples work since they require some analog pins for x and y.I also got it to work on an esp32 dev board, and I am considering moving this project to that. But, I have never built a stand alone esp32 whereas I have build a few using the 328p, so I have my basic formula for doing that.Another question, and this is basic, but is it just fine to use voltage dividers for the signal lines from the 328p to the display, or do I need to use level shifter(s)?

author: trilerian
author_rank: Regular Contributor
timestamp: October 30, 2023, 04:43:49 pm
content: I made a little progress on my project this past week. I have a working menu system using my touch screen tft display, so that is kind of cool. The menu is basic at this point, but it is mainly a proof of concept that I will refine later. I haven't started programming the actual code for the device yet, but I don't expect that part to be too difficult. The PCB though, I know some of you engineers/hobbyist like doing pcb design, but I think it is for the birds, lol.But I do have some questions and a couple of concerns.1. The load. It was mentioned earlier that a cpu heatsink wouldn't be adequate for the project. What other options are there that I can use for a load? A very common load is 5 1Ω power resistors wired in parallel. However to get a 40-45 amp load on a 1s lipo I would need maybe 0.5Ω resistors. And this is fine, but like I said, it is pretty common. I would like to come up with something that isn't so common, or at least a different way of cooling them so it looks a little different.2. Mosfet heatsink. I am using the TO-220 package and have the fin side down for more area on the drain. Do I just put a heatsink on the component side then?3. Safety cutoff. I am putting an inline fuse between the source and the lowside current sensor. It is a fast blow 50a, Schurter 3-140-167. Should this be sufficient enough for a safety precaution if the source shorts out to the drain on the mosfets? The unit that I was reverse engineering uses a 50a blade fuse (large package). But it hasn't blown even though the source/drain shorted on the fets on that unit. Maybe it is shorting with a high enough resistance that current is still limited. Kind of makes sense as I type it out, since when I got it the case of the fets were almost completely gone.Thanks

author: macboy
author_rank: Super Contributor
timestamp: November 01, 2023, 03:02:45 pm
content: If you want 40 A discharge current, then a fully charged lithium cell at >4.0 V will create a total load of >160 Watt. This is a lot of power. You mentioned TO-220 MOSFET. Most TO-220 devices can handle a few tens of Watts, almost certainly not 160 W. If you try, it will die. I'd recommend going to the much larger TO-247 or similar package device. These can handle much more power. You probably want to use more than one, though there are plenty of such devices which can handle 160Wif kept cool enough.Furthermore, the heatsink for the MOSFETabsolutely mustbe attached to the metal tab side, not the plastic side. The tab is there specifically for heatsinking, not (primarily) for use as an electrical connection. That's what the pins are for. Most often some kind of electrically-isolating mounting is used, such as a "mica washer" or silicone pad, in addition to an insulating washer (if necessary) on the screw. This conducts heat but not electricity, but does add some thermal resistance, so devices will run hotter. If you can isolate the heatsink electrically then it may be possible to directly mount the device to the heatsink for better thermal conduction. As you know, for most MOSFETs the tab is connected electrically to the drain. In a load like this, the drain (and heatsink) would be at the battery + potential. Luckily, you are using low voltages, so no shock hazard. You would just need to make sure to avoid any short-circuit. This implies too, that if multiple MOSFETs are connected directly to the heatsink, then their collectors are implicity connected together by the heatsink, so consider that in the circuit design (probably not an issue here). Whether using electrical isolation or not, you need a thermal compound (heat sink grease etc.) between all pairs of solid surfaces.When others said don't use a CPU heatsink, what was meant is that the heatsink itself is not anelectricalcomponent which can dissipateelectricalenergy in some controlled way. It is a mechanical component which dissipates heat. You need active devices like transistors or MOSFETs, or passive devices like resistors to convert the electrical energy into thermal energy (heat). These devices can and must then be thermally connected to a heatsink so that all that heat can be dissipated efficiently, keeping the device cool enough. Actually, I'd very strongly recommend using a good CPU heatsink with plenty of heat pipes, and preferably a sizable copper heat spreader at the base (the part normally in contact with the CPU) rather than direct heat pipe contact. Done right, such a heatsink can easily dump over 200 watts (probably a lot more) while maintaining a reasonable case temperature for the device. These heat pipe heatsinks are much more effective than an old school chunk of finned aluminum. Plus they are small, light, and cheap. The main downside is that they absolutely must have fan-forced air movement, no natural convection. I doubt you are looking for passive cooling.If you can't do all the thermal engineering required, then the best advice is use more, bigger devices (MOSFETs), bigger heatsink, higher air flow, etc. Maybe you can reduce something if it all stays cool and reliable. Starting small and minimal will likely result in smoke.

author: trilerian
author_rank: Regular Contributor
timestamp: November 01, 2023, 06:47:42 pm
content: Quote from: macboy on November 01, 2023, 03:02:45 pmSo that is a little comical, because I was actually thinking of going to an even smaller package for the mosfets.The mosfets themselves are not dissapating the current, and if I use 2 in parallel, they will see, let's say a max of 25 amps each (one may be slightly higher and always over estimate, right). The RDS on is 13mΩ @ 4.5v gate voltage, and I^2C would be 8.125 watts. Am I missing something? The load will see a max of 8.4v x 45amps = 378 watts. I'm going to use an external resistor banks with video card fans on them. It isn't what I want to do, but I know that solution works. To generate 45 amps with a 1s lipo, I'll need 6 0.5Ω resistors in parallel, to get down to 3.8v @45 amps. Having 6 will also help with the heat dissapation when using 2s, since each resistor will see less load. We normally use 5 resistors in our resistor banks.

author: trilerian
author_rank: Regular Contributor
timestamp: November 01, 2023, 06:50:17 pm
content: As an update to the thread I am attaching some screen shots of my basic menu.I started on my pcb, but got hit without saving!

author: mikerj
author_rank: Super Contributor
timestamp: November 01, 2023, 06:56:24 pm
content: Unless I've missed something I don't see where the MOSFET sources have any reference back to the micro 0v rail? You can't just put 5v on the gate and have the sources flapping around in the breeze on an isolated circuit.

author: macboy
author_rank: Super Contributor
timestamp: November 01, 2023, 07:28:18 pm
content: Quote from: trilerian on November 01, 2023, 06:47:42 pmYou can of course use a combination of resistors and MOSFETs, in which case you can dump most of the heat in the resistors.In this case you have two choices to control the current:PWM, where you use the MOSFETs as switches (full on / off) and adjust the duty cycle of on/off to get the average current to be what you want. I see now this is what you intend, orLinear operation of the MOSFETs. This is similar to what I had described, except that the bulk of the power dissipated is in the resistors, not the MOSFETs.For the PWM case, the power dissipated in the MOSFETs is equal to RDSon*I2. You can actually skip measuring the current, and just calculate the approximate current based on the voltage of the cell (when the MOSFET is on) and the known resistance of the resistor pack + RDSon. Then adjust PWM duty cycle based on that. It won't be super accurate, but probably good enough.For linear operation of the MOSFET, your device will need to control the gate voltage to target your desired current. You will need a shunt resistor to sense the current, and an opamp based circuit to control the gate. Your microcontroller can generate a current control signal using PWM filtered to a DC voltage, which is used as the input to the above control circuit. Search DC Load here and you'll see lots of examples. One big difference will be the additional resistors connected between battery + and the MOSFET drain. You will dissipate more power in the MOSFET than the PWM case, but not a ton more, as the resistors will have more resistance than the MOSFET.I built my own load dump for discharging RC batteries. It is a MOSFET operated in the saturation region (i.e. voltage-controlled current), without any additional power resistors to share the load, and it is mounted on a CPU heatsink. The device behaves very much like an external load resistor for the charger, which controls the discharge process. It works well, and handles at least 150 W while staying only warm to the touch. Unfortunately, most chargers won't discharge with more than about 20 A or so of current, well below what you want. For higher cell count packs, that still gives lots of watts, but with a single cell, not really. My device is as simple as it gets: it is a MOSFET on a heatsink plus one resistor, and one zener diode. No joke. I did also build a temperature controller for the fan, but it's not really necessary. Currently the protection device is a simple 6 A circuit breaker.

author: trilerian
author_rank: Regular Contributor
timestamp: November 01, 2023, 07:30:27 pm
content: I haven't updated the schematic lately. The Battery Negative has a ground reference on the circuit using another wire that also is used for voltage sensing.Also attaching a pic of the pcb design before I lost the file.Hadn't done much routing.

author: trilerian
author_rank: Regular Contributor
timestamp: January 12, 2024, 12:29:18 am
content: Just an update on this. I haven't been documenting my progress that well, but I have done a couple of videos of the unit.Here is my latest taken a hour ago.

author: trilerian
author_rank: Regular Contributor
timestamp: February 12, 2024, 08:58:52 pm
content: Back to this thread again, lol. First, just let me say. I have had so much fun with this project. I have a fully functional discharger that can discharge a 2s lipo up to 45A. It will give the the full voltage, individual cell voltages, DC amps, and temperature of the heat sink. Using the external load to discharge via pwm and some regular hexfets. It has a tft touch screen display, multi pages to go through. A separate internal resistance function can be run using the DC load. Graph of the primary discharge function on a separate page. There really is a lot to it, and like I said. It has been fun. However, I keep adding and adding to it and now I am out of space on the microcontroller. Oh poor 328PB. So, let's move on!!!First things first, let's ditch the hexfets and external load and use some proper linear fets! 2 of these bad boys just arrived from my favorite components store. IXTK90N25L2, these are 90A linear mosfets. They claim 500W, but a link someone gave me to read up on them said it was most likely around 250W. Well, guess I need 2, max watts for my application is going to be about 350W. I am hoping the heatsink I am currently using will suffice though. 70*120*28mm with 2 60*60*25 12V fans.Next, I am going to the esp32, and I will probably just use the dev boards, WROOM S3. I have a prototype going on both the WROOM and a Nano ESP32, but the WROOMs are cheaper... Bad thing about the ESP32 however is the ADC and it non linearity. So I am going to use an external ADC. Because I use the MCP3208/4 in another application, I figured I would just use the same ADC. The only problem is I am having issues with the libraries and using the 2nd spi interface so right now I am just bit banging GPIO pins. This may be fine as it should be faster than the ADS1115 even bit banging. If you know of another ADC with at least 12 bits and how to get it working on the second SPI interface for an ESP32, I'm all ears...What else??? Ok, adding a precision voltage ref, LM4132A for 3.0V and some op amps to build a difference amplifier for the voltage measurements. There was a slight voltage discrepancy under load that may be due to the gnd in my 4 wire measurement not being isolated from the circuit ground. I'm going to switch my current sensor to ACS37010LLZATR-050B3 new part from Allegro. It combines the separate input and output pins into a big pin for each, and they are about half the price of the ACS773.So now, how to go figure some of this other stuff out, lol.