{"id":15102132,"url":"https://github.com/beegee-tokyo/dhtesp","last_synced_at":"2025-09-27T00:30:53.131Z","repository":{"id":44605452,"uuid":"116546156","full_name":"beegee-tokyo/DHTesp","owner":"beegee-tokyo","description":"Optimized DHT library for ESP32/ESP8266 using Arduino framework","archived":true,"fork":false,"pushed_at":"2023-04-14T04:16:15.000Z","size":73,"stargazers_count":232,"open_issues_count":1,"forks_count":61,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-09-25T18:47:04.267Z","etag":null,"topics":["arduino-ide","dht","dht11","dht22","esp32","esp8266","espressif","platformio"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beegee-tokyo.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":"2018-01-07T07:24:31.000Z","updated_at":"2024-09-22T13:42:22.000Z","dependencies_parsed_at":"2024-09-15T22:03:34.727Z","dependency_job_id":"a178b931-98be-42ff-9752-07a35a9ccfb2","html_url":"https://github.com/beegee-tokyo/DHTesp","commit_stats":{"total_commits":40,"total_committers":10,"mean_commits":4.0,"dds":0.375,"last_synced_commit":"b27100ac25cfc02244eaaa0f6b8ee8a225b37896"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beegee-tokyo%2FDHTesp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beegee-tokyo%2FDHTesp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beegee-tokyo%2FDHTesp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beegee-tokyo%2FDHTesp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beegee-tokyo","download_url":"https://codeload.github.com/beegee-tokyo/DHTesp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871827,"owners_count":16554457,"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-ide","dht","dht11","dht22","esp32","esp8266","espressif","platformio"],"created_at":"2024-09-25T18:47:26.391Z","updated_at":"2025-09-27T00:30:52.677Z","avatar_url":"https://github.com/beegee-tokyo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"DHTesp [![Build Status](https://github.com/beegee-tokyo/DHTesp/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/beegee-tokyo/DHTesp/actions)\n===\n\u003c!-- [![Build Status](https://travis-ci.com/beegee-tokyo/DHTesp.svg?branch=master)](https://travis-ci.com/beegee-tokyo/DHTesp) --\u003e\n\n_**This library is no longer maintained**_\n\nAn Arduino library for reading the DHT family of temperature and humidity sensors.    \nForked from [arduino-DHT](https://github.com/markruys/arduino-DHT)     \nOriginal written by Mark Ruys, \u003cmark@paracas.nl\u003e.    \n\nWhy did I clone this library instead of forking the original repo and push the changes?\nWhen I searched through Github for DHT libraries, I found a lot of them, some of them offers additional functions, some of them only basic temperature and humidity values. I wanted to combine all interesting functions into one library. In addition, none of the DHT libraries I found were written to work without errors on the ESP32. For ESP32 (a multi core/ multi processing SOC) task switching must be disabled while reading data from the sensor.    \nAnother problem I found is that many of the available libraries use the same naming (dht.h, dht.cpp), which easily leads to conflicts if different libraries are used for different platforms.    \n\n_**According to users, the library works as well with DHT33 and DHT44 sensors. But as I do not own these sensors, I cannot test and confirm it. However, if you want to use this sensors, you can do so by using `setup(pin, DHTesp::DHT22)` and it should work.\nPlease give me feedback in the issues if you successfull use these sensors.\nThank you**_\n\nThe library is tested as well on ESP8266 and should work on AVR boards as well.    \n\nChanges to the original library:\n--------\n- 2017-12-12: Renamed DHT class to DHTesp and filenames from dht.* to DHTesp.* to avoid conflicts with other libraries - beegee-tokyo, \u003cbeegee@giesecke.tk\u003e.    \n- 2017-12-12: Updated to work with ESP32 - beegee-tokyo, \u003cbeegee@giesecke.tk\u003e.   \n- 2017-12-12: Added function computeHeatIndex. Reference: [Adafruit DHT library](https://github.com/adafruit/DHT-sensor-library).    \n- 2017-12-14: Added function computeDewPoint. Reference: [idDHTLib](https://github.com/niesteszeck/idDHTLib).    \n- 2017-12-14: Added function getComfortRatio. Reference: [libDHT](https://github.com/ADiea/libDHT). (References about Human Comfort invalid)    \n- 2017-12-15: Added function computePerception. Reference: [WikiPedia Dew point==\u003e Relationship to human comfort](https://en.wikipedia.org/wiki/Dew_point) - beegee-tokyo, \u003cbeegee@giesecke.tk\u003e.   \n- 2018-01-02: Added example for multiple sensors usage.    \n- 2018-01-03: Added function getTempAndHumidity which returns temperature and humidity in one call.    \n- 2018-01-03: Added retry in case the reading from the sensor fails with a timeout.    \n- 2018-01-08: Added ESP8266 (and probably AVR) compatibility.    \n- 2018-03-11: Updated DHT example    \n- 2018-06-19: Updated DHT example to distinguish between ESP8266 examples and ESP32 examples    \n- 2018-07-06: Fixed bug in ESP32 example    \n- 2018-07-17: Use correct field separator in keywords.txt    \n- 2019-03-07: Added computeAbsoluteHumidity which returns the absolute humidity in g/m³. Reference: [How to convert relative humidity to absolute humidity](https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/) kudos to [Wurstnase](https://github.com/Wurstnase)    \n- 2019-03-22: Fixed auto detection problem    \n- 2019-07-31: Make getPin() public, Updated ESP8266 example        \n- 2019-10-01: Using noInterrupts() \u0026 interrupts() instead of cli and sei\n- 2019-10-05: Reduce CPU usage and add decimal part for DHT11 (thanks to Swiftyhu)\n- 2019-10-06: Back to working version by removing the last commit\n- 2021-02-20: Fix negative temperature problem (credits @helijunky)\n\nFeatures\n--------\n  - Support for DHT11 and DHT22, AM2302, RHT03\n  - Auto detect sensor model\n  - Determine heat index\n  - Determine dewpoint\n  - Determine thermal comfort:\n    * Empiric comfort function based on comfort profiles(parametric lines)\n    * Multiple comfort profiles possible. Default based on http://epb.apogee.net/res/refcomf.asp  (References invalid)\n    * Determine if it's too cold, hot, humid, dry, based on current comfort profile\n    * More info at [Determining Thermal Comfort Using a Humidity and Temperature Sensor](https://www.azosensors.com/article.aspx?ArticleID=487)\n  - Determine human perception based on humidity, temperature and dew point according to Horstmeyer, Steve (2006-08-15). [Relative Humidity....Relative to What? The Dew Point Temperature...a better approach](http://www.shorstmeyer.com/wxfaqs/humidity/humidity.html)\n\nFunctions\n-----\n_**`void setup(uint8_t pin, DHT_MODEL_t model=AUTO_DETECT);`**_    \n- Call to initialize the interface, define the GPIO pin to which the sensor is connected and define the sensor type. Valid sensor types are:     \n    - AUTO_DETECT     Try to detect which sensor is connected (default if 2nd parameter is not used)    \n    - DHT11    \n    - DHT22    \n    - AM2302          Packaged DHT22    \n    - RHT03           Equivalent to DHT22    \n_**`void resetTimer();`**_    \n- Reset last time the sensor was read    \n\n_**`float getTemperature();`**_    \n- Get the temperature in degree Centigrade from the sensor    \nEither one of  _`getTemperature()`_ or  _`getHumidity()`_ or  _`getTempAndHumidity()`_ initiates reading a value from the sensor if the last reading was older than the minimal refresh time of the sensor.    \nSee example _`DHT_ESP32.ino`_ or _`DHT_Test.ino`_    \n\n_**`float getHumidity();`**_    \n- Get the humidity from the sensor     \nEither one of  _`getTemperature()`_ or  _`getHumidity()`_ or  _`getTempAndHumidity()`_ initiates reading a value from the sensor if the last reading was older than the minimal refresh time of the sensor.    \nSee example _`DHT_ESP32.ino`_ or _`DHT_Test.ino`_    \n\n_**`TempAndHumidity getTempAndHumidity();`**_    \n- Get the temperature and humidity from the sensor     \nEither one of _`getTemperature()`_ or  _`getHumidity()`_ or  _`getTempAndHumidity()`_ initiates reading a value from the sensor if the last reading was older than the minimal refresh time of the sensor.    \nReturn value is a struct of type _`TempAndHumidity`_ with temperature and humidity as float values.\nSee example _`DHT_Multi.ino`_    \n\n_**`DHT_ERROR_t getStatus();`**_    \n- Get last error if reading from the sensor failed. Possible values are:    \n  - ERROR_NONE      no error occured\n  - ERROR_TIMEOUT   timeout reading from the sensor    \n  - ERROR_CHECKSUM  checksum of received values doesn't match\n\n_**`const char* getStatusString();`**_    \n- Get last error as a char *    \n\n_**`DHT_MODEL_t getModel()`**_    \n- Get detected (or defined) sensor type    \n\n_**`int getMinimumSamplingPeriod();`**_    \n- Get minimmum possible sampling period. For DHT11 this is 1000ms, for other sensors it is 2000ms    \n\n_**`int8_t getNumberOfDecimalsTemperature();`**_    \n- Get number of decimals in the temperature value. For DHT11 this is 0, for other sensors it is 1    \n\n_**`int8_t getLowerBoundTemperature();`**_    \n- Get lower temperature range of the sensor. For DHT11 this is 0 degree Centigrade, for other sensors this is -40 degree Centrigrade    \n\n_**`int8_t getUpperBoundTemperature();`**_    \n- Get upper temperature range of the sensor. For DHT11 this is 50 degree Centigrade, for other sensors this is 125 degree Centrigrade    \n\n_**`int8_t getNumberOfDecimalsHumidity();`**_    \n- Get number of decimals in the humidity value. This is always 0.    \n\n_**`int8_t getLowerBoundHumidity();`**_    \n- Get lower humidity range of the sensor. For DHT11 this is 20 percent, for other sensors this is 0 percent    \n\n_**`int8_t getUpperBoundHumidity();`**_    \n- Get upper temperature range of the sensor. For DHT11 this is 90 percent, for other sensors this is 100 percent    \n\n_**`static float toFahrenheit(float fromCelcius);`**_    \n- Convert Centrigrade value to Fahrenheit value    \n\n_**`static float toCelsius(float fromFahrenheit) { return (fromFahrenheit - 32.0) / 1.8; };`**_    \n- Convert Fahrenheit value to Centigrade value    \n\n_**`float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=false);`**_    \n- Compute the heat index. Default temperature is in Centrigrade.    \n\n_**`float computeDewPoint(float temperature, float percentHumidity, bool isFahrenheit=false);`**_    \n- Compute the dew point. Default temperature is in Centrigrade.    \n\n_**`float computeAbsoluteHumidity(float temperature, float percentHumidity, bool isFahrenheit=false);`**_    \n- Compute the absolute humidity in g/m³. Default temperature is in Centrigrade.    \n\n_**`float getComfortRatio(ComfortState\u0026 destComfStatus, float temperature, float percentHumidity, bool isFahrenheit=false);`**_    \n- Compute the comfort ratio. Default temperature is in Centrigrade. Return values:    \n0 -\u003e OK    \n1 -\u003e Too Hot    \n2 -\u003e Too cold    \n4 -\u003e Too dry    \n8 -\u003e Too humid    \n9 -\u003e Hot and humid    \n5 -\u003e Hot and dry    \n10 -\u003e Cold and humid    \n6 -\u003e Cold and dry    \n\n_**`byte computePerception(float temperature, float percentHumidity, bool isFahrenheit=false);`**_    \n- Compute the human perception. Default temperature is in Centrigrade. Return values:    \n0 -\u003e Dry    \n1 -\u003e Very comfortable    \n2 -\u003e Comfortable    \n3 -\u003e Ok    \n4 -\u003e Uncomfortable    \n5 -\u003e Quite uncomfortable    \n6 -\u003e Very uncomfortable    \n7 -\u003e Severe uncomfortable    \n\n_**`uint8_t getPin(void);`**_    \n- Returns the assigned GPIO for this instance. Usefull when connecting multiple sensors         \n\nUsage\n-----\nSee [examples](https://github.com/beegee-tokyo/DHTesp/blob/master/examples). For all the options, see [dhtesp.h](https://github.com/beegee-tokyo/DHTesp/blob/master/DHTesp.h).    \n\nInstallation\n------------\n\nIn Arduino IDE open Sketch-\u003eInclude Library-\u003eManage Libraries then search for _**DHT ESP**_    \nIn PlatformIO open PlatformIO Home, switch to libraries and search for _**DHT ESP32**_. Or install the library in the terminal with _**`platformio lib install 2029`**_    \n\nFor manual installation [download](https://github.com/beegee-tokyo/DHTesp/archive/master.zip) the archive, unzip it and place the DHTesp folder into the library directory.    \nIn Arduino IDE this is usually _**`\u003carduinosketchfolder\u003e/libraries/`**_    \nIn PlatformIO this is usually _**`\u003cuser/.platformio/lib\u003e`**_    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeegee-tokyo%2Fdhtesp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeegee-tokyo%2Fdhtesp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeegee-tokyo%2Fdhtesp/lists"}