Charging a battery using a DC power supply