Re: How to charge a 9 volt from a 5 volt supply
In order to charge a battery, the charging voltage must be at least as high as the desired battery voltage, and not too much higher. Usually, you would also need to limit the current flowing into the battery, during charging, so the battery wouldn't get too hot, so it wouldn't be damaged or explode.
You will need to know what voltage the battery should be charged from (it is always a little higher than the desired final battery voltage), and what the ideal charging current might be.
There are also dedicated battery-charging circuits, with features such as automatically stopping charging when the battery is fully charged, and contouring the voltage and current levels during charging.
In this case, you are wanting to charge a higher-voltage battery from a lower-voltage supply. To be able to do that, you would need a circuit to raise the supply voltage to at least as high as the desired battery voltage. (You will probably also need to have a resistor in between the charger and the battery, to limit the current to a level that is safe for the battery.)
For methods and circuits to raise the supply voltage, from 5 Volts to about 9 Volts, do a search for "boost converter" or "boost mode" smps.
It is usually done with a "switch-mode power supply" (smps) circuit.
Edit: OK, you can raise 5 Volts to 9 Volts very, very easily, using the MC34063A chip, if you don't need more than about 300 mA of current.
Here is a web-based tool that will give you the schematic and will calculate the component values, automatically:
**broken link removed**
You need to enter:
1) Vin = 5
2) Vout = a little higher than 9 Volts
3) Iout = the current you need, in mA
4) Vripple = the peak-to-peak output voltage ripple that you can tolerate
5) Fmin = the desired switching frequency (up to 100 kHz).
You can play with the values above and see how they affect the component values that result.
Using a higher frequency would allow using a smaller-value (and probably smaller size and cheaper) inductor.
Here is the Fairchild datasheet for the MC34063A:
https://www.fairchildsemi.com/ds/MC/MC33063A.pdf
And here is the Texas Instruments datasheet for the MC34063A:
https://www.ti.com/lit/ds/symlink/mc34063a.pdf