{"id":13613039,"url":"https://github.com/mcauser/micropython-dht12","last_synced_at":"2025-04-10T08:58:51.151Z","repository":{"id":57441478,"uuid":"69221045","full_name":"mcauser/micropython-dht12","owner":"mcauser","description":"MicroPython driver for the Aosong DHT12 temperature and humidity sensor","archived":false,"fork":false,"pushed_at":"2024-02-16T15:53:11.000Z","size":934,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T08:12:07.671Z","etag":null,"topics":["dht","dht12","humidity","micropython","temperature"],"latest_commit_sha":null,"homepage":"","language":"Python","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/mcauser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"publiccode":null,"codemeta":null}},"created_at":"2016-09-26T06:46:15.000Z","updated_at":"2025-01-10T22:08:32.000Z","dependencies_parsed_at":"2025-02-16T22:31:21.247Z","dependency_job_id":"7d4b7b42-c448-48c3-b123-208fef88a86c","html_url":"https://github.com/mcauser/micropython-dht12","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-dht12","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-dht12/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-dht12/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-dht12/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcauser","download_url":"https://codeload.github.com/mcauser/micropython-dht12/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143740,"owners_count":21054831,"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":["dht","dht12","humidity","micropython","temperature"],"created_at":"2024-08-01T20:00:38.380Z","updated_at":"2025-04-10T08:58:51.127Z","avatar_url":"https://github.com/mcauser.png","language":"Python","readme":"# MicroPython DHT12 I2C\n\nA MicroPython library for interfacing with an Aosong DHT12 temperature and humidity sensor over I2C.\n\nThis library focuses on using the I2C interface. The sensor also supports a 1-wire interface, available when pin 4 is connected to GND.\n\n![demo](docs/demo.jpg)\n\n\n## Installation\n\nUsing mip via mpremote:\n\n```bash\n$ mpremote mip install github:mcauser/micropython-dht12\n$ mpremote mip install github:mcauser/micropython-dht12/examples\n```\n\nUsing mip directly on a WiFi capable board:\n\n```python\n\u003e\u003e\u003e import mip\n\u003e\u003e\u003e mip.install(\"github:mcauser/micropython-dht12\")\n\u003e\u003e\u003e mip.install(\"github:mcauser/micropython-dht12/examples\")\n```\n\nManual installation:\n\nCopy `src/dht12.py` to the root directory of your device.\n\n\n## Examples\n\n**Basic usage**\n\n```python\nfrom machine import I2C, Pin\nimport dht12\n\ni2c = I2C(0)\nsensor = dht12.DHT12(i2c)\n\nsensor.measure()\nprint(sensor.temperature())\nprint(sensor.humidity())\n```\n\n\n## Methods\n\n### __init__(i2c)\n\nAs with other modern Aosong sensors, this sensor supports an I2C interface and can be found at address 0x5C.\n\n### check()\n\nScans the I2C bus looking for the sensor at it's fixed I2C address 0x5C. Raises a OSError if not found.\n\n### measure()\n\nReads the temperature and humidity from the sensor over the I2C bus and persists for subsequent calls to `temperature()` and `humidity()`.\nReceived bytes contains a checksum to ensure the data is error free, otherwise an Exception is raised.\n\n### temperature()\n\nReturns the temperature in degrees Celsius from the data collected from the last `measure()` call.\n\n### humidity()\n\nGet the relative humidity as a percentage from the data collected from the last `measure()` call.\n\n\n## Parts\n\n* [DHT12 module](https://s.click.aliexpress.com/e/_DClODk9)\n* [DHT12](https://s.click.aliexpress.com/e/_DCP2d1B)\n* [DHT12](https://s.click.aliexpress.com/e/_DeFy39J)\n* [TinyPICO](https://www.tinypico.com/)\n* [WeMos D1 Mini](https://www.aliexpress.com/item/32529101036.html)\n\n\n## Connections\n\nDHT12 | TinyPICO (ESP32)\n----- | ----------------\nVIN   | 3V3\nSDA   | 22\nGND   | GND\nSCL   | 21\n\nDHT12 | Wemos D1 Mini (ESP8266)\n----- | -----------------------\nVIN   | 3V3\nSDA   | GPIO4\nGND   | GND\nSCL   | GPIO5\n\n\n## Links\n\n* [micropython.org](http://micropython.org)\n* [DHT12 datasheet](docs/DHT12.pdf)\n* [TinyPICO Getting Started](https://www.tinypico.com/gettingstarted)\n\n\n## License\n\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\n\nCopyright (c) 2016 Mike Causer\n","funding_links":[],"categories":["Libraries","精选驱动库"],"sub_categories":["Sensors","传感器"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-dht12","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcauser%2Fmicropython-dht12","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-dht12/lists"}