{"id":20563404,"url":"https://github.com/pilotak/bq35100","last_synced_at":"2025-04-14T14:43:04.867Z","repository":{"id":48589761,"uuid":"291299734","full_name":"pilotak/BQ35100","owner":"pilotak","description":"Mbed library for BQ35100 primary battery fuel gauge","archived":false,"fork":false,"pushed_at":"2023-06-14T17:48:17.000Z","size":276,"stargazers_count":6,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T03:41:21.480Z","etag":null,"topics":["battery-gauge","bq35100","mbed-os"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pilotak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-29T15:43:45.000Z","updated_at":"2024-10-26T12:43:29.000Z","dependencies_parsed_at":"2022-08-27T11:11:58.010Z","dependency_job_id":null,"html_url":"https://github.com/pilotak/BQ35100","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FBQ35100","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FBQ35100/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FBQ35100/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FBQ35100/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pilotak","download_url":"https://codeload.github.com/pilotak/BQ35100/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248898684,"owners_count":21179822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["battery-gauge","bq35100","mbed-os"],"created_at":"2024-11-16T04:18:23.246Z","updated_at":"2025-04-14T14:43:04.835Z","avatar_url":"https://github.com/pilotak.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BQ35100\n\n[![Framework Badge mbed](https://img.shields.io/badge/framework-mbed-008fbe.svg)](https://os.mbed.com/)\n\nMbed library for BQ35100 primary battery fuel gauge. Originally written by [u-blox](https://os.mbed.com/teams/ublox/code/battery-gauge-bq35100) but rewritten (no backwards compatibility) with added calibration functions and other important stuff. Compatible with OS 6, where the original one fails.\n\n## Basic setting\n\n```cpp\n#include \"mbed.h\"\n#include \"BQ35100.h\"\n\nBQ35100 gauge(I2C_SDA, I2C_SCL, D7);\n\nint main() {\n    if (!gauge.init()) {\n        return 0;\n    }\n\n    gauge.setGaugeMode(BQ35100::ACCUMULATOR_MODE);\n    gauge.useInternalTemp(true);\n    gauge.setDesignCapacity(3800);\n    gauge.setBatteryAlert(0); // as we are not using ALERT pin\n    gauge.setSecurityMode(BQ35100::SECURITY_SEALED);\n}\n```\n\n## Calibration\n\n```cpp\n#include \"mbed.h\"\n#include \"BQ35100.h\"\n\nBQ35100 gauge(I2C_SDA, I2C_SCL, D7);\n\nint main() {\n    // next four step are mandatory for calibration\n    if (gauge.init(\u0026i2c)) {\n        debug(\"Init OK\\n\");\n\n    } else {\n        debug(\"Could not init the gauge\\n\");\n        return 0;\n    }\n\n    if (gauge.setSecurityMode(BQ35100::SECURITY_UNSEALED)) {\n        debug(\"Device unsealed\\n\");\n\n    } else {\n        debug(\"Unseal failed\\n\");\n        return 0;\n    }\n\n    if (gauge.setGaugeMode(BQ35100::ACCUMULATOR_MODE)) {\n        debug(\"Gauge mode set\\n\");\n\n    } else {\n        debug(\"Set gauge mode failed\\n\");\n        return 0;\n    }\n\n    if (gauge.startGauge()) {\n        debug(\"Gauge started\\n\");\n\n    } else {\n        debug(\"Could not start the gauge\\n\");\n        return 0;\n    }\n\n    if (gauge.calibrateVoltage(3600)) { // mV\n        debug(\"Voltage calibration successful\\n\");\n\n    } else {\n        debug(\"Voltage calibration failed\\n\");\n        return 0;\n    }\n\n    if (gauge.performCCOffset()) {\n        debug(\"CC offset successful\\n\");\n\n    } else {\n        debug(\"CC offset failed\\n\");\n        return 0;\n    }\n\n    if (gauge.performBoardOffset()) {\n        debug(\"Board offset successful\\n\");\n\n    } else {\n        debug(\"Board offset failed\\n\");\n        return 0;\n    }\n\n    if (gauge.calibrateCurrent(100)) { // mA\n        debug(\"Current calibration successful\\n\");\n\n    } else {\n        debug(\"Current calibration failed\\n\");\n        return 0;\n    }\n\n    if (gauge.useInternalTemp(true) \u0026\u0026 gauge.calibrateTemperature(2962)) { // 23.05°C\n        debug(\"Internal temperature calibration successful\\n\");\n\n    } else {\n        debug(\"Internal temperature calibration failed\\n\");\n        return 0;\n    }\n\n    if (gauge.useInternalTemp(false) \u0026\u0026 gauge.calibrateTemperature(2962)) { // 23.05°C\n        debug(\"External temperature calibration successful\\n\");\n\n    } else {\n        debug(\"External temperature calibration failed\\n\");\n        return 0;\n    }\n\n    gauge.setSecurityMode(BQ35100::SECURITY_SEALED);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilotak%2Fbq35100","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpilotak%2Fbq35100","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilotak%2Fbq35100/lists"}