Table of Contents

Interfacing Temperature and Humidity (DHT11) sensor

Example Description
Learn to Interface DHT11 (Temperature and Humidity) sensor and measure Temperature and Humidity with Arduino

Understanding DHT 11 Sensor


DHT11 is a low-cost digital sensor for sensing temperature and humidity.  This sensor can be easily interfaced with any micro-controller such as Arduino, Raspberry Pi etc.  to measure humidity and temperature instantaneously. It comes with a dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data. The DHT11 sensor has three pins- VCC, GND and Data Pin. A pull-up resistor of 5k to 10k ohms is provided for communication between sensor and microcontroller.

Circuit Diagram

Code

  1. From  event add  when green flag clicked.
  2. Create two variable temp & humidity for storing the temperature and humidity respectively.
  3. From  control  add  forever
  4. From sensor palette of  Arduino  select get humidity and set it variable humidity do same for temperature
  5. From  look  palette  add  say ()  for() block.
  6. From operators add three join () ()  display temperature and humidity with some message.

Script

Output