Show the method and device of battery of mobile terminal remaining capacity
Technical field
The present invention relates to the remaining capacities in communication terminal device field more particularly to a kind of pair of battery of mobile terminal to supervise
The method and system of survey.
Background technique
With the development of modern science and technology, the portable equipment such as mobile phone, PAD, notebook is seen everywhere.Portable production
The function that product provide is also more and more, accompanying problem is that the power consumption of battery is also increasing.Therefore, can at any time can
The power consumption of solution mobile terminal is a problem to be solved with user-friendly.
The remaining battery capacity calculation method of traditional mobile terminal device it is relatively common be to be estimated based on cell voltage
Calculate the remaining capacity of battery.This method samples the voltage for obtaining battery by ADC, then, further according to cell voltage-electricity
Mapping table is measured to predict the remaining capacity of battery.The defect of such methods is 1) not consider in the running of mobile terminal phase, due to fortune
The variation of row environment leads to the instantaneous mutation of battery sampling voltage, so as to cause the shake of the battery capacity of acquisition.2) do not consider
The internal resistance of battery is under charging, discharging condition to the influence factor of cell voltage.
The existing method for calculating battery dump energy is improved therefore, it is necessary to provide.
Summary of the invention
The purpose of the present invention is to provide a kind of method and devices for showing battery of mobile terminal remaining capacity, so that moving
For dynamic terminal when being waken up from standby mode, electricity can update last state immediately;Under operating conditions, guarantee that electricity is continuous
Variation improves user experience.
To reach above-mentioned technical purpose, the present invention provides a kind of methods for showing battery of mobile terminal remaining capacity, should
Method includes the following steps:
Step S101: judging whether mobile terminal is in standby, if be in standby, executes step S102;
It is no to then follow the steps S103;
Step S102: the display voltage of battery when battery is waken up is obtained, step S104 is executed;
Step S103: the display voltage of battery when obtaining battery work;
Step S104: battery dump energy is obtained according to display voltage.
Preferably, in step S101, judge the method whether mobile terminal is in standby are as follows:
The time difference of mobile terminal twice adjacent calculation battery dump energy is obtained, if the time difference is greater than preset threshold
Value, then it is assumed that mobile terminal is in standby.
Preferably, in step S102, the method for showing voltage v_show of battery when battery is waken up is obtained are as follows:
Step S1021: the calibration voltage v_cal of battery and the voltage v0_real of last battery are obtained;
Step S1022: judge that mobile terminal is in discharge condition and is in charged state;
If being in charged state, step S1023 is executed, if being in discharge condition, executes step S1024;
Step S1023: display voltage v_show when battery is waken up is the calibration voltage v_cal and last time electricity of battery
Big person in the voltage v0_real in pond;
Step S1024: display voltage v_show when battery is waken up is the calibration voltage v_cal and last time electricity of battery
Small person in the voltage v0_real in pond.
Preferably, the method for the calibration voltage of battery is obtained are as follows:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, it is battery internal resistance value that v_read, which is sampled voltage r_battery_resistor, and i_chg is to flow through electricity
The electric current in pond.
Preferably, in step S103, the method for the display voltage of battery when obtaining work are as follows:
Step S1031: the calibration voltage v_cal of battery is obtained;
Step S1032: cell voltage change step step is calculated;
Step S1033: battery is calculated according to the calibration voltage v_cal of above-mentioned cell voltage change step step and battery and is worked as
Preceding voltage v1_real;
Step S1034: the current display voltage v_show of battery is calculated according to the current voltage v1_real of above-mentioned battery.
Preferably, in step S1031, the method that obtains the calibration voltage v_cal of battery are as follows:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, it is battery internal resistance value that v_read, which is sampled voltage r_battery_resistor, and i_chg is to flow through electricity
The electric current in pond.
Preferably, in step S1032, the method for calculating cell voltage change step step are as follows:
The voltage v0_real of battery last time is obtained, and determines its corresponding battery dump energy in (p-1) % and p%
Between, cell voltage change step step are as follows: (vp-1-vp)/(n+1), the vp-1Expression battery dump energy is (p-1) %
When voltage, the vpIndicate voltage when battery dump energy is p%, p is natural number, and n is natural number, and size depends on
The frequency of twice adjacent calculation battery dump energy.
Preferably, in step S1033, the method for calculating battery current voltage v1_real are as follows:
The voltage v0_real of comparative cell calibration voltage v_cal and battery last time;
If the battery calibrating voltage v_cal is greater than last voltage v0_real, battery current voltage v1_
Real is v0_real+step;Otherwise, battery current voltage v1_real voltage is v0_real-step.
Preferably, in step S1034, the method that battery currently shows voltage v_show is calculated are as follows:
If battery last time shows that voltage v0_show is greater than battery current voltage v1_real, the current v_show electricity of battery
Pressure is v1_real+step;Otherwise, battery currently shows that voltage v_show is v1_real-step.
The present invention also provides a kind of device for showing battery of mobile terminal remaining capacity, which includes:
Judgment module, for judging whether mobile terminal is in standby;
First obtains display voltage module: for obtaining the display voltage of battery when battery is waken up;
Second obtains display voltage module: the display voltage of battery when for obtaining battery work;
It obtains remaining capacity module: battery dump energy is obtained according to display voltage.
Preferably, judgment module further includes
Computing module, for obtaining the time difference of mobile terminal twice adjacent calculation battery dump energy;If the time
Difference is greater than preset threshold value, then it is assumed that mobile terminal is in standby.
Preferably, the first acquisition display voltage module includes:
First receiving module, for obtaining the calibration voltage v_cal of battery and the voltage v0_real of last battery;
First charge and discharge judgment module: being in charged state for judging that mobile terminal is in discharge condition,
If be in charged state, when battery is waken up display voltage v_show be battery calibration voltage v_cal and
Big person in the voltage v0_real of last battery;
If be in discharge condition, when battery is waken up display voltage v_show be battery calibration voltage v_cal and
Small person in the voltage v0_real of last battery.
Preferably, the first receiving module is also used to:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, it is battery internal resistance value that v_read, which is sampled voltage r_battery_resistor, and i_chg is to flow through electricity
The electric current in pond.
Preferably, the second acquisition display voltage module includes:
Second receiving module, for obtaining the calibration voltage v_cal of battery;
Second material calculation module: for calculating cell voltage change step step;
Second calculates current voltage module: for the calibration voltage according to above-mentioned cell voltage change step step and battery
V_cal calculates the current voltage v1_real of battery;
Second calculate display voltage module: current for calculating battery according to the current voltage v1_real of above-mentioned battery
Show voltage v_show.
Preferably, the second receiving module is also used to:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, it is battery internal resistance value that v_read, which is sampled voltage r_battery_resistor, and i_chg is to flow through electricity
The electric current in pond.
Preferably, the second material calculation module is also used to
The voltage v0_real of battery last time is obtained, and determines its corresponding battery dump energy in (p-1) % and p%
Between, cell voltage change step step are as follows: (vp-1-vp)/(n+1), the vp-1Expression battery dump energy is (p-1) %
When voltage, the vpIndicate voltage when battery dump energy is p%, p is natural number, and n is natural number, and size depends on
The frequency of twice adjacent calculation battery dump energy.
Preferably, the second calculating current voltage module includes:
Comparison module: the voltage v0_real for comparative cell calibration voltage v_cal and battery last time;
If the battery calibrating voltage v_cal is greater than last voltage v0_real, battery current voltage v1_
Real is v0_real+step;Otherwise, battery current voltage v1_real voltage is v0_real-step.
Preferably, the second calculating display voltage module is also used to:
If battery last time shows that voltage v0_show is greater than battery current voltage v1_real, the current v_show electricity of battery
Pressure is v1_real+step;Otherwise, battery currently shows that voltage v_show is v1_real-step.
The beneficial effects of the present invention are: the present invention is calculated separately according to whether battery is waken up under dormant state first
The display voltage of battery guarantees that when dormant state is waken up, electricity can update most state immediately;In non-suspend mode situation
Under, guarantee electricity consecutive variations, improves user experience.Secondly, in view of influence of the internal resistance of cell to battery ADC sampled voltage because
Element calculates separately the voltage of battery according to the charged state of dynamic terminal device, guarantees the accuracy for calculating voltage, improves movement
Terminal device cruise duration.
Detailed description of the invention
Fig. 1 is the flow chart of method provided by the invention;
Fig. 2 is the flow chart of step S102 one embodiment in Fig. 1;
Fig. 3 is the structural block diagram of device provided by the invention;
Fig. 4 is the first structural block diagram for obtaining display voltage module in Fig. 3;
Fig. 5 is the second structural block diagram for obtaining display voltage module in Fig. 3.
Specific embodiment
It is described in detail below with reference to the technical solution of specific embodiment and attached drawing pair, so that it is clearer.
Following embodiment is not as a limitation of the invention only for more detailed embodiment cited by the description present invention.
Referring to Fig. 1-2, the method for display battery of mobile terminal remaining capacity provided by the invention, this method includes as follows
Step:
Step S101: judging whether mobile terminal is in standby, if be in standby, executes step S102;
It is no to then follow the steps S103.
Wherein, judge the method whether mobile terminal is in standby are as follows:
The time difference of mobile terminal twice adjacent calculation battery dump energy is obtained, if the time difference is greater than preset threshold
Value, then it is assumed that mobile terminal is in standby.Such as: if the time difference is greater than 10 minutes, it is believed that this is to move
The battery dump energy that dynamic terminal carries out for the first time after being waken up under standby mode calculates.
Step S102: the display voltage of battery when battery is waken up is obtained, step S104 is executed.
Wherein, the method for the display voltage v_show of battery when battery is waken up is obtained are as follows:
Step S1021: the calibration voltage v_cal of battery and the voltage v0_real of last battery are obtained;
Step S1022: judge that mobile terminal is in discharge condition and is in charged state;
If being in charged state, step S1023 is executed, if being in discharge condition, executes step S1024.
Step S1023: display voltage v_show when battery is waken up is the electricity of calibration voltage v_cal and last battery
Press the big person in v0_real;That is: v_show=max (v_cal, v0_real).
Step S1024: display voltage v_show when battery is waken up is the electricity of calibration voltage v_cal and last battery
Press the small person in v0_real, it may be assumed that v_show=min (v_cal, v0_real).
By reading charged state storage value in the charging IC for obtaining mobile terminal device, available mobile terminal device
Charging and discharging state.
Due to the presence of the internal resistance of cell, in the charge state, battery charges, and contains in battery in the sampled voltage of battery
Pressure drop in resistance;In battery discharge, battery power supply, the internal resistance of cell consumes a part of cell voltage.Therefore battery
There are large errors between sampled voltage and the open-circuit voltage of actual battery, so needing the charge and discharge according to mobile terminal device
State and the internal resistance of cell calibrate sampled voltage.
The method for obtaining the calibration voltage of battery are as follows:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, v_read is sampled voltage, and r_battery_resistor is battery internal resistance value, and i_chg is to flow through
The electric current of battery.
Step S103: the display voltage of battery when obtaining battery work.
Wherein, the method for the display voltage of battery when obtaining work are as follows:
Step S1031: the calibration voltage v_cal of battery is obtained;Due to the presence of the internal resistance of cell, in the charge state, electricity
Pond is charged, and the pressure drop on the internal resistance of cell is contained in the sampled voltage of battery;In battery discharge, battery power supply, battery
Internal resistance consumes a part of cell voltage.Therefore there are larger mistakes between the sampled voltage of battery and the open-circuit voltage of actual battery
Difference, so needing to calibrate sampled voltage according to the charging and discharging state and the internal resistance of cell of mobile terminal device.
Wherein, the method for the calibration voltage v_cal of battery is obtained are as follows:
In the charge state, battery calibrating voltage v_cal are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, v_read is sampled voltage, and r_battery_resistor is battery internal resistance value, and i_chg is to flow through
The electric current of battery.
By reading charged state storage value in the charging IC for obtaining mobile terminal device, available mobile terminal device
Charging and discharging state.
Step S1032: cell voltage change step step is calculated.
In the case where work, the trend of consecutive variations should be presented in the adjacent battery dump energy twice of mobile terminal.
But due to the difference of mobile terminal device running environment, such as: the power consumption such as unlatching camera, playing video file are big to answer
Used time, battery sampling voltage there are the characteristic of instantaneous mutation, so as to cause acquisition battery calibrating voltage also accordingly exist it is larger
The fluctuation of amplitude.It will lead to the battery dump energy finally obtained in this way and hopping phenomenon occur.Therefore it needs to above-mentioned battery
Calibration voltage is smoothed, i.e., is smoothed by step-length step to calibration voltage.
Wherein, the method for cell voltage change step step is calculated are as follows:
The voltage v0_real of battery last time is obtained, and determines its corresponding battery dump energy in (p-1) % and p%
Between, cell voltage change step step are as follows: (vp-1-vp)/(n+1), the vp-1Expression battery dump energy is (p-1) %
When voltage, the vpIndicate voltage when battery dump energy is p%, p is natural number, and n is natural number, and size depends on
The frequency of twice adjacent calculation battery dump energy.If frequency is high, n can choose bigger value.In general, keeping battery
The step-length of variation is within several millivolts.
Step S1033: battery is calculated according to the calibration voltage v_cal of above-mentioned cell voltage change step step and battery and is worked as
Preceding voltage v1_real.
Wherein, the method for battery current voltage v1_real is calculated are as follows:
The voltage v0_real of comparative cell calibration voltage v_cal and battery last time;
If the battery calibrating voltage v_cal is greater than last voltage v0_real, battery current voltage v1_
Real is v0_real+step;Otherwise, battery current voltage v1_real voltage is v0_real-step.
Step S1034: the current display voltage v_show of battery is calculated according to the current voltage v1_real of above-mentioned battery.
In step S1034, the method that battery currently shows voltage v_show is calculated are as follows:
If battery last time shows that voltage v0_show is greater than battery current voltage v1_real, the current v_show electricity of battery
Pressure is v1_real+step;Otherwise, battery currently shows that voltage v_show is v1_real-step.
Step S104: battery dump energy is obtained according to display voltage.
Wherein it is possible to obtain the remaining capacity of battery according to display voltage by inquiry voltage-capacity mapping table.
Referring to Fig. 3-5, the present invention also provides a kind of device for showing battery of mobile terminal remaining capacity, the device packets
It includes:
Judgment module 101, for judging whether mobile terminal is in standby.
Judgment module 101 further includes computing module, for obtaining mobile terminal twice adjacent calculation battery dump energy
Time difference;If the time difference is greater than preset threshold value, then it is assumed that mobile terminal is in standby.
First obtains display voltage module 102, for obtaining the display voltage of battery when battery is waken up.
First, which obtains display voltage module 102, includes:
First receiving module 1021, for obtaining the calibration voltage v_cal of battery and the voltage v0_ of last battery
real;
First charge and discharge judgment module 1022: being in charged state for judging that mobile terminal is in discharge condition,
If be in charged state, when battery is waken up display voltage v_show be battery calibration voltage v_cal and
Big person in the voltage v0_real of last battery, i.e. v_show=max (v_cal, v0_real);
If be in discharge condition, when battery is waken up display voltage v_show be battery calibration voltage v_cal and
Small person in the voltage v0_real of last battery, i.e. v_show=min (v_cal, v0_real).
First receiving module is also used to:
In the charge state, battery calibrating voltage v_cal is calculated:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage is calculated:
V_cal=v_read+i_chg*r_battery_res istor;
Wherein, it is battery internal resistance value that v_read, which is sampled voltage r_battery_resistor, and i_chg is to flow through electricity
The electric current in pond.
Second obtains display voltage module 103, the display voltage of battery when for obtaining battery work.
Second, which obtains display voltage module 103, includes:
Second receiving module 1031, for obtaining the calibration voltage v_cal of battery;
Second material calculation module 1032, for calculating cell voltage change step step;
Second calculates current voltage module 1033, for the calibration according to above-mentioned cell voltage change step step and battery
Voltage v_cal calculates the current voltage v1_real of battery;
Second calculates display voltage module 1034: working as calculating battery according to the current voltage v1_real of above-mentioned battery
Preceding display voltage v_show.
Second receiving module 1031 is also used to:
In the charge state, battery calibrating voltage v_cal is calculated are as follows:
V_cal=v_read-i_chg*r_battery_resistor
In the discharged condition, battery calibrating voltage is calculated are as follows:
V_cal=v_read+i_chg*r_battery_resistor;
Wherein, v_read is sampled voltage, and r_battery_resistor is battery internal resistance value, and i_chg is to flow through
The electric current of battery.
Second material calculation module 1032 is also used to
The voltage v0_real of battery last time is obtained, and determines its corresponding battery dump energy in (p-1) % and p%
Between, cell voltage change step step are as follows: (vp-1-vp)/(n+1), the vp-1Expression battery dump energy is (p-1) %
When voltage, the vpIndicate voltage when battery dump energy is p%, p is natural number, and n is natural number, and size depends on
The frequency of twice adjacent calculation battery dump energy.
Second, which calculates current voltage module 1023, includes:
Comparison module: the voltage v0_real for comparative cell calibration voltage v_cal and battery last time;
If the battery calibrating voltage v_cal is greater than last voltage v0_real, battery current voltage v1_
Real is v0_real+step;Otherwise, battery current voltage v1_real voltage is v0_real-step.
Second, which calculates display voltage module 1034, is also used to:
If battery last time shows that voltage v0_show is greater than battery current voltage v1_real, the current v_show electricity of battery
Pressure is v1_real+step;Otherwise, battery currently shows that voltage v_show is v1_real-step.
Remaining capacity module 104 is obtained, battery dump energy is obtained according to display voltage.
The remaining capacity of battery can be obtained according to display voltage by inquiring voltage-capacity mapping table.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously
Limitation of the scope of the invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art,
Without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to protection model of the invention
It encloses.Therefore, protection scope of the present invention should be determined by the appended claims.