{"id":19238673,"url":"https://github.com/winlinvip/simpledht","last_synced_at":"2025-08-20T12:32:21.741Z","repository":{"id":55357319,"uuid":"50225747","full_name":"winlinvip/SimpleDHT","owner":"winlinvip","description":"Simple, Stable and Fast Arduino Temp \u0026 Humidity Sensors for DHT11 and DHT22. http://learn.adafruit.com/dht","archived":false,"fork":false,"pushed_at":"2023-06-01T11:30:18.000Z","size":91,"stargazers_count":145,"open_issues_count":6,"forks_count":61,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-16T06:45:53.040Z","etag":null,"topics":["arduino","arduino-library","dht-sensor","dht11","dht22"],"latest_commit_sha":null,"homepage":"","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/winlinvip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2016-01-23T05:55:12.000Z","updated_at":"2024-11-30T16:56:31.000Z","dependencies_parsed_at":"2024-11-09T16:47:51.345Z","dependency_job_id":null,"html_url":"https://github.com/winlinvip/SimpleDHT","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winlinvip%2FSimpleDHT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winlinvip%2FSimpleDHT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winlinvip%2FSimpleDHT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winlinvip%2FSimpleDHT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winlinvip","download_url":"https://codeload.github.com/winlinvip/SimpleDHT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230423564,"owners_count":18223435,"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":["arduino","arduino-library","dht-sensor","dht11","dht22"],"created_at":"2024-11-09T16:34:08.830Z","updated_at":"2024-12-19T11:13:12.849Z","avatar_url":"https://github.com/winlinvip.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleDHT\n\n## Description\n\nAn Arduino library for the DHT series of low-cost temperature/humidity sensors.\n\nYou can find DHT11 and DHT22 tutorials [here](https://learn.adafruit.com/dht).\n\n## Installation\n\n### First Method\n\n![image](https://user-images.githubusercontent.com/36513474/68069796-09e62200-fd87-11e9-81e0-dc75e38efed0.png)\n\n1. In the Arduino IDE, navigate to Sketch \u003e Include Library \u003e Manage Libraries\n1. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.\n1. Then search for SimpleDHT using the search bar.\n1. Click on the text area and then select the specific version and install it.\n\n### Second Method\n\n1. Navigate to the [Releases page](https://github.com/winlinvip/SimpleDHT/releases).\n1. Download the latest release.\n1. Extract the zip file\n1. In the Arduino IDE, navigate to Sketch \u003e Include Library \u003e Add .ZIP Library\n\n## Usage\n\nTo use this library:\n\n1. Open example: Arduino =\u003e File =\u003e Examples =\u003e SimpleDHT =\u003e DHT11Default\n1. Connect the DHT11 and upload the program to Arduino.\n1. Open the Serial Window of Arduino IDE, we got the result as follows.\n\n```Cpp\n=================================\nSample DHT11...\nSample OK: 19 *C, 31 H\n=================================\nSample DHT11...\nSample OK: 19 *C, 31 H\n=================================\n```\n\n\u003e Remark: For DHT11, no more than 1 Hz sampling rate (once every second).\n\u003e Remark: For DHT22, no more than 0.5 Hz sampling rate (once every 2 seconds).\n\n## Features\n\n- ### Simple\n\n    Simple C++ code with lots of comments.\n\n- ### Stable\n\n    Strictly follow the standard DHT protocol.\n\n- ### Fast\n\n    Support 0.5HZ(DHT22) or 1HZ(DHT11) sampling rate.\n\n- ### Compatible\n\n    SimpleDHT sensor library is compatible with multiple low-cost temperatures and humidity sensors like DHT11 and DHT22. A few examples are implemented just to demonstrate how to modify the code for different sensors.\n\n- ### MIT License\n\n    DHT sensor library is open-source and uses one of the most permissive licenses so you can use it on any project.\n\n  - Commercial use\n  - Modification\n  - Distribution\n  - Private use\n\n## Functions\n\n- read()\n- setPinInputMode()\n- setPin()\n- getBitmask()\n- getPort()\n- levelTime()\n- bits2byte()\n- parse()\n- read2()\n- sample()\n\n## Sensors\n\n- [x] DHT11, The [product](https://www.adafruit.com/product/386), [datasheet](https://akizukidenshi.com/download/ds/aosong/DHT11.pdf) and [example](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT11Default), 1HZ sampling rate.\n- [x] DHT22, The [product](https://www.adafruit.com/product/385), [datasheet](http://akizukidenshi.com/download/ds/aosong/AM2302.pdf) and [example](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT22Default), 0.5Hz sampling rate.\n\n## Examples\n\nThis library including the following examples:\n\n1. [DHT11Default](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT11Default): Use DHT11 to sample.\n1. [DHT11WithRawBits](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT11WithRawBits): Use DHT11 to sample and get the 40bits RAW data.\n1. [DHT11ErrCount](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT11ErrCount): Use DHT11 to sample and stat the success rate.\n1. [DHT22Default](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT22Default): Use DHT22 to sample.\n1. [DHT22WithRawBits](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT22WithRawBits): Use DHT22 to sample and get the 40bits RAW data.\n1. [DHT22Integer](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT22Integer): Use DHT22 to sample and ignore the fractional data.\n1. [DHT22ErrCount](https://github.com/winlinvip/SimpleDHT/tree/master/examples/DHT22ErrCount): Use DHT22 to sample and stat the success rate.\n1. [TwoSensorsDefault](https://github.com/winlinvip/SimpleDHT/tree/master/examples/TwoSensorsDefault): Use two DHT11 to sample.\n\nOne of the SimpleDHT examples is the following:\n\n- ### DHT22Integer\n\n```Cpp\n#include \u003cSimpleDHT.h\u003e\n\nint pinDHT22 = 2;\nSimpleDHT22 dht22(pinDHT22);\n\nvoid setup() {\n  Serial.begin(115200);\n}\n\nvoid loop() {\n\n  Serial.println(\"=================================\");\n  Serial.println(\"Sample DHT22...\");\n\n  byte temperature = 0;\n  byte humidity = 0;\n  int err = SimpleDHTErrSuccess;\n  if ((err = dht22.read(\u0026temperature, \u0026humidity, NULL)) != SimpleDHTErrSuccess) {\n    Serial.print(\"Read DHT22 failed, err=\"); Serial.print(SimpleDHTErrCode(err));\n    Serial.print(\",\"); Serial.println(SimpleDHTErrDuration(err)); delay(2000);\n    return;\n  }\n\n  Serial.print(\"Sample OK: \");\n  Serial.print((int)temperature); Serial.print(\" *C, \");\n  Serial.print((int)humidity); Serial.println(\" RH%\");\n\n  delay(2500);\n}\n```\n\n## Links\n\n1. [adafruit/DHT-sensor-library](https://github.com/adafruit/DHT-sensor-library)\n1. [Arduino #4469: Add SimpleDHT library.](https://github.com/arduino/Arduino/issues/4469)\n1. [DHT11 datasheet and protocol.](https://akizukidenshi.com/download/ds/aosong/DHT11.pdf)\n1. [DHT22 datasheet and protoocl.](http://akizukidenshi.com/download/ds/aosong/AM2302.pdf)\n\nWinlin 2016.1\n\n## Contributing\n\nIf you want to contribute to this project:\n\n- Report bugs and errors\n- Ask for enhancements\n- Create issues and pull requests\n- Tell others about this library\n- Contribute new protocols\n\nPlease read [CONTRIBUTING.md](https://github.com/winlinvip/SimpleDHT/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Credits\n\nThe author and maintainer of this library is Winlin \u003cwinlin@vip.126.com\u003e.\n\nBased on previous work by:\n\n- t-w\n- O. Santos\n- P. H. Dabrowski\n- per1234\n- P. Rinn\n- G. M. Vacondio\n- D. Faust\n- C. Stroie\n- Samlof\n- Agha Saad Fraz\n\n## License\n\nThis library is licensed under [MIT](https://github.com/winlinvip/SimpleDHT/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinlinvip%2Fsimpledht","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinlinvip%2Fsimpledht","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinlinvip%2Fsimpledht/lists"}