Welcome to RoboSense

Thank you for coming this long, you can donate from following options.

Paypal- paypay.me/robosense

UPI Payment Options





April 10, 2021


Robots aiding human

DHT 11: Humidity and Temperature Sensor

1 min read

DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the data pin. Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using our library, sensor readings can be up to 2 seconds old.

Image result for dht 11 sensor

For Raspberry Pi:

  1. Collect the Adafruit_DHT library from GitHub
  2. Open Terminal and write:
git clone  https://github.com/adafruit/Adafruit_Python_DHT 

This code will download the Adafruit library to the memory, and now to install type the following.

sudo python setup.py install

Now just search the folder where the library has been downloaded and direct to examples folder. Now type the command to get the output from the DHT 11 sensor on the terminal.

sudo ./AdafruitDHT.py 11 4

Install Arduino IDE on Raspberry pi as shown in the video below.

Use the code and run the .ino code.

#include <dht.h> 
 dht DHT;
 define DHT11_PIN 7
 void setup(){
 void loop()
   int chk = DHT.read11(DHT11_PIN);
   Serial.print("Temperature = ");
   Serial.print("Humidity = ");

Leave a Reply

Your email address will not be published. Required fields are marked *