I am trying to learn about electronics by making my own MCU controlled battery charger for standard AA 1.2V NiMH and NiCd batteries. The supply voltage is 5V from a USB battery pack.
I did a lot of reading on http://batteryuniversity.com/, as well as studying Energizer and Panasonic battery charging guides. I now have a very crude working prototype which controls the current input into the battery by stepping down my 5V down by burning some energy through a transistor and a diode. I have expermentaly found the amount of voltage step down required for 700mA into the battery, but this is highly variable depending on my power supply (which is highly annoying).
Now that I have the proof-of-concept working, I'd like to do the power circuit right. Controlling the voltage can obviously be achieved better with a switching voltage regulator, except that I am not really looking to hold the voltage constant. What I really need is constant current (let's say 700mA), and the voltage can vary as needed.
I have no idea how to build this kind of circuit. Are there "current regulators" that I can buy just like voltage regulators? Is this something I can build by measuring the voltage drop on a sense current resistor?
I am looking for suggestions on how to solve this problem cheaply, as well as any relevant reading material.