First of all, we shall take a in-depth look at DHT11 temperature and humidity sensor. This sensor includes a humidity measurement component and an NTC temperature measurement component, and connects to a high-performance 8-bit microcontroller.DHT11′s power supply is 3-5.5V DC.
The interesting thing in this module is the protocol that uses to transfer data between MCU and DHT11 sensor. All the sensor readings are sent by using a single wire bus which reduces the cost and extends the distance. One communication process is about 4ms.Data consists of decimal and integral parts. A complete data transmission is 40bit, and the sensor sends higher data bit first.
Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data + 8bit check sum.
More details related to DH11 sensor module please visit our Wiki.
Because of the original code to read DHT11 sensor module is so “obscure”, we can import a DHT sensor library to make it work more obvious and more user-friendly. You can download DHT library here, then drag the DHT folder into Arduino/libraries/ folder and restart IDE.It’s fairly easy to connect up DHT11 module to Arduino, pin S is for data output.
Now load up Examples-DHT-DHTtester sketch. Since the DHT sensor library is not only for DHT11 sensor module, but also for other types of DHT sensor, such as DHT12,DHT22. Therefore, the code need to change a bit for fitting your sensor module, or else, it doesn’t work properly.