Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

determining sufficient LiIon charge for heavy power usage. #32

Open
neilh10 opened this issue Oct 28, 2021 · 6 comments
Open

determining sufficient LiIon charge for heavy power usage. #32

neilh10 opened this issue Oct 28, 2021 · 6 comments

Comments

@neilh10
Copy link

neilh10 commented Oct 28, 2021

For Mayfly rev1 with a fully discharged LiIon battery, using a BQ24074 that is now being charging by a solar panel, what algorithm can be used to estimate the available power in the LiIon battery.?

For a charging system, with a heavy power usage, like an LTE modem, or instruments on +12V boost, there needs to be sufficient reservoir of available power before turning on the devices.
If there is an excessive power usage, then processor will have a brown-out, and reset.

The software measuring the Voltage on A6 through a high impedance 10M/2.7M combination measures Vin, which is wire-ORed through an ideal diode/Q3 from the power path output of V_BATT, and through D5 VUSB.
The V_BATT is from the BQ24074, that is either regulated 4.4V from Vin (solar) or LiIon_V.
Only when there is no charging power, does the Voltage on A6 represent approx the LiIon_V.

Assuming solar charging, and the system is just power up, one possibly method/algorithm of determining the LiIon_V is to wait a period of time (2hours~15minutes) and take the lowest measured descended Voltage as representing the LiIon_V. If its is insufficient, a sliding window could be implemented to look for a LiIon_V. This could be indicated by a state on the LEDs (short User switch press), and the waiting bypassed by a long User Switch press.
Another option on the mega1284 is to look for the reset reason as from a brownout. If this occurs then to implement the above algorithm However this requires modifying the Arduino BSP framework, as currently it is read and thrown away at startup.

@s-hicks2
Copy link
Member

s-hicks2 commented Nov 3, 2021

The Mayfly 1.0 revA3 measures the battery using A6 to measure the input voltage to the board's 3.3v regulators, which is similar to how it was done on previous Mayfly board. However, because the new bq24074 will output up to 4.4v on its output pin during charging, the A6 pin can see voltages up to 4.4v during daytime on sunny days. On early Mayfly 1.0 prototype boards, we measured just the direct Lipo voltage, which gives the user a more realistic view of the battery status, however if a user is only powering the Mayfly with a USB cable (like during programming or use with a computer or external power supply), then A6 sees no voltage because no battery is connected. On future board revisions. additional circuitry could be used to "smart switch" between the Lipo or the USB voltage so that the output of the bq24074 isn't being measured, but the simplest (but manual) solution is to just add a solder jumper to allow user to select where they want to measure the battery voltage.

@neilh10
Copy link
Author

neilh10 commented Nov 3, 2021

So my perception is there is a critical issue for software to not cause a reset on the processor by creating a heavy demand on a battery.
So "what algorithm can be used to estimate the available power in the LiIon battery"

@neilh10
Copy link
Author

neilh10 commented Nov 10, 2021

For a configuration with a LiIon battery that is at low outdoor temperature, say -10C, the available power is more limited than at a summer temperature.
To determine available power, often a simple method is to measure the battery voltage.
So it seems to me that the hardware needs to supply a method of being able to always measure the battery voltage to sufficient accuracy.

However when the battery is charging its going to have an additional voltage applied to it, which could be as much as 0.3V.
Its possible that some form of hysteresis, or possibly a sliding window algorithm will need to allow for extra charge accumulation with real world charging batteries.

image

@neilh10
Copy link
Author

neilh10 commented Mar 3, 2022

Mayfly 1.1 has a new option SJ27, that allows the Vbat measurement to be connected directly to the LIPO_V. Thanks shannon.
ModularSensors (0.32.2) Vbat algorithm connects the AREF signal to the internal AVCC.
LiPo batteries are rechargeable, electro-chemical batteries, with the open circuit voltage typically about 4.2V and a "discharged voltage somewhere under about 3.2V.
For purposes of a "heavy load" a threshold voltage needs to be chosen, based on the battery capacity (mAHrs) and the measured voltage.
Using the standard Adafruit 4400mAhr battery I've determined that accurately measuring 3.8V allows a heavy load (~1.5Amps) to be drawn for a short period of time (10seconds).
I ran a number of tests for a charging currents (simulating variable solar influence) at a LiPo slightly less than 3.8V, and looked at how the measured voltage went through 3.8V. That is being able to determine when could a heavy instrument load be drawn

However from the simultaneous measurements I've made with the Mayfly Vbat A6 it is not linear over the voltage range 3.7V to 4.0V. Its not clear where this non-linearity and noise comes from. A suspect is that AREF is not as stable as thought, and causes the non-linearity.
For a Mayfly with solar panel that maintains a well charged battery (over a Vbat measured 4.0V) this probably isn't a problem. However any power demand decisions based on lower voltages probably won't result in repeatable testable results (ie could cause resets).
This is the graph with a Mayfly 1.1,
The green graph an axis on the left and is the accurate voltage measured by an STC3100.
The amber graph an axis on the right and is the ModularSensors measured Vbat with SJ27 set to LiPo
The two axis are not exactly aligned.
Mayfly1 1 A6 Vbat   AccurateVbat 20220227-2daysB

@neilh10
Copy link
Author

neilh10 commented Mar 22, 2022

The Mayfly 1.1 Sn 22059 with the new SJ27 set to LiPo Vbat measurement is not linear for reasonable battery measurement of Vbat in the range 3.6to 3.9V charging from Solar1 or USB.
If the intention is to maintain have a good solar capacity, and use LiPo energy above 3.9V the Vbat is probably accurate enough for the surge loads defined above.
Two workarounds are a) do some software filtering on measured Vbat and
b) have a separate fuel gauge LC709203F https://www.adafruit.com/product/4712
Here is another graph of measurements - and I've applied software filtering to reduce the noise.

220321_swfiltering_8days

@neilh10
Copy link
Author

neilh10 commented Mar 31, 2022

Here is a closer look at the filtering about the 3.8V threshold. 3.8V was chosen as a "safe" threshold, a) for the LiPo battery and b) for the linearity of the measurement circuit.
The accurate voltage is from a 12Bit STC3100, with the filtered Mayfly Vbat voltage.
In the measurements below, a situation was set up for slow discharging to 3.8V and then slow charging and discharging around that threshold.
The Vbat voltage measurement corresponds to about 3.74V. So IF the Vbat was used, for detecting 3.8V it would reach that threshold sooner, and there would be more reserve capacity in the 4400mA battery.
220331_Mayfly1 1discharging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants