{"id":13802455,"url":"https://github.com/robert-hh/INA219","last_synced_at":"2025-05-13T13:31:06.589Z","repository":{"id":82726483,"uuid":"265806230","full_name":"robert-hh/INA219","owner":"robert-hh","description":"INA219 Micropython driver","archived":false,"fork":false,"pushed_at":"2020-06-15T18:27:37.000Z","size":7,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-22T12:36:01.158Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robert-hh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-21T09:21:34.000Z","updated_at":"2023-11-11T06:59:34.000Z","dependencies_parsed_at":"2023-03-18T08:01:17.849Z","dependency_job_id":null,"html_url":"https://github.com/robert-hh/INA219","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/robert-hh%2FINA219","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FINA219/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FINA219/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FINA219/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robert-hh","download_url":"https://codeload.github.com/robert-hh/INA219/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225218053,"owners_count":17439713,"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":[],"created_at":"2024-08-04T00:01:44.870Z","updated_at":"2025-05-13T13:31:06.577Z","avatar_url":"https://github.com/robert-hh.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"readme":"# INA219 MicroPython driver\n\nThis driver is a clone of an early version of the Adafruit CircuitPython driver, when these were still readable and simple.\n\nThe only thing changed was the way of reading and writing to the I2C device.\n\n## Class\n\n```python\nina = INA219(i2c, *, addr=0x40)\n```\n\nCreate an instance of the ina219 object. \n\n```\nArgs:\n  * i2c_device: The I2C object used for communication.\n  * addr:       The I2C address. The default value is 0x40 (with pin configuration A0=A1=GND).\n```\n\nThe INA219 device will be initialized with the range of 1A/32V.\n\n## Methods and properties\n\n### `current_mA: float = ina.current`\n\nReturn the current (in mA) though the shunt at the configured range.\n\nAssumes the shunt resistance is 0.1 ohm.\n\n### `bus_voltage_V: float = ina.bus_voltage`\n\nReturn the voltage (in volts) between the shunt's V- connection and GND.\n\n### `shunt_voltage_V: float = ina.shunt_voltage`\n\nReturn the voltage (in volts) between the shunt's V+ and V- connections.\n\n### `set_calibration_32V_2A()`\n\nSet the measurement range to 32V (max bus voltage) and 2A (max current, assuming a 0.1 ohm shunt resistor).\n\n### `set_calibration_32V_1A()`\n\nSet the measurement range to 32V (max bus voltage) and 1A (max current, assuming a 0.1 ohm shunt resistor).\n\n### `set_calibration_16V_400mA()`\n\nSet the measurement range to 16V (max bus voltage) and 400mA (max current, assuming a 0.1 ohm shunt resistor).\n\nIn this mode, the maximum shunt voltage is 40mV.\n\n## Example\n\n```python\nfrom machine import I2C\nfrom ina219 import INA219\nimport time\n\n# Depending on the port, the Pins for SDA and SCL must be specified.\n# See the MicroPython documentation for your port.\n# I2C requires pull-up resistors at SDA and SCL.\n\ni2c = I2C(1)\nina = INA219(i2c)\n\nset_calibration_32V_1A()\n\nwhile True:\n    current_mA = ina.current\n    voltage_V = ina.bus_voltage\n    print(\"{} mA  {} V\".format(current_mA, voltage_V))\n    time.sleep(1)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FINA219","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert-hh%2FINA219","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FINA219/lists"}