In the last swim watch entry, I was using a MAX1555 battery charger, but I wasn’t too keen on it because the charging current was fixed by the device. Therefore I obtained a MCP73832T-2DCI/OT IC as the charging current is “programmable” using a resistor. This will allow me to play with different batteries and charging currents to see what works best.
The IC is pretty simple to set up and is specially setup for charging Li-Ion and Li-Pol batteries which I hope to test.
It was a “stat” pin that signals when the battery is being charged. Using this, you can determine when the battery has finished charging.
In the last entry I also tried using a rechargeable coin 3V coin battery, but I was struggling to get enough power from it which caused the display to be pretty dim and a little bit flickery. I also did some tests with a 3.7v Li-ion battery from an old phone, which unsurprisingly worked well, but was huge for what I needed.
So I ordered a few small 3.7v, 300mAh Li-Po battery from here. As you can see below, the Li-Po battery – left – is much smaller than the phone battery. In fact, it’s almost completely hidden by the OLED display!
In my tests so far, this new battery works really well and appears to be charging properly. However, when I tested the battery, it seems to be about 4.1v when charged, rather than the stated 3.7v. Not sure if that will make a difference, but it seems to be working well so far.
Fuel Gauge Monitor
In order to monitor the current battery level during use and charging, I’m using the ds2782 fuel gauge IC, which can be communicated to via i2c (which works well for me as I’m also using i2c for the display and the eeprom).
The IC has many features for monitoring the battery – most of which I’ve yet to actually figure out – but the one I’m using at moment is the “Current Accumulation”. As far as I can understand, this measures the accumulation of current into the battery (via charging), and out of the battery (via use). This is showed in mAh (assuming I’ve understood and performed the calculations correctly) and if used correctly will show the current capacity left in the battery.
By knowing the max capacity of the device after charging, it should then be easy to calculate the current percentage left in the battery.
For now, I’m simply testing the IC and seeing if I can get it working the way I want. To do that I’ve updated the main menu to show the current battery percentage. You can see some different percentage values below (the percentage is in the bottom left corner).
The above photos were all done in one test with battery lasting about ?? hours
When the battery is being charged, a new screen appears showing the charging progress. By using the signal pin from the battery charging IC, the device knows when the battery is fully charged and will say so. Below you can see the display during charging.
Although the above implementation is far from perfect (I intend to fully re-write the code) I’m going to leave the battery gauge for now.
Next I’m going to work on using the PCF8563T/F4 real-time clock IC. This RTC has i2c communication for setting and obtaining the current time (which will be useful for storing multiple sessions), and a programmable clock output. Using this programmable output, I can get rid of the external crystal on the uC, set the uC to 8MHz (to lower power), and rely on the RTC for accurate lap timing.
Hopefully it won’t take as long to figure this one out as the fuel gauge IC!