Exercise 4: The DHT11 Temperature and Humidity Sensor
Introduction
The DHT11 is a digital temperature and humidity sensor featuring his own proprietary communication protocol. It uses a single GPIO line (GPIO 16) to serially transfer its temperature and humidity measurement.
MicroPython already has a driver for the DHT type sensors (DHT11 and DHT22) included in its binary making it very easy to read the temperature and humidity values. The driver however hides the protocol from the user and the student cannot see what is going on behind the scene.
For this reason I have added a second driver allowing to read raw bit values as they appear in the DHT11 protocol. This allows the student to understand how the DHT11 actually works and what the driver is doing to extract the temperature and humidity values.
Here is the DHT11 data sheet:
https://afnog.iotworkshop.africa/pub/IoT_Course_English/TheDHT11TemperatureAndHumiditySensor/DHT11.pdf
Please read it carefully!
Exercise 1: The DHT11 using the MicroPython driver
Write a script which reads out thee DHT11 and prints its temperature and humidity values. As mentioned in the introduction, the DHT11 is connected to the ESP32 through GPIO pin 16.
The description of the MicroPython driver is found in the
!MicroPython documentation
.
Exercise 2: Understanding the DHT11 protocol
--
Uli Raich - 2020-05-06
Comments