{"id":20400880,"url":"https://github.com/azholtikov/zh_dht","last_synced_at":"2026-04-20T13:33:12.074Z","repository":{"id":226664127,"uuid":"769019622","full_name":"aZholtikov/zh_dht","owner":"aZholtikov","description":"ESP32 ESP-IDF and ESP8266 RTOS SDK component for DHT11/DHT22/AM2302/AM2320 humidity \u0026 temperature sensor.","archived":false,"fork":false,"pushed_at":"2024-07-22T12:17:55.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T01:41:45.365Z","etag":null,"topics":["am2302","am2320","component","dht11","dht22","esp-idf","esp32","esp8266","i2c","rtos-sdk"],"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/aZholtikov.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-08T07:12:57.000Z","updated_at":"2024-06-23T08:25:31.000Z","dependencies_parsed_at":"2024-03-08T21:31:16.230Z","dependency_job_id":"d1a5cac3-8f20-4bc3-b412-17575aeadcf8","html_url":"https://github.com/aZholtikov/zh_dht","commit_stats":null,"previous_names":["azholtikov/zh_dht"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aZholtikov/zh_dht","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aZholtikov%2Fzh_dht","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aZholtikov%2Fzh_dht/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aZholtikov%2Fzh_dht/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aZholtikov%2Fzh_dht/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aZholtikov","download_url":"https://codeload.github.com/aZholtikov/zh_dht/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aZholtikov%2Fzh_dht/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32048964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"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":["am2302","am2320","component","dht11","dht22","esp-idf","esp32","esp8266","i2c","rtos-sdk"],"created_at":"2024-11-15T04:47:02.905Z","updated_at":"2026-04-20T13:33:12.025Z","avatar_url":"https://github.com/aZholtikov.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESP32 ESP-IDF and ESP8266 RTOS SDK component for DHT11/DHT22/AM2302/AM2320 humidity \u0026 temperature sensor\n\n## Tested on\n\n1. ESP8266 RTOS_SDK v3.4\n2. ESP32 ESP-IDF v5.2\n\n## Using\n\nIn an existing project, run the following command to install the component:\n\n```text\ncd ../your_project/components\ngit clone https://github.com/aZholtikov/zh_dht.git\n```\n\nIn the application, add the component:\n\n```c\n#include \"zh_dht.h\"\n```\n\n## Example\n\nReading the sensor with 1-wire connection (DHT11, DHT22, AM2302, AM2320):\n\n```c\n#include \"zh_dht.h\"\n\nvoid app_main(void)\n{\n    esp_log_level_set(\"zh_dht\", ESP_LOG_NONE);\n    zh_dht_init_config_t dht_init_config = ZH_DHT_INIT_CONFIG_DEFAULT();\n    dht_init_config.sensor_pin = GPIO_NUM_5;\n    zh_dht_init(\u0026dht_init_config);\n    float humidity = 0.0;\n    float temperature = 0.0;\n    for (;;)\n    {\n        zh_dht_read(\u0026humidity, \u0026temperature);\n        printf(\"Humidity %0.2f\\n\", humidity);\n        printf(\"Temperature %0.2f\\n\", temperature);\n        vTaskDelay(5000 / portTICK_PERIOD_MS);\n    }\n}\n```\n\nReading the sensor with I2C connection (AM2320 only):\n\n```c\n#include \"zh_dht.h\"\n\n#define I2C_PORT (I2C_NUM_MAX - 1)\n\nvoid app_main(void)\n{\n    esp_log_level_set(\"zh_dht\", ESP_LOG_NONE);\n #ifdef CONFIG_IDF_TARGET_ESP8266\n    i2c_config_t i2c_config = {\n        .mode = I2C_MODE_MASTER,\n        .sda_io_num = GPIO_NUM_4, // In accordance with used chip.\n        .sda_pullup_en = GPIO_PULLUP_ENABLE,\n        .scl_io_num = GPIO_NUM_5, // In accordance with used chip.\n        .scl_pullup_en = GPIO_PULLUP_ENABLE,\n    };\n    i2c_driver_install(I2C_PORT, i2c_config.mode);\n    i2c_param_config(I2C_PORT, \u0026i2c_config);\n#else\n    i2c_master_bus_config_t i2c_bus_config = {\n        .clk_source = I2C_CLK_SRC_DEFAULT,\n        .i2c_port = I2C_PORT,\n        .scl_io_num = GPIO_NUM_22, // In accordance with used chip.\n        .sda_io_num = GPIO_NUM_21, // In accordance with used chip.\n        .glitch_ignore_cnt = 7,\n        .flags.enable_internal_pullup = true,\n    };\n    i2c_master_bus_handle_t i2c_bus_handle;\n    i2c_new_master_bus(\u0026i2c_bus_config, \u0026i2c_bus_handle);\n#endif\n    zh_dht_init_config_t dht_init_config = ZH_DHT_INIT_CONFIG_DEFAULT();\n#ifdef CONFIG_IDF_TARGET_ESP8266\n    dht_init_config.i2c_port = I2C_PORT;\n#else\n    dht_init_config.i2c_handle = i2c_bus_handle;\n#endif\n    zh_dht_init(\u0026dht_init_config);\n    float humidity = 0.0;\n    float temperature = 0.0;\n    for (;;)\n    {\n        zh_dht_read(\u0026humidity, \u0026temperature);\n        printf(\"Humidity %0.2f\\n\", humidity);\n        printf(\"Temperature %0.2f\\n\", temperature);\n        vTaskDelay(5000 / portTICK_PERIOD_MS);\n    }\n}\n```\n\nAny [feedback](mailto:github@azholtikov.ru) will be gladly accepted.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazholtikov%2Fzh_dht","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazholtikov%2Fzh_dht","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazholtikov%2Fzh_dht/lists"}