Battery Voltage Measurement with OP Amp

Vague circuit descriptions pitched as "vague" don't bother me but vague pitched as "complete "do.
So you don't believe the 15 mV "jump" is the result of the battery current reducing to zero when the voltage drop across the two series batteries equals the op amp output and the difference of potential reduces to zero ? Or that one of the two batteries
is charged and stops conducting current causing the other to float ?

BTW,
I'm Googling "arduino based current controlled battery charger " and so far haven't found anything like you described but I'll keep looking.

I did find this though.

and,
this

and ,
this (but I can't find the datasheet for the LM2961. I think it may be a variant of the LM317 regulator)

I did find a TI chip LM2951 :
LM2951

and ,
this

There's several designs using the LM317

battery-charger-circuit-using-lm317

LM7805 Battery Charger

YALM317 Charger (Yet Another LM317 charger)

TOO many LM317 Battery Chargers

Universal LM317 Battery Charger

I have some mosfets and LT1215 op amps and some small caps and other components. I could try to combine your LOAD box integrator with the OP's cartoon . I don't have any current shunts at home but there's an electronic surplus store in Sunnyvale, called Halted Specialties that has lots of stuff. (I'm in Los Gatos, CA,USA)

FYI, since you're relatively new here , I should mention that there is a forum protocol that dictates that the "post" (the question) takes the highest priority (for the benefit or other forum members) and that if the OP abandons his post, it can be adopted by the members who were responding at the time of the abandonment . It can even be adopted by other members who stumble across it after the OP has left. The Global Moderator will wait some reasonable amount of time for the OP to return and if he doesn't the post will be left to whoever picks it up as long as they stay on topic and direct their replys to the subject of the original post. In such cases, a post can take on a life of it's own because there is no longer an OP to decide how the question or issue is to be resolved. Sometimes an OP will lay down some restrictions saying " I don't want to use this kind of IC or I don't want to use that kind of component. If the OP leaves, then basically any approach that accomplishes the goal of the original post is acceptable. If , however, the post strays off topic or ceases to address the issue originally presented, the Global Moderator will just lock it and that's the end of it.

That being said, any current controlled design that charges a battery (presumably NiMh) using an arduino and doesn't have the 15 mV oscillation when the battery is fully charged, would meet the design criteria specified. Since the OP's design is incomplete, the missing part would have to be "filled in" .(all the part numbers, values (like the shunt resistance value) , specs, (such as the Setpoint) , voltages etc, including components not shown (like the integrating error amp)) and last but not least the code.

Since it doesn't look like anyone else is going to do it I completed the design, made a schematic , wrote the code, tested it, collected the data and took a screenshot of the scope monitoring the mosfet gate drive signal.

Now the post is complete and can be reproduced and replicated by anyone because it contains a "real" schematic (with component values) , data, code, and scope screenshot.
The circuit does , however , assume the op amp Subtractor exists to monitor voltage of the charging battery and control dac output accordingly. Attached code does not include that because I did not have the battery voltage monitor circuit at the time. I will update the software when I add that.


NOTE: There is an anomoly/"bug" with the current measurement code. I am attempting to "debug" this issue. Feel free to comment out that code in the mean time. The "bug" is that only the FIRST current measurement value printed is correct. All subsequent values are way off. I don't know what the cause is yet. S/W is not really my area of expertise so I may have done something stupid.

ALSO, I am currently adding the relay to the schematic. The code has already been updated to include the relay so the schematic is "lagging" the code at the moment. Sorry about that.

Constant_Current_Battery_Charger_Final_21.ino (1.88 KB)