{"id":24352609,"url":"https://github.com/flowduino/lithiumpowered","last_synced_at":"2026-02-07T07:03:52.384Z","repository":{"id":224051895,"uuid":"404640545","full_name":"Flowduino/LithiumPowered","owner":"Flowduino","description":"Library and Sample Projects for Lithium Battery-Powered MCU Devices (tested with ESP32 and Arduino Nano devices)","archived":false,"fork":false,"pushed_at":"2022-09-03T20:05:49.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T14:17:31.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flowduino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["Flowduino"]}},"created_at":"2021-09-09T08:15:20.000Z","updated_at":"2023-10-21T23:10:28.000Z","dependencies_parsed_at":"2024-02-23T13:50:58.213Z","dependency_job_id":null,"html_url":"https://github.com/Flowduino/LithiumPowered","commit_stats":null,"previous_names":["flowduino/lithiumpowered"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Flowduino/LithiumPowered","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowduino%2FLithiumPowered","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowduino%2FLithiumPowered/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowduino%2FLithiumPowered/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowduino%2FLithiumPowered/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flowduino","download_url":"https://codeload.github.com/Flowduino/LithiumPowered/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flowduino%2FLithiumPowered/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29188316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-18T15:55:15.220Z","updated_at":"2026-02-07T07:03:47.375Z","avatar_url":"https://github.com/Flowduino.png","language":"C++","funding_links":["https://github.com/sponsors/Flowduino"],"categories":[],"sub_categories":[],"readme":"[Latest Release - ![Release Version](https://img.shields.io/github/release/Flowduino/LithiumPowered.svg?style=plastic\u0026logo=github)![Release Date](https://img.shields.io/github/release-date/Flowduino/LithiumPowered.svg?style=plastic\u0026logo=github)](https://github.com/Flowduino/LithiumPowered/releases/latest/)  \n\nNeed Help? [![Discord](https://img.shields.io/badge/Discuss-on%20Discord-7289d9?style=plastic\u0026logo=discord)](https://discord.gg/jpwBy7VzaG) [![Instagram](https://img.shields.io/badge/Follow-on%20Instagram-c32aa3?style=plastic\u0026logo=instagram)](https://instagram.com/Flowduino)\n\n# Initial Development!\nPlease be aware that this Library is currently in its initial development stages. It will function on the ESP32 just fine (tested and verified using PlatformIO for /examples/BasicDemo).\n\n# LithiumPowered\nA (hopefully) Universal Library for Lithium-Powered Projects, designed to be available for both Arduino IDE and PlatformIO Projects.\n\nThis Library uses a Coulomb Counter (*such as the LTC4150 circuit*) to accurately keep track of the state of specifically Lithium Ion (*Li-Ion*) and Lithium Polymer (*Li-Po*) Batteries.\n\nWhat makes this Library particularly beneficial is that it fully-encapsulates the code necessary to automatically and dynamically Calibrate the Battery Capacity (*in mAh*) while the Battery is Charging *and* Discharging. It also leverages persistent Storage on your MCU so that the Battery State is always remembered between power cycles (*switching your device off and on*)\n\n## Cross-Platform\nLithiumPowered is designed to function identically for all MCUs* and all Lithium Battery Types \u0026 Capacities**.\n\n\u003e* *Must have suitable GPIO pins, support Interrupts (*ISR*), and provide some form of compatible persistent Storage (*e.g. EEPROM*).\n\u003e* **You must configure your `Battery` instance by telling it the expected Capacity (*in mAh*) of your Lithium Cell(s)\n\n## Easy Callbacks\nThe operative Class, `Battery`, can be initialised with an Instance of your own custom decendant of `BatteryCallbacks`. Each method defined in `BatteryCallbacks` that you override in your decendant will be invokved as an *Event* reflecting the name of the respective overriden Method.\n\ne.g.\n\n```c++\nclass MyBatteryCallbacks: public BatteryCallbacks {\n    public:\n        void onBatteryNowCharging() {\n            Serial.println(\"Battery is now Charging!\");\n        }\n\n        void onBatteryNowDischarging() {\n            Serial.println(\"Battery is no longer Charging!\");\n        }\n};\n```\n\n## GPIO Settings\nThe operative Class, `Battery`, can be initialised with an Instance of your own custom decendant of `BatteryGPIO`.\nEach method defined in `BatteryGPIO` that you override in your decendant will define an explicit GPIO Pin to be used for the corresponding Coloumb Pin represented by the name of the respective overriden Method.\n\ne.g.\n\n```c++\nclass MyBatteryGPIO: public BatteryGPIO {\n    uint8_t getPinInterrupt() { return 14; };\n};\n```\n\nThe above will tell our `Battery` instance to use GPIO Pin 14 for the main Coloumb Counter Interrupt pin, rather than the default defined in the Base Class, `BatteryGPIO`.\n\n## Initialising Battery\n\n```c++\n#include \u003cLithiumPowered.hpp\u003e\n\nBattery myBattery();\n\nvoid setup() {\n    Serial.begin(115200);\n\n    myBattery.setCallbacks(new MyBatteryCallbacks()); // Use your Custom Callbacks\n    myBattery.setGpio(new MyBatteryGPIO()); // Use your Custom GPIO Settings\n    // We would now change any Properties of myBattery as required\n    myBattery.setup(500); // This will Initialise our Battery instance with the given Property values, where 500 tells it that the rated Battery capacity is 500mAh\n};\n\nvoid loop() {\n    myBattery.loop(); // We need to ensure we Loop our Battery Instance to update its State\n}\n```\n\nWith the above in place, we will now see lines appear in the Console Output each time we connect or disconnect (respectively) our Device to an external Power Supply.\n\n**Note: If you are supplying power through the cable used to monitor Serial output, your Device will *always* be Charging!**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowduino%2Flithiumpowered","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowduino%2Flithiumpowered","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowduino%2Flithiumpowered/lists"}