├── THUMBNAIL_YOUTUBE.png ├── README.md └── ArduinoCode /THUMBNAIL_YOUTUBE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CarbonAeronautics/Part-IX-BatteryManagement/HEAD/THUMBNAIL_YOUTUBE.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Part IX: Use a high side power switch for effective battery management 2 | 3 | In this project, you will explore how you can use the Infineon BTS50055-1TMB or BTS50080-1TMB PROFET high-side power switch to take the battery management of your quadcopter drone to the next level. The Youtube video below explains the necessary electronic circuits and the necessary code. 4 | 5 | [![alt text](https://github.com/CarbonAeronautics/BatteryManagement/blob/a7a5a9358651d5d27a2a2ca4220d9f61178a8e92/THUMBNAIL_YOUTUBE.png?raw=true)](https://www.youtube.com/watch?v=bbg6NELeI9o) 6 | -------------------------------------------------------------------------------- /ArduinoCode: -------------------------------------------------------------------------------- 1 | /* 2 | The contents of this code and instructions are the intellectual property of Carbon Aeronautics. 3 | The text and figures in this code and instructions are licensed under a Creative Commons Attribution - Noncommercial - ShareAlike 4.0 International Public Licence. 4 | This license lets you remix, adapt, and build upon your work non-commercially, as long as you credit Carbon Aeronautics 5 | (but not in any way that suggests that we endorse you or your use of the work) and license your new creations under the identical terms. 6 | This code and instruction is provided "As Is” without any further warranty. Neither Carbon Aeronautics or the author has any liability to any person or entity 7 | with respect to any loss or damage caused or declared to be caused directly or indirectly by the instructions contained in this code or by 8 | the software and hardware described in it. As Carbon Aeronautics has no control over the use, setup, assembly, modification or misuse of the hardware, 9 | software and information described in this manual, no liability shall be assumed nor accepted for any resulting damage or injury. 10 | By the act of copying, use, setup or assembly, the user accepts all resulting liability. 11 | 12 | 1.0 5 October 2022 - initial release 13 | */ 14 | 15 | float Voltage, Current, BatteryRemaining, BatteryAtStart; 16 | float CurrentConsumed=0; 17 | float BatteryDefault=1300; 18 | void battery_voltage(void) { 19 | Voltage=(float)analogRead(15)/62; 20 | Current=(float)analogRead(21)*0.089; 21 | } 22 | void setup() { 23 | digitalWrite(5, HIGH); 24 | battery_voltage(); 25 | if (Voltage > 8.3) { digitalWrite(5, LOW); 26 | BatteryAtStart=BatteryDefault; } 27 | else if (Voltage < 7.5) { 28 | BatteryAtStart=30/100*BatteryDefault ;} 29 | else { digitalWrite(5, LOW); 30 | BatteryAtStart=(82*Voltage-580)/100* BatteryDefault; } 31 | } 32 | void loop() { 33 | battery_voltage(); 34 | CurrentConsumed=Current*1000*0.004/3600+ CurrentConsumed; 35 | BatteryRemaining=(BatteryAtStart- CurrentConsumed)/BatteryDefault*100; 36 | if (BatteryRemaining<=30) digitalWrite(5, HIGH); 37 | else digitalWrite(5, LOW); 38 | } 39 | --------------------------------------------------------------------------------