Help trouble- shooting a constant current load/discharger

Hello everyone,
I am looking to build a battery tester circuit (for a single 18650 2000mAh li-ion cell) capable of subjecting the battery to successive charge - discharge cycles and collect data regarding battery capacity degradation until the battery reaches its EOL(End of life).

Here is a detailed description regarding the hardware setup.

Components

1)ESP32 Devkit V1: primary microcontroller board used to interface sensors, other components and upload measurement data onto thinkspeak.

2)INA219 (current sensor module): measure charging and discharge current.

3)MCP4725 (DAC): provide analog voltage level to opamp at non inverting input, to set the same voltage across load resistor.

4)Micro sd card module: store measurement data as backup.

5)NTC 10k Thermistor: measure battery temperature.

6)BMP280: measure ambient temperature.

7)TP4056 charging module: cheap clone, wires soldered to CE,CHG pin (and then to D32, D33 pins of ESP32) to have the CE pin of IC be low once battery voltage is 4.2v and charge current reaches 100mA, and during discharging.

8)LM358 opamp,IRL540N OR IRLZ44N logic level Mosfet, load resistor R1(1 ohm): form the constant current load part of the battery tester circuit, used to discharge the battery at a constant rate (1a or 2a or 4a, for 3 different boards respectively)
-gate of mosfet driven by output of op-amp.
-drain of mosfet connected to battery +.
-source connected to one end of resistor R1, same point connects to inverting input of op-amp.
power supply to op-amp would ideally be 5v.

Methodology:
start with discharge cycle, discharge till battery voltage reaches 2.75v.
-Then start with a charge cycle to charge the battery to 4.2v
-next, discharge the battery at a constant rate.
-repeat this until battery reaches end of life (70% of rated capacity).This whole process might take somewhere around 2 months for the battery to reach EOL.
-switch between charging and discharging mode either by
1)asserting EN pin of tp4056 ic "low" when voltage reaches 4.2v and charge current 100ma. Also keep it low during discharge cycle.
2)using a relay to control power input to charger.

Meanwhile, during the charge and discharge cycles collect the following data.

  • charge and discharge current.
  • battery voltage
  • battery temperature
  • ambient temperature
  • cycle count
  • capacity.

Now, I am having some trouble with the constant current load /discharger part of the battery tester circuit.

The voltage across the load resistor does not match the expected voltage as set by the DAC (in this case 1v). Instead I only see about 0.6 to 0.7v across the load resistor. This was while only supplying 5v to the power rails of the op-amp.
Increasing the op-amp supply voltage to about 6.38v yields about 0.98v to 1v across the load resistor(for a 1ohm resistor, yielding a discharge current of around 1A). That said, this voltage across the load resistor seems to vary a lot as the mosfet seems to get hotter (provided I had put in only a small heatsink).

I think this might be because the lm358 is not a rail to rail output type op-amp, and a possible solution might be to increase the op-amp supply voltage. But I wish to power the entire battery tester circuit using a 5v,3A power adapter and not use any other buck-boost convertors (mostly to reduce circuit area) to provide higher supply voltages to the op-amp.
So can anyone please help me troubleshoot this issue and get a stable DC voltage across the load resistor (as per the voltage given by DAC to the op-amp), resulting in a current constant current across the resistor. Also any suggestions on suitable replacements for the lm358 op-amp, irlz44n mosfet that might help solve the issue.

Here is the schematic-

Schematic_18650_testbench_2024-12-22.pdf (92.0 KB)

Post either a pdf or an image file exported from your CAD software. Screenshots are to blurry. Make sure the schematic includes all the correct part numbers

sure, will do that.
edit: just added in the schematic as a pdf file to the original post. Hope that helps

Well it's a combination of the 358 and the IRLZ44.
The gate threshold of the 44 can be as high as 2V. So if you have 1V across R1 then the 358 need to output more than 3V just to start to turn the MOSFET on. However, the 358 output could be as low as 3.4V

So you are are right on the edge of it working/not working.

A rail to rail amp and a MOSFET with a lower max Vgs(th) should solve the problem.

Thanks for confirming jim.
That said, are there any particular mosfet or op-amps you would recommend for this particular application that would work with 5v supply.
Also i did come across a few schematics that used a second op-amp in the feedback path, do you think that would be required? Or can i just get away with a resistor between the mosfet gate and op-amp output.

Not quite what you are looking for but might give you something to think about.

This is a constant current dummy load I built. The 2 IRL530 MOSFETs are mounted on an old PC processor cooling fan. I don't know the limit of this thing as I've never had a big enough power supply to get it seriously hot. It easily copes with 125W.

I suggest:

  • You don't need 2 load circuits, one will be enough for what you are doing.
  • The positive input to the op-amp is where you apply your control voltage.
  • You can monitor the output of the op-amp to get the current, the voltage should be directly proportional to the load current.
  • You don't need the ammeter.

Thank you for providing the reference Perry !
Also i did have a question regarding the usage of the tp4056 charging modules. While they are dirt cheap, they aren't that reliable. Do you have any recommendations for replacing it? It would also be really great if the replacement to the tp4056 can be controlled via a microcontroller to switch between charge and discharge cycles and automate the same

Off hand no, but now it's just a matter of searching through data sheets for the parts that meet your requirements and that you can actually buy.
If you want through hole parts only the choices will be very limited.

Also i did come across a few schematics that used a second op-amp in the feedback path, do you think that would be required?

It's another way to solve the problem. If you change R1 to 0.1 ohms, then less voltage will be required to control the MOSFET. Now the opamp in the feedback path should have a gain of 10 to make up for the smaller voltage across R1

Will try changing R1 (load resistor) to 0.1ohm 10w and see how it goes.
As for the lm358 replacement i could only find a few through hole equivalents that were rail-rail output type and also currently available. Do you reckon MCP6002 -I/P would work as a suitable replacement for lm358 for this use case, and work with 5v supply?

Yes MCP6001/2 would be good.
I've use it along with a MCP4921 DAC in a hobby project.

That opamp and the 0.1 ohm resistor with a gain amp in the feedback should work with the IRLZ44 but I would still look for a MOSFET with a lower Vgs(th).

I don't, but I imagine someone else will know.

Fine then, will try using the MCP6002 op-amp. Hope that solves the issue.
And thanks a lot for the suggestions jim !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.