
So in this circuit I decided to build a simple crude charger with LM317 ICs with CC and CV mode. As you might know there are ready made Chargers available for these batteries, but those that are cheap are very slow and those that are fast are very expensive. The battery charger circuit is designed for 7.4V lithium battery pack (two 18650 in Series) which I commonly use in most robotics project but the circuit can be easily modified to fit in lower or slightly higher battery Packs like to build 3.7 lithium battery charger or 12v lithium ion battery Charger. In this project we will build a Two Stage Battery charger (CC and CV) that could be used as to charge Lithium ion or lithium polymer batters. While these Batteries have a very good charge density they are chemically unstable under harsh conditions hence care should be taken while charging them and using them. The most common battery choice for portable electronics today is Lithium Ion or Lithium Polymer Batteries. Following Moore’s law the electronic devices tend to become smaller and more potable, these portable devices should have their own source of power to operate. One common thing among all these is that they are all powered by batteries. 36int distance 37 38int relays = // 1 if live, 0 if not.The advancement in Electric Vehicles, Drone and other mobile electronics like IoT Devices seems to be promising for the future. 27int volts_update_count = 5 // how often to update the voltage reading in seconds 28int volts_update_counter = 0 // track the count of seconds gone by 29int volts_update = ( 500 ) 30int read_distance_update = ( 500 ) // update the distance reader every millis 31int time_on_counter = 0 // counter for the display on/off 32int time_on_count = 100 //seconds to be on 33int heart_beat = 0 // flip this 0 to 1 to 0 to show the heart beat 34 35UltraSonicDistanceSensor distanceSensor ( 11, 12 ) // Initialize sensor that uses digital pins 13 and 12. 23float volts1 // what's the voltage of each battery 24float volts2 25float volts3 26int min_volts = 1 // what is the minimum voltage a batter voltage should be to be charged. 1#include 2#include // Using version 1.2.1 3#include 4#include 5 6auto timer = timer_create_default ( ) // create a timer with default settings 7 8 // The LCD constructor - address shown is 0x27 - may or may not be correct for yours 9 // Also based on YWRobot LCM1602 IIC V1 10LiquidCrystal_I2C lcd ( 0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE ) 11 12int zcnt = 0 13int acnt = 0 // general purpuse right now 14int chargeTime = ( 10 * 1000 ) // how much time to spend on each battery 15int charge_time_counter = 59 // how many chargetimes were passed? 16int charge_time_max = 60 // how many chargetimes were passed? 17int relay1 = 3 // each relay on it's own pin 18int relay2 = 4 19int rela圓 = 5 20int relay4 = 6 21int current_relay = 0 // which relay is the one on now? 22int max_relays = 3 // how may relays - 0 based.
