constant voltage source & sink for charging & discharging batteries

I'm attempting to build a simple circuit that will apply a constant voltage to a Lithium-Ion battery. If the applied voltage is greater than the battery, it should source current at a constant voltage, if the applied voltage is less than the battery, it should sink current at a constant voltage.

The circuit I've tried so far is attached in the image(s) below. I like this circuit because it allows me to control the voltage applied just by dialing a pot. It works well for sourcing current (image 1), however, as soon as the applied voltage drops below that of the battery, it flattens out (image 2). That is to say, the circuit cannot sink current at constant voltage.

I would like to build a circuit that can do both, as indicated by the cartoon graph in image 3. I would like to get behavior indicated by the dashed curve.

Does anyone have any suggestions for this?

Thanks!

• Don't do this. Li-ion batteries should be charged at constant current first. – Finbarr Feb 17 '18 at 18:17
• You're absolutely right. Applying voltages that are substantially different from the cell voltage would cause a huge spike in current. The goal is actually to first charge (or discharge) a battery at a constant current until a particular voltage limit is reached, and then hold at that voltage. I have accomplished the constant current part with two other circuits that I haven't included in this post. Once the battery has hit the voltage limit, the goal is to hold that voltage until the current decays to a particular value. That is the goal of the circuit I am trying to build here. – jkrbasu Feb 17 '18 at 18:40
• @ Finbarr constant'current is not important. so long as the current is low-engough. the 10 ohm resistor makes that happen. – Jasen Feb 17 '18 at 18:57

Add a PNP transistor emitter to node 5, base to node 2 and collector to ground.