![]() Split the selected curve in three section and approximate the curve with some functions.Guess the average discharging current and calculate C.I have to get the characteristic of the battery.I think for more accurate calculation the following steps are required: Regarding point b) : This is a major obstacle and the note is absolutely correct. So row#2 to be modified to: const unsigned long BatVref = 2465 //mV ![]() This is giving on MEGA AREF's pin with DMM 2.465 V, instead of 2.560 V. Value = analogRead(0) //The effect of analogReference() call doesn't take place till the next call to analogRead() I modified for reference measurement this code as well: int value Battery Meter is a simple gadget that provides users with a visual display for monitoring the battery status of their laptop. Serial.print("Battery level : ") Serial.println(percentage) // with regression func. Serial.print("Batery voltage: : ") Serial.println(batVoltage) īyte percentage = 100 * (batVoltage - BatVoltMin) / (BatVoltMax - BatVoltMin) //to be replaced Unsigned int batVoltage = adcValue * BatRatio / BatResolution Battery Meter is a free utility that can be downloaded to your Android phone to help you to monitor your phones battery level and charging status in a. ![]() Unsigned int adcValue = analogRead(BatVoltPin) // read the divided battery voltage on analog pin # 0ĪnalogReference(DEFAULT) // set back the reference voltage level to normal 5Vįor (int i=0 i<8 i++) analogRead(BatVoltPin) // so later in the main/full program no trouble Free A free app for Android, by AMOL POPHALE. after initiating 'analogReference(INTERNAL2V56) ' and change here.Ĭonst unsigned long BatResolution = 1024 Ĭonst unsigned long BatRatio = ((BatRs + BatRs) * BatVref) / BatRs ĪnalogReference(INTERNAL2V56) // set the reference voltage level from 5V to 2.56Vįor (int i=0 i<8 i++) analogRead(BatVoltPin) // just burn some ADC readings after reference change void loop() // as long as they have the same unitĬonst unsigned long BatVref = 2560 //mV this must be measured on the AREF pin accurately with DMM Goal: measure the battery charged state in % as accurate as possible.įor this purpose I'm planning a voltage divider and use the internal reference voltage for accurate measuring. 12.8 V charging voltage and 10.7 V cut-off, connected to MEGA Vin pin. So I have a 4 cell LiFePO4 battery with max. I was searching for hours for proper solution and finally decided to make my version and post here.īefore blowing up my board, I would highly appreciate, if somebody can spend some time and check the goodness of the below code and schematic:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |