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

Battery monitor feature v2 - based on INA219 Current&Power Monitor #1038

Open
wants to merge 30 commits into
base: beta
Choose a base branch
from

Conversation

gvidinski
Copy link
Contributor

I'm presenting you the new version of Battery monitor feature. It allows you, if UPS topology is used to power the board, to monitor the state of the battery by showing current battery voltage in mV along with it state in percent, current draw in mA and power consumption in mW(W).

This solution relies on TI INA219 Zerø-Drift, Bidirectional Current/Power Monitor IC With I2C Interface and can be used by simply attaching to the configuration an Adafruit INA219 Current Sensor Breakout board (Figure 1) or some of its clones.

Figure 1.

The UI is organized in the following manner. The feature can be enabled through the "Configuration" page. All the settings for the Battery monitor have to be entered form the “More settings” tab, under the “Enable battery monitor” checkbox (Figure 2).
When enabled (Figure 3) user may choose from a drop-down (Figure 4) between tree calibration settings already predefined by the Adafruit INA219 library, depending on concrete setup - 32V/2A, 32V/1A & 16V/400mA. But most important, in order to receive correct battery state percentage, the user will have to set the threshold voltage for both, the discharged [Battery U min (mV)] and the fully charged [Battery U max (mV)] state.
Then the actual battery state can be obtained at the “Device status” page (Figure5) in the form of “Battery status: -.--mV | -%”, "Current draw: ---mA" & "Power consumption: ---mW" (Figure 5.).

Figure 2. Figure 3.
Figure 4. Figure 5.
All the measurements are done by averaging 3 consecutive readings taken in periods of 1 second, then followed by 10 seconds pause period. In addition the Battery state data is added to the json result. This way users can track the state of the battery and also may develop customized battery state charts on their platforms.
Build and testing was done using the PlatformIO under the Visual Studio Code IDE following the “Contributing Guidelines”.

Georgi Vidinski and others added 30 commits December 6, 2020 19:02
…BR tag befor battery settings for better UX;
…ery_analog_value' is outside of the predefined range by any circumstances;
build workflow: make it run only if ref_type != 'tag'
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

Successfully merging this pull request may close these issues.

1 participant