lithium battery voltage controller

Hello, I would like to make a project, where I can connect a lithium battery to an arduino board.
After that I would like to be able to charge the batter and discharge it after its charged, then again charge etc.
During that operations I have to control the voltage of the battery.
If voltage drops below some threshold I have to stop discharge operation and start charging it , and if the voltage growth above some threshold, I have to stop charging and start discharge procedure.

I want to know if its possible to do it using arduino and how? May be I should use additional electronic scheme connected with arduino? Please suggest me some solution.

There are charge control chips you can add that perform this function.
MCP73831 is an example.
Charging:

Monitoring: