Setup DHT11 Sensor With Arduino
Here I am providing complete information about how to setup the dht11 humidity sensor on an Arduino board. For this, you need to include the dht11 library in your Arduino code. Below you can find dht11 Arduino code and dht11 library.
DHT11 is a humidity and temperature sensor. It can be used as humidity sensor as well as the temperature sensor. You can find the dht11 sensor of 2 types in the market. One is with 4 pins and another is with 3 pins. In 3 pin dht11 sensor already 10k Ohm resistor is added inside the module. The operating voltage of this module is 3.3V
4 PIN DHT11 CONNECTIONS WITH ARDUINO UNO
You need a 10K Ohm pull up resistor to get the proper data from 4 pin dht11 sensor. Pin configuration of this sensor, Left most pin is 3.3V (VCC), the second leftmost pin is output and the right most pin is ground. In the following code the I declared the pin to get reading from the sensor is Digital pin 4 . You need to add 10K Ohm pull up resistor between VCC and Output. You can find the connections in above circuit.
3 PIN DHT11 CONNECTIONS WITH ARDUINO UNO
Pin configuration of the dht11 sensor is, the leftmost pin is 3.3V(VCC), the middle pin is output, the rightmost pin is Ground.In the following code, I declared Digital pin 4 to get data from the sensor. So, we need to connect output pin of the dht11 sensor to the digital pin 4 of Arduino. If you have any confusion, you can find the connections in above circuit.
DHT11 ARDUINO CODE
You can see the output on the serial monitor. To open serial monitor go to Tools > Serial Monitor . Set the baud rate of serial monitor to 9600. The output is updated every second and can observe the changes in Temperature and Humidity.