by Robert Gawron @ robertgawron.blogspot.com:
Li-ion cells become more and more popular due to their capacity and reasonable prices. In this entry I will present how to build a simple li-ion battery charger based on MCP73831 chip. It’s a quite useful device for DYI projects,in addition its cost is only around 1,5 euro.
The device uses USB port as a power supply (mini-USB connector). I use the standard gold-pins as an output socket. There’re three of them, but only two are used (looking on the image, counting from top: V+, V-). I will design my li-ion based devices in the same way (same socket, but female), then if I will connect it in the incorrect direction (rotated 180 degrees) they won’t be damaged (V- connected to V-, but V+ connected to n/c pin) – simple way to avoid plugging in an incorrect way.
How to make a USB Li-Ion charger – [Link]