Car Battery Power Monitoring and Prediction System Using Microcontroller Based Linear Regression Method

− The accumulator is a device to storage for electrical energy in four-wheeled vehicles, requiring frequent maintenance and supervision therefore the battery can be used for a long time. Most of the drivers rarely check the age of the accumulator, this could lead the vehicle to fail to start the engine and this is usually caused by running out of power. This study aims to minimize the problems that are often faced by motorists, namely, running out of power suddenly which causes the car to be unable to run. In this study, predictions of battery power were carried out using the Arduino Uno microcontroller, the acs712 sensor as a battery voltage detector, and the python language to process data with linear regression methods. The system is evaluated based on the functionality and performance of the system. From the test result, it was found that the system functionality runs 100% according to its function. And the results of the prediction of power with the linear regression method can be done because linear regression gives an R2 of 0.88.


INTRODUCTION
The car battery power is the main energy source in-car electrical devices that need attention for smooth activities because they have a service life. A car needs a battery or battery to store electrical energy in the form of chemical energy, which will be used to supply electrical energy to the starter system, ignition system, lights, and other electrical components. The car battery power has interrelated components in the supply of energy because they not only provide energy for electrical components but also have a very important role in the delivery of the electrical grid energy system. An average running battery will have a voltage between 12.5 volts to 14 volts [1]. The car battery power in good condition has a voltage of not less than 12 volts, while the car battery power that has a voltage of fewer than 12 volts can be said that the car battery power is in a weak state. Measuring the battery voltage is done in two ways, namely when the engine is off and the engine is running. The measurement when the engine is off is to determine whether the car battery power is weak and needs to be replaced or not, while the measurement when the engine is running is to determine the ability of the charging system to work normally or no [2]t. The magnitude of the car's accumulator voltage is the main key so that the car's electrical performance runs normally. Under normal conditions with the engine off the car accumulator has a voltage between 12 to 12.5 volts and when the engine is running the car accumulator is charging with a volt between 13 and 14 volts [3]. If the voltage is less than the normal number, it can be ascertained that the car's accumulator has weakened and is not maximally supplying electricity to the car's electrical devices. Car accumulators have a vital role in supplying electricity to devices that need it and require maintenance that is often overlooked by car owners [4]. In a car, two components can be related to the battery, namely the alternator and regulator, where the alternator serves as a supplier of electricity to the vehicle to run all the instruments in the car that must be driven by electric power. The accumulator can be filled optimally if the engine speed and alternator can function properly [5]. If the car is used within a short distance of turning on a load of all electronic instruments, then charging the accumulator has not yet been filled, which is not optimal so that it can cause a decrease in the accumulator voltage. In this new era, there are many changes in car components, car components that originally used a mechanical system to become an automatic system with an electric motor so that it requires a power supply from an accumulator [6]. At this time In this study, the author developed a prototype car battery monitoring system remotely. With this system as monitoring and prediction of car battery power [7]. On the other hand, technological developments make it easier for someone to monitor all aspects that should be done manually but can now be done automatically, this is supported by components such as the Arduino Uno microcontroller [8]. Arduino can be regarded as open-source physical computing, which has a combination of sophisticated hardware, programming languages, and an Integrated Development Environment (IDE). IDE is software that plays a very important role in writing programs, compiling them into binary code, and uploading them to microcontroller memory [9]. The hall effect technology applied by the allergo company replaces the shunt resistor and converts the current into a sensor capable of measuring current. The term hall effect became known after the discovery of who discovered that if an electric current flows through a conductor placed in latitude, a strong magnetic field will produce a potential difference across the conductor at both corners of the conductor [10]. Hall effect sensor is a transducer that can convert a magnetic field into an electric quantity in the form of voltage. This type of sensor operates to detect the proximity, presence, or magnitude of the existing electric power voltage which will then be processed using available methods [11]. Based on the study's findings, there is an algorithm that can produce accurate values, namely the linear regression algorithm [12]. Linear regression algorithm itself is a type of in addition to linear regression data mining use classification and regression rules, which is support vector mechines logistic regression, and other techniques are featured in this category. Linear regression analysis is a data mining approach for determining the relationship between two variables. The connection between the variables you want to make a prediction with additional variables [13]. The results of the study concluded that 85% of car owners rarely check the car battery power because it is not easily known, so it is necessary to have a tool that can be used keep an eye on the car's battery power [14]. Based on the above background, the authors designed a tool to help monitor and predict the condition of the battery by developing a monitoring system and prediction of car accumulator power using a microcontroller-based linear regression method as a solution to make it easier for car owners to monitor the accumulator.

Methodology
Research methods, the stages of research, can be interpreted as a sequence of processes from beginning to end. The first process was to record the battery's voltage power and get a volt data value on the battery that became a dataset. The dataset is divided into two groups in the second process, i.e., data train and data test. In this testing process, the system will be tested using data train by applying linear regression algorithms to get the best predictive model for making predictions of the age of battery per month. After getting a model, the testing process will use the data test by applying the linear regression that has been obtained from the data train process. After doing this test, the results of the car battery's power predictions can last how long. Flowchart research method in Figure 1.

Related Studies
In the study, there is a study related to the battery's predictive detection in the vehicle. This study is from Asep Trisna Setiawan entitled "Sistem Monitoring AKI Mobil berbasis Arduino Untuk Mendeteksi Tegangan AKI" [15]. The study considers using the Arduino Uno microcontroller to design a monitoring system of the vehicle battery. The monitoring system is regulated by the program, which has been implanted in the microcontroller [16]. First of all, the system would read the battery's voltage with the battery voltage sensor; then, it cultivated into data that would have resulted in whether the voltage was standard or not [11]. If the voltage is not normal, then there will be a notification. Similarly, when a car's battery power is normal [17]. For further research, the writers used Arduino Uno and the ACS 712 current sensors. The sensors detect the voltage currents of a car battery that will then be treated for data and stored for a dataset. The following process will be processed using the python programming language. Wherein this research, the method used was linear regression. That method predicts how long the battery can be used.

Arduino Uno Microcontroller
Arduino Uno is a board of microcontrollers based on Atmega 328. Arduino Uno supports 14 input pins from a digital output, six input pins used as output PWM, six analog inputs, 16 MHz oscillator crystal, USB connection, jack power supply, ICSP header, and microcontroller there is a reset button to do it. Used to generate an Arduino Uno board by connecting it to a USB cable or connecting an electrical system to a DC adapter or battery. Every 14 digital pins on Arduino Uno can be used as input and output, using pinMode functions (), digitalwrite(), and digitalRead (). They operate at 5-volt voltage; each pin can provide or receive a maximum 40 m current and have a pull-up resistor (dislocated by default) 20-50 ohms. Arduino uno is show in figure 2.

ACS712 Current Sensor
The ACS 712 current sensor's functions are to help detect changes in the physical or chemical environment. At the same time, the magnitude of the electricity altered from the variable output of the current sensors can be referred to as Transducers. Whereas a principle works with the current sensors based on resistance pressure, it can produce input power less than five times that of the original power. Figure 3 is a sensor ACS 712.

Accumulator
Accumulators are the kind of batteries that use lead-acid as chemicals. Accumulator has an important role in vehicles, primarily cars. The accumulator's role is one of the sources of electricity in a car, and it delivers electricity to power all car parts that manage to run using electricity. Without the accumulator, it cannot start. Many people often travel using cars, but they rarely care about the age of accumulators.

Linear Regression
Linear regression is one of the statistics-based analyses where data modeling explicitly relates certain variables to explicit linear equations. Then, a linear equation that introduces a single change into one of the linear equations determines a single change of one of the equations. There are two models in the regression method: nonlinear regression and linear regression. A linear regression model with one free variable and a model with >1 free variable (double linear regression). Nonlinear regression has an exponential (in) and an order (log) model. The simple linear regression method data will be used as a document to form the regression equations, for example, NS. y = a + bx, where y = bound variable, a = constant, b = coefficient x, and x = free variable. The constants in a and b are deduced from the equation. Mathematically, linear regression can be determined by the following equation (1), (2) and (3).

Flowchart Diagram
In Figure 4. It shows a flowchart representing the car battery prediction system that starts to measure the car battery to get data. The data will go into the Arduino, and then the data from the Arduino is processed into a dataset. Then the data is processed in python using linear regression to get the prediction of battery life.

Tools Representation
The representation of the device built involves some hardware components with the diagram, as shown in Figure  5.

Figure 5. Tools Representation
The device's representation consists of a battery, an ACS 712 current sensor, a microcontroller Arduino Uno, and a python as a data manager using linear regression methods.

Dataset
Datasets were obtained from battery power conversion using an extraction from the accumulator towards the ACS 712 sensor. The ACS 712 sensor's primary function is to detect the change in energy from chemicals to the variables emitted by the sensors, from the variables released by the sensors, the data of the significant car battery power that will use as a dataset for the writer's research.  Table 1 is the result of the dataset representation obtained during car battery power retrieval the result is converted into the table and given data labeling. In the process, data labeling includes the car battery's power while in the off state and the use of the batteries within months.

Split Data
In this process, the previously acquired data will be divided into training and testing, consisting of 75% for training data and 25% for testing data.

RESULTS AND DISCUSSION
The writer is doing the test using a python and platform that Google Colaboratory for supported data predict and to conduct tests on the devices built, namely microcontrollers, current sensor. The discussion is divided into discussion about system functional results, and system performance testing results. To support the study, the writer used a laptop with Intel processor (r) Core(TM) iz-7500u specs, RAM 8GB, hard-drive 128GB (SSD) + 1TB, and Windows 10 as an operating system. And this section will explain the results of the implementation of the system, its functionality, and the analysis that has been carried out, then a discussion

Arduino Uno
Arduino Uno which functions as a microcontroller will act as the main controller of running devices. In Figure 6, 7, a test was carried out on the Arduino Uno, as evidenced by the red light turning on as evidence that the Arduino was successfully connected to the laptop/pc via a USB cable. For further testing, the code that was written was successfully uploaded and compiled on the Arduino IDE software.

ACS 712 current sensor
The ACS 712 sensor is used to read the battery power tested on the car battery. The results of the detection of battery power readings by the ACS 712 sensor will later become a dataset that is carried out in the next stage. The test was carried out with 2 (two) variations, namely variations in different conditions for the battery. The first variation is carried out using a jumper that is connected to the ACS 712 sensor to the battery when the vehicle is on. As well as the second variation of the test when the condition of the car does not turn on. As shown in Figure  8.

System Performance Testing Result
Testing is done by experimenting. In the first stage, the writer conducted a trial by reading the car battery power three times to produce accurate data. After going through the battery power reading system, the next stage is the dataset processing of the battery's power readings. The data serves for processing using linear regression methods to get predictions of car battery power life.

The Result of Battery Power Reading by Arduino
The writer does the car battery power reading using Arduino, and ACS 712. He noticed that the car's battery data had a volatility unit and distinguished it by monthly usage. The data obtained is used as a dataset for the data plotting process. In the next stage, the writer visualizes the data plotted by the power of a car battery while the engine is in the off state by monthly usage. In figure 9, the writer shows the plotter results of data produced from the dataset processing. The dataset consists of a car battery power when in the off state and the age of a car battery in months.

The Prediction of Accumulator Power by Linear Regression Method
The car battery power predictions with the linear regression method here result from the processing of datasets, which are treated using linear regression methods to look for a predictive value of what car batteries can last a month. The writer gets the prediction from data calculations of the car's battery power when the engine is off state and the interval of consumption within months. Below is the power car battery prediction by the linear regression method obtained. The dataset used to test the model can be seen below.   Figure 9, the charts show a processed dataset using linear regression methods. The charts also show data from car battery power and the usage of car batteries within months.

CONCLUSION
The analysis and implementation of the vehicle battery monitoring and prediction system using a linear regression method based on a microcontroller have been successfully carried out. The author proves this research by processing the dataset obtained from the detection system, with the device built consisting of Arduino Uno as a microcontroller and ACS 712 current sensor as a car battery power detector. The author tested the functionality of the Arduino, namely the red light was on as an indicator of the success of the Arduino being connected to the laptop/PC via USB, as well as the condition of the battery test on the ACS 712 sensor when the battery condition was on, and not lit, then did three times. System functionality can run 100% according to its function in this research test to make predictions of linear regression models to predict car battery life on voltage for months. The results of linear regression assessment can be carried out because linear regression gives R2 with 0.88, indicating that the linear regression method can predict battery power based on the number of months in the vehicle.