Introduction: Arduino Battery Tester With WEB User Interface.
Today, electronic equipment uses backup batteries to save the state in which the operation was left when the equipment was turned off or when, by accident, the equipment was turned off. The user, when turning on, returns to the point where he stayed and thus wastes neither time nor the order of execution of his tasks.
Step 1: Introduction
I am doing a project to measure the state of batteries with different capacities and voltages using the method: Two-tier DC load. This method consists of drawing a small current from the battery for 10 seconds and a high current for 3 seconds (IEC 61951-1: 2005 standards). From this measurement the internal resistance is calculated and hence its state.
The workstation will consist of several connectors, one for each type of battery, and a PC. For this, a user interface (UI) is necessary. The most important part of this tutorial is the UI because in other instructables have been described these methods of battery testing. I tried Processing and got good results but decided to make my own software using a local web server and take advantage of the potential of HTML, CSS and php.
It is known that it is very difficult to send information from Arduino to a windows PC but in the end, I succeeded. All programs are included in this tutorial.
Step 2: What We Are Going to Measure and How
Every real battery has an internal resistance. We always assume that it is an ideal voltage source, that is to say, we can get a lot of current keeping the nominal voltage constant. However, battery size, chemical properties, age, and temperature all affect the amount of current a battery is able to source. As a result, we can create a better model of a battery with an ideal voltage source and a resistor in series, as shown in Fig. 1.
A battery with low internal resistance is able to supply more current and keeps cold, however, a battery with high resistance causes the battery to heat up and the voltage to drop under load, triggering an early shutdown.
The internal resistance can be calculated from the current-voltage relationship given by two points in a discharge curve.
The two-tier DC load method offers an alternative method by applying two sequential discharge loads of different currents and time durations. The battery first discharges at a low current (0.2C) for 10 seconds, followed by a higher current (2C) for 3 seconds (see Figure 2); the Ohm’s law calculates the resistance values. Evaluating the voltage signature under the two load conditions offers additional information about the battery, but the values are strictly resistive and do not reveal the state of charge (SoC) or capacity estimations. The load test is the preferred method for batteries that power DC loads.
As previously stated, there are many methods of measuring batteries treated in other instructables and that can be implemented with the Arduino, but in this case, although it does not offer a complete assessment of the state of the battery, it gives values that can be used to estimate their future behavior.
The internal resistance is found by using the relation
Ri = (V1 - V2) / (I2 - I1)
𝑉1-Voltage is measured during low current and longer instant of time;
𝑉2-Voltage measured during the high current and shorter instant of time;
𝐼1 - Current during longer instant of time;
𝐼2 - Current during the shorter instant of time.
Step 3: Circuit
The circuit is a current source that draws 0.2C (in this case 4mA) and 2C (in this case 40mA) from batteries using only one circuit controlled with the PWM signal from Arduino. This way it is possible to measure all backup batteries with C = 20mAh, regardless their voltage in the range from 1.2V to 4.8V and other batteries with a different capacity too. In the first version, I used two transistors each with a load to drain 4mA and the other 40mA. That variant was not appropriate for the future since they wanted to measure other batteries with different capacities and this scheme required a large number of resistors and transistors.
The circuit with a current source is shown in Fig. 3. The frequency of PWM signal from pin 5 of Arduino board is 940Hz, that’s why, the Fc of Low Pass Filter (LPF) is 8 Hz, it means that the first harmonic of PWM signal (940Hz) will be attenuated 20dB because the RC filters provide 10 dB of attenuation per decade (every 10 times the Fc – attenuation will be 10dB in 80Hz and 20dB in 800Hz). The IRFZ44n transistor is oversized because, in the future, larger capacity batteries will be tested. The LM58n, dual operational amplifier (OA), is the interface between the Arduino board and the IRFZ44n. The LPF was inserted between the 2 operational amplifiers to ensure a good decoupling between the microprocessor and the filter. In the Fig.3, pin A1 of Arduino is connected to the source of transistor IRFZ44n to check the current drawn from battery.
The circuit is composed of 2 parts, below the Arduino UNO board and above the current source, as shown in the next photo. As you can see, in this circuit there are neither switches nor buttons, they are in the UI in pc.
This circuit also allows measuring the battery capacity in mAh since it has a current source and the Arduino board has a timer.
Step 4: Programs
As mentioned above, the application has, in one side, a UI made with HTML, CSS, and, in the other side, the Arduino sketch. The interface is extremely simple, for the moment, because it only executes the measurement of internal resistance, in the future it will perform more functions.
The first page has a drop down list, from where the user selects the voltage of the battery to be measured (Fig. 4). First page HTML program, is called BatteryTesterInformation.html. All batteries have a 20mAh capacity.
Second page, BatteryTesterMeasurement.html.
On the second page, the battery is connected to the indicated connector and start (START button) the measurement. For the moment, this led is not included because it has only one connector but, in the future, they will have more connectors.
Once the START button is clicked, the communication with Arduino board begins. In this same page, the Measurement Results form is shown when Arduino board sends the results of battery test and START and CANCEL buttons are hidden. The BACK button is used to begin the test of another battery.
The function of the next program, PhpConnect.php, is to connect with Arduino board, transmits and receives data from Arduino boards and web server.
Note: Transmission from PC to Arduino is fast but transmission from Arduino to PC has a delay of 6 seconds. I am trying to resolve this annoying situation. Please, any help is greatly appreciated.
And the Arduino sketch, BatteryTester.ino.
When the resultant internal resistance is 2 times bigger than initial (new battery), the battery is bad. That is to say, if the battery under test has 10 Ohms or more and, by specification, this kind of battery should have 5Ohms, that battery is bad.
This UI was tested with FireFox and Google without problems. I installed xampp and wampp and it runs well in both.
Step 5: Conclusion
This type of development using a user interface on the PC has many advantages because it allows the user an easier understanding of the work they are doing as well as avoiding the use of expensive components that require mechanical interaction, which makes them susceptible to breaks.
The next step of this development is to add connectors and modify some parts of the circuit to test other batteries, and add a battery charger too. After that, the PCB will be designed and ordered.
The UI will have more modifications to include the battery charger page
Please, any idea, improvement or correction do not hesitate to comment to improve this work. On the other hand, if you have any questions, ask me, I will answer it as fast as I can.