-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/add_sensor_max17048' into 'master'
feat(sensor): add max17048 lithium battery monitor sensor Closes AEGHB-287 See merge request ae_group/esp-iot-solution!1189
- Loading branch information
Showing
22 changed files
with
1,470 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ChangeLog | ||
|
||
## v0.1.0 - 2024-12-28 | ||
|
||
### Enhancements: | ||
|
||
* Initial version: Provide the basic functionality of the MAX17048/MAX17049 sensor. |
5 changes: 5 additions & 0 deletions
5
components/sensors/battery_fuel_gauge/max17048/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
idf_component_register(SRCS "max17048.c" | ||
INCLUDE_DIRS include) | ||
|
||
include(package_manager) | ||
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# MAX17048/MAX17049 | ||
|
||
The MAX17048/MAX17049 ICs are tiny, micropower current fuel gauges for lithium-ion (Li+) batteries in handheld and portable equipment. The MAX17048 operates with a single lithium cell and the MAX17049 with two lithium cells in series. The ICs use the sophisticated Li+ battery-modeling algorithm ModelGauge™ to track the battery relative state-of-charge (SOC) continuously over widely varying charge and discharge conditions. The ModelGauge algorithm eliminates current-sense resistor and battery-learn cycles required in traditional fuel gauges. Temperature compensation is implemented using the system microcontroller. | ||
|
||
More detailed data can be found in the [MAX17048/MAX17049 Datasheet](https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17048-MAX17049.pdf). | ||
|
||
## Example of MAX17048/MAX17049 usage | ||
|
||
```c | ||
i2c_bus_handle_t i2c_bus = NULL; | ||
max17048_handle_t max17048 = NULL; | ||
|
||
//Step1: Init I2C bus | ||
i2c_config_t conf = { | ||
.mode = I2C_MODE_MASTER, | ||
.sda_io_num = I2C_MASTER_SDA_IO, | ||
.sda_pullup_en = GPIO_PULLUP_ENABLE, | ||
.scl_io_num = I2C_MASTER_SCL_IO, | ||
.scl_pullup_en = GPIO_PULLUP_ENABLE, | ||
.master.clk_speed = 400 * 1000, | ||
}; | ||
i2c_bus = i2c_bus_create(I2C_NUM_0, &conf); | ||
|
||
//Step2: Init max17048 | ||
max17048 = max17048_create(i2c_bus, MAX17048_I2CADDR_DEFAULT); | ||
|
||
// Step2: Get voltage and battery percentage | ||
float voltage = 0, percent = 0; | ||
max17048_get_cell_voltage(max17048, &voltage); | ||
max17048_get_cell_percent(max17048, &percent); | ||
``` |
10 changes: 10 additions & 0 deletions
10
components/sensors/battery_fuel_gauge/max17048/idf_component.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "0.1.0" | ||
description: I2C driver for MAX17048/MAX17049 micropower current fuel gauges | ||
url: https://github.com/espressif/esp-iot-solution/tree/master/components/sensors/battery_fuel_gauge/max17048 | ||
repository: https://github.com/espressif/esp-iot-solution.git | ||
documentation: https://docs.espressif.com/projects/esp-iot-solution/en/latest/sensors/battery_fuel_gauge.html | ||
issues: https://github.com/espressif/esp-iot-solution/issues | ||
dependencies: | ||
espressif/i2c_bus: "1.1.*" | ||
idf: '>=4.4' | ||
cmake_utilities: "0.*" |
Oops, something went wrong.