With the growing emphasis on adaptable and efficient energy storage systems, there is an increasing need for battery chargers capable of delivering variable DC output while ensuring battery safety. Although recent work has explored power converter designs, such as resonant LLC and SEPIC topologies for conversion and protection, most implementations rely on either hardwired analog circuits or complex, highoverhead microcontroller setups. In this work, we present a variable output battery charger that uses a simple microcontroller to safely manage both the charging and discharging processes. The charger automatically stops charging when the battery reaches 90% of its rated voltage and stops discharging when the voltage drops to 20%, thus helping to prevent degradation and extend battery life. These features were difficult to integrate solely through analog circuit logic. The system is built around a buck converter for output voltage regulation, while the microcontroller enables real-time monitoring and seamless adaptation to various batteries. This design maintains hardware simplicity, eliminates the need for advanced software control, and offers a lowcost, flexible, and reliable solution for modern battery-powered applications.