Hey guys, I am currently using the tp4056 module to charge my li-ion battery. I now want to find out how the voltage increases with time, and graph it as well.
Any idea how I can measure the voltage(anywhere between 1.9-4.3V) and graph it with time using just an Arduino?
If not, how else would I go about it?
And the same for measuring the change in charging current with time as well...
Measuring the voltage in the range (1.9-4.3V) that you specify is not at all difficult. That can be measured directly with an analog input using analogRead(). Be aware that when using the default analog reference, the supply voltage is the analog reference and so the supply voltage needs to be measured and entered into the formula to convert an analog to digital converter reading to, accurate, voltage. See this page and this page.
The Arduino serial monitor has a very basic graphing function. I have used the (free) Processing language to plot data sent from an Arduino via a serial port.
Just make sure You use a 5 volt Arduino if You want to connect and read that voltage. For a 3.3 volt controller a voltage divider is needed.
Railroader has a very good point that I had not considered. Good catch.
I would always use a voltage divider, to the nearest INTERNAL Aref the board has.
That makes measurements independent of the Arduino power supply,
and the 'top' resistor of the divider can also be used for pin protection.
You don't want to connect a battery directly to a pin, ever.
Leo..