Welcome!
...
News
2024 2nQ

Composite Sensors - Part 2

6min

DHT 11

For Part 2, the DH11 will be our focus. The DHT11 is a cost-effective digital temperature and humidity sensor. Using a capacitive humidity sensor and a thermistor to measure the surrounding air, a digital equivalent is returned on the data pin (no analog input pins needed.

The sensor is easily identifiable in its powder blue housing with 4 legs protruding. These four legs are VCC, GND, NC (Not Concerned), and Data. If you purchase the sensor all by its lonesome, then there is an extra PIN to ignore as shown below. If you purchase as a ready module, the manufacturer may have removed access to the pin. These two scenarios are illustrated below.

DHT11
DHT11


Owing to the construction of the sensor, it is not advisable to use it in highly moist or corrosive environments.

The DHT22 which looks like the DHT11 but has white or ivory packaging is similar in function to the DHT11, it's just more accurate. The DHT22 will also read a negative or below zero temperature, whereas the DHT11 is above zero only.

Please see DHT - DEEP Dive for more engineering content.

Connection Diagram

When connecting or wiring the sensor, there are a few considerations. The sensor has a specific voltage operating range, and this makes it usable for low-power devices as well as devices operating at a regular voltage. There is a single pin that functions to return data from the sensor to the MCU interacting with it.

Power Supply

The device requires 5VDC but can also work at 3V3; this can be useful for devices that are K or J variants that operate at 3V3. The output of the device is a digital value, not an analog one which ensures a reliable return from the device.

DHT11
DHT11


Code Example

C


Moving on: Composite Sensors Part 3