3S Battery Charger with auto shutoff

3S Battery Charger with auto shutoff

Note: the following article contains printed circuit boards (PCB) of my own design. I am not an electronics engineer. If you make this, it is your responsibility, I am not liable for anything you do, or any derivations of it. Don't be dumb. 100W of power is a lot. It is 1/8 of a toaster, and some soldering irons run off of less. You wouldn't lick a live incadescent lightbulb, treat this the same way.

\r\n\r\n

As mentioned in the previous article on Sox, I ran into an issue trying to find a power delivery system that would charge a 3S (3 batteries in Series) battery bank. After searching for a long while, I ended up using a Constant Current/Constant Voltage (CC/CV) buck regulator to step my 20V input down to the 12.6V the batteries need, while also choking the input current to 3A. The only issue that remained was trying to get the CC/CV regulator to shut down after the batteries were full. As mentioned earlier, there was nothing available at the time to buy, so I had to make my own.

\r\n\r\n

The image at the top shows the final outcome of that process. What it is is an Arduino nano being powered by a voltage regulator, executing a basic script to read the voltage current sensor on the output of the CC/CV regulator. The script switches on and off a mosfet on the ground wire, cutting power downstream to the CC/CV regulator. Code and images below

\r\n\r\n

All can be downloaded from GitHub

\r\n\r\n

\"\"

\r\n\r\n

Front of PCB

\r\n\r\n

\"\"

\r\n\r\n

Back of PCB

\r\n\r\n

\"\"

\r\n\r\n

PCB Schematic

\r\n\r\n
\r\n\r\n#include \r\n\r\nAdafruit_INA260 ina260 = Adafruit_INA260();\r\n\r\nbool debug = false;\r\nfloat maxVoltageThreshold = 12520;\r\nfloat minCurrentThreshold = 50;\r\nint maxIntervalCheck = 300; //in seconds\r\nint numIntervals=maxIntervalCheck+1;\r\n\r\n enum : byte {CHARGING,CHARGED};\r\nauto state = CHARGED;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n  pinMode(A2, OUTPUT);\r\n\r\n  // Wait until serial port is opened max 500 ms\r\n  int startupDelay = 0;\r\n  int startupDelayMax = 500;\r\n  while (!Serial || startupDelay < startupDelayMax) { \r\n    delay(10); \r\n    startupDelay += 10;\r\n  }\r\n\r\n  \r\n  \r\n  Serial.println("Adafruit INA260 Test");\r\n\r\n  if (!ina260.begin()) {\r\n    Serial.println("Couldn't find INA260 chip");\r\n    while (1);\r\n  }\r\n  Serial.println("Found INA260 chip");\r\n}\r\n\r\nvoid loop() {\r\n  if(state==CHARGING){\r\n    \r\n    if( ina260.readBusVoltage() >= maxVoltageThreshold && ina260.readCurrent() < minCurrentThreshold){\r\n      digitalWrite(A2, LOW);\r\n      digitalWrite(LED_BUILTIN, LOW); \r\n      Serial.println("off");\r\n      state = CHARGED;\r\n    }\r\n\r\n  }\r\n\r\n  if(state == CHARGED){\r\n\r\n    if(numIntervals>= maxIntervalCheck){\r\n      numIntervals = 0;\r\n      digitalWrite(A2, HIGH);\r\n      delay(2000);\r\n      Serial.println("timeout test on");\r\n      if( ina260.readBusVoltage() >= maxVoltageThreshold*0.95 && ina260.readCurrent() < minCurrentThreshold){\r\n        digitalWrite(A2, LOW);\r\n        digitalWrite(LED_BUILTIN, LOW); \r\n        Serial.println("timeout test off");\r\n      }\r\n      else{\r\n        Serial.println("timeout test on");\r\n        state = CHARGING;\r\n      }\r\n      \r\n    }\r\n  }\r\n\r\n  if(debug){\r\n    Serial.print("Current: ");\r\n    Serial.print(ina260.readCurrent());\r\n    Serial.println(" mA");\r\n\r\n    Serial.print("Bus Voltage: ");\r\n    Serial.print(ina260.readBusVoltage());\r\n    Serial.println(" mV");\r\n\r\n    Serial.print("Power: ");\r\n    Serial.print(ina260.readPower());\r\n    Serial.println(" mW");\r\n\r\n    Serial.println();\r\n  }\r\n  delay(1000);\r\n  numIntervals++;\r\n}\r\n
\r\n

Comments

Log in to add a comment.