arduino dht11 lcd display pricelist
This article is a guide for the popular DHT11 and DHT22 temperature and humidity sensors with the Arduino. We’ll explain how it works, show some of its features and share an Arduino project example that you can modify to use in your own projects.
The DHT11 and DHT22 are very similar, but differ in their specifications. The following table compares some of the most important specifications of the DHT11 and DHT22 temperature and humidity sensors. For a more in-depth analysis of these sensors, please check the sensors’ datasheet.
In the loop(), at the beginning, there’s a delay of 2 seconds. This delay is needed to give enough time for the sensor to take readings. The maximum sampling rate is two seconds for the DHT22 and one second for the DHT11.
After uploading the code to the Arduino, open the Serial Monitor at a baud rate of 9600. You should get sensor readings every two seconds. Here’s what you should see in your Arduino IDE Serial Monitor.
If you’re trying to read the temperature and humidity from the DHT11/DHT22 sensor and you get an error message in your Serial Monitor, follow the next steps to see if you can make your sensor work (or read our dedicated DHT Troubleshooting Guide).
Power: the DHT sensor has an operating range of 3V to 5.5V (DHT11) or 3V to 6V (DHT22). If you’re powering the sensor from the a 3.3V pin, in some cases powering the DHT with 5V solves the problem.
Bad USB port or USB cable: sometimes powering the Arduino directly from a PC USB port is not enough. Try to plug it to a USB hub powered by an external power source. It might also help replacing the USB cable with a better or shorter one. Having a USB port that supplies enough power or using a good USB cable often fixes this problem.
Power source: as mentioned in the previous tip, your Arduino might not be supplying enough power to properly read from the DHT sensor. In some cases, you might need to power the Arduino with a power source that provides more current.
Wrong baud rate or failed to upload code: if you don’t see anything in your Arduino IDE Serial Monitor double-check that you’ve selected the right baud rate, COM port or that you’ve uploaded the code successfully.
You need to install the Adafruit Unified Sensor driver library. In your Arduino IDE, type in the search box “Adafruit Unified Sensor“, scroll all the way down to find the library and install it.
The DHT11 and DHT22 sensors provide an easy and inexpensive way to get temperature and humidity measurements with the Arduino. The wiring is very simple – you just need to connect the DHT data pin to an Arduino digital pin.
Using a display to view the temperature and humidity of your environment can be possible using the DHT11 or DHT22 sensor with the easy to use Arduino microcontroller platform and that’s the goal of this project. For this project, we will be using the 16×2 LCD display module to display the temperature and humidity readings gathered from the environment using the DHT11 temperature and humidity sensor.
Although the DHT11 temperature and humidity sensor isn’t the fastest temperature and humidity sensor around, it has fair level of accuracy, +-5% for humidity readings and +-2% for temperature readings. With the DHT we will be able to measure temperature and humidity of the environment with a very fair degree of accuracy.
The LCD Keypad shield makes connecting the 16×2 LCD module to any system quite easy as it simply just plugs on the Arduino mega which is being used for this project.
Putting the component together is very easy if using the LCD keypad shield. All you just need to do is plug the LCD in as shown below and connect the DHT as described in the schematics above.
Note that the RW pin is connected to GND because we will be writing only to the LCD and not to read from it, for this to be possible the RW pin has to be pulled LOW
Pin connection of the dht11 to the arduino is as illustrated below. All DHT11 sensors have three main functional pins. The DHT types with four pins always have a void pin which is never connected to anything.
Before we start, we have to download DHT library and set its type. The required library is available on github. Download it and extract it into Arduino libraries folder, then open Arduino IDE. Its probably important to note at this point that the library will not be visible to an Arduino IDE instance that was already running before installation, you have to restart the Arduino IDE after installing the library.
With the next line, we create an LCD object, passing in the Arduino pin numbers to which our LCD pins are connected as follows in the format lcd (RS, E, D4, D5, D6, D7).
In the setup function, we call the LCD begin method, passing in the LCD size which is a 16×2. Next, we print a message to indicate the device has commenced reading data from the sensor on the first line of the LCD then call the DHT begin method.
Moving on to the loop() function, we create two variables of type float which will hold the temperature and humidity value, give it a delay of two seconds after reading values into them and then clear the LCD.
Next we create two character arrays both of size six and then we use the dtostrf function to convert our temperature and humidity value from type float to string and then we print it on the LCD. Note that the explicit typecasting used in the lcd.print() function ((char)223) is used to print the degree symbol on the display.
Save your code, connect your Mega to your computer and make sure under your tools menu, the board picked is “Arduino/Genuino Mega or Mega 2560” and also ensure the right COM port is selected. Click upload when done and you should have something like the Image below.
The DHT11 is a basic, low cost, digital humidity, and temperature sensor. It measures temperature from 0-50°C with an accuracy of ±2 °C. It also measures humidity from 20-90% RH with an accuracy of ±5 %. It is available in a module form and a sensor form. We will be using the module form in this tutorial. Both of them differ in this sense that the sensor has a filtering capacitor and a pull-up resistor attached to the output pin of the sensor.
Sensor data will be displayed on a 16 x 2 LCD display. We will use Adafruit to easily operate this LCD in 4-bit mode, so we will install it in our Raspberry Pi. For this follow the following steps:
DHT11 sensor works by sensing the temperature and humidity and then transmitting the data through the output pin as serial data. We can read this data through the I/O pin on a microprocessor/microcontroller. In order to read the values you would have to go through thedatasheetof the DHT11 sensor, but for now, to keep things simple we will use a library to talk with the DHT11 sensor. We will be using the same procedure to install the DHT11 library as we did for the LCD library. We will only change the link of the Github page. Use the following commands one by one to install the DHT library.
For making building circuit you will make the following connections.Connect the LCD and DHT11 sensor to the 5V pins on the Raspberry Pi. In case you are using a module you do not need to attach a resistor on the output pin of the DHT11 sensor. If not then use a pull-up resistor of 1k. A trimmer potentiometer of 10k is added to the VEE pin of the LCD. Sensor Output Pin is Connected to GPIO17 ( 11 ) of raspberry pi.
Then next connections are pretty basic but take note of which GPIO pins you are using to connect the pins since we will need in our program. Make your connections according to the provided circuit diagram. Since we used a DHT11 module, we wired it directly to our Raspberry Pi.
Your LCD will display an intro message and then give you the current temperature and humidity values. In case of no display, check your python shell window for any errors, your connections and also adjust the potentiometer. Now you have completed this project!
Abstract – Humidity and Temperature are crucial parameters for the optimal response of biological systems e.g. each has its own impact on growth and production of quality crops. There are several techniques of measuring humidity and temperature. However, there is still a need for continuous technological innovation to enable fast, real time and remote monitoring of these parameters. The aim of this study research was to fabricate a functional hardware and software system to measure temperature and humidity. The system was designed to allow multiple communication with user by recording of the data in Real time, storing the acquired data in an SD card, incorporate an alarming system (piezo buzzer) together with an LED indication mechanism. The study utilized an Arduino Nano board interfaced with a Temperature and Humidity sensor, Real Time Clock (RTC), LCD, and Micro SD card Module, piezo buzzer and LED, and had the ability to store the data as text file. A code was generated using the computer with the appropriate Arduino program and sent to the Arduino microcontroller for running the circuit. To study the performance characteristics of the Arduino-based humidity and temperature sensor, two independent running test were done, one outside the Physics laboratories and the second inside a Green House, both at Chuka University, Kenya.
embedded alarming system that alerts the user when the desired temperature and humidity limits are exceeded recorded. The study utilized the Arduino, a low-cost, effective readily available open resource. The study was also to display the values of temperature and relative humidity as well as the time at which these values were recorded on the LCD screen. The language needed to program the microcontroller is user friendly since it uses a combination of C and C++. Its storage is almost space less since together with its components requires minimal space and can reduce the manpower of farming and reduce the number of greenhouse attendant and workload [11]. But majority of times such an alerting humidity and temperature fluctuation could easily go unnoticed, the user or the person in charge is sleeping or in absentia due to some unavoidable circumstances in case, it is better to log the data in a storage medium in case of such an event so that he can keep a track of the data. The purpose of this Arduino microcontroller for the study were used in programing and running the circuit. The program (code) is generated using the Arduino IDE software and fed into the microcontroller. In interfacing the Arduino Nano in the circuit, it will run it to produce the required results.
The Arduino Nano is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc. [12, 13]. The board is equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other circuits. The board has 14 digital I/O pins (six capable of PW output), 6 analog I/O pins, and is programmable with the Arduino IDE (Integrated Development Environment), via a type B USB cable. It can be powered by the USB cable or by an external 9-volt battery, though it accepts voltages between 7 and 20 volts. It is also similar to the Arduino Nano and Leonardo. A good example of the Arduino Nano microcontroller is shown in the Figure 1.
The word "Uno means "one" in Italian and was chosen to mark the initial release of Arduino Software. The Nano board is the first in a series of USB-based Arduino boards; it and version 1.0 of the Arduino IDE were the reference versions of Arduino, which have now evolved to newer releases. The ATmega328 on the board comes preprogrammed with a boot loader that allows uploading new code to it without the use of an external hardware programmer. While the Nano communicates using the original STK500 protocol, it differs from all preceding boards in that it does not use the FTDI USB-to- serial driver chip. Instead, it uses the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter [12].
Liquid-Crystal Display (LCD), shown in Figure 2, is a flat- panel display or other electronically modulated optical device that uses the light-modulating properties of liquid crystals combined with polarizers. Liquid crystals do not emit light directly, instead using a backlight or reflector to produce images in color or monochrome. LCDs are available to display arbitrary images (as in a general-purpose computer display) or fixed images with low information content, which can be displayed or hidden, such as preset words, digits, and seven- segment displays, as in a digital clock. They use the same basic technology, except that arbitrary images are made from a matrix of small pixels, while other displays have larger elements. LCDs can either be normally on (positive) or off (negative), depending on the polarizer arrangement. For example, a character positive LCD with a backlight will have black lettering on a background that is the color of the backlight, and a character negative LCD will have a black background with the letters being of the same color as the backlight. Optical filters are added to white on blue LCDs to give them their characteristic appearance [14].
DHT11, shown in Figure 4, is a temperature and humidity sensor has four pins- VCC, GND, Data Pin and a not connected pin. A pull-up resistor of 5k to 10k ohms is probed for communication between sensor and micro-controller. DHT11 sensor consists of a capacitive humidity sensing element and a thermistor for sensing temperature. The humidity sensing capacitor has two electrodes with a moisture holding substrate as a dielectric between them. Change in the capacitance value occurs with the change in humidity levels. The IC measure, process this changed resistance values and change them into digital form [15,16,17]. For measuring temperature this sensor uses a Negative Temperature coefficient thermistor, which causes a decrease in its resistance value with increase in temperature.
The SD card works on 3.3V but if you want to use them with Arduino for storing data then you will have to use a SD card module shown in Figure 5. The SD card module we have used is for the micro SD cards and it uses the FETs for level shifting and also a 3.3V regulator which converts the 5V from Arduino into the 3.3V for micro SD card. The Arduino SD card module has a socket for the SD cards on the back side and I have tested memory cards up to 128 GB which works fine. With six pins, VCC and GND for power and the other four pins for SPI communication. The other four pins are as follows MISO (Master in Slave out), MOSI (Master out slave in), SCK (System Clock), and CS (Chip Select). This SD card module uses FETs for level shifting and also has a voltage regulator which converts 5V in to 3.3V. The communication between the Arduino and the SD card module is done by using the SPI.
The brain part of the building monitoring system, the Arduino IDE (integrated development environment), is a software development environment or software application for Arduino where users can write different kind of computer programs and test. The user can write codes in IDE in a language which an Arduino understands, i.e. C, C++. The program (codes) written in IDE, when uploaded into the Arduino microcontroller determines what and how the system works. The Arduino IDE comes with a built-in code parser that studies the validity of the written codes before sending it to the Arduino. The compilation and translation work is done in IDE after checking the validity of codes. After translating the code, the IDE uploads the program to the Arduino microcontroller [20]. IDE software includes the set of different programs that are ready for being tested on the device. Just like in other programming platform, Arduino IDE can also be extended with the use of libraries; the IDE installation includes the installation of number of libraries [20]. The software page where Arduino codes are written looks like as shown in Figure
7. It has two main functions setup () function and loop () functions. The setup part is where the codes should be written so that the program runs and the loop part is where the codes should be written so that the program runs with repetition until the power off or reset button is pushed. It allows users to program and edit Arduino to do anything they like to do with it. Depending upon the feature of different boards, the IDE enables communication with Arduino board through USB [20]. The following figure shows the screen capture of Arduino IDE.
The materials were connected as follows. The Arduino Nano was interfaced to the breadboard. One jumper wire from the 5-volt pin on the Arduino was connected to the bottom channel of the breadboard. Another jumper wire from a ground pin on the Arduino was connected to the upper channel of the breadboard. DHT11 Positive pin (Vcc) to breadboard positive power rail, Negative pin (GRD) to breadboard negative power rail, Signal pin (DATA) to Arduino Analog A3.
The RTC connects to the Arduino Nano board as follows: SDA pin was connected to a 4 analog pin Arduino Nano board; SCL pin connects to a 5 analog pin Arduino Nano board; a GND pin was connected to GND pin Arduino Nano board; a VCC (5V) pin was connected to 5V Arduino Nano board pin; a SQW pin was not used. To work with RTC, the library RTC lib was included in the Arduino development environment.
CS of mini SD card module to digital pin 10 on the Arduino, SCK of mini SD card module to digital pin 13 on the Arduino, MOSI of mini SD card module to digital pin 11 on the Arduino, MISO of mini SD card module to digital pin 12 on the Arduino, VCC of mini SD card module to digital 5V on the Arduino, GND of mini SD card module to digital GND on the Arduino. Following this procedure the study introduced RTC and SD Card as shown in Figure 8.
Piezo Buzzer has two terminals; Positive and negative. The positive terminal was connected to the pin 8 at the Arduino while the negative part was interfaced with 330 Ohms resister and connected to the lower channel of the breadboard.
LCD has 16 terminals which were connected to the Arduino as: Pin 14 to Pin 7, Pin 13 to pin 6, Pin 5 to GRD, pin 4 to pin 2, Pin 6 to pin 3, Pin 11 to pin 4 as shown. The 5V pin from the Arduino was connected to the positive line on the breadboard. Also, the ground pin from the Arduino was connected to the negative part of the breadboard. For the re-set of the intensity of the LCD screen, a 10k potentiometer was interfaced to the breadboard with it middle terminal to pin 3. Potentiometer was connected to the breadboard, the positive terminal to the positive pin and the negative terminal to the ground pin to the ground pin as shown in Figure 9.
The code was generated using the computer with the appropriate Arduino IDE program and sent to the Arduino microcontroller for running the circuit. All the modules were designed and all the components assembled. The testing of each module was carried out successfully. The sensor readings were effectively retrieved in a stable environment and stored in files. The file was then imported to excel automatically using macros and the data was cleansed and formatted for a neater representation. Graphical charts were then plotted using the data which presented a nice analytical view of weather pattern based on sensor readings. Thus the testing phase was completed. This study was performed in a controlled manner.
This study sought to first design, data logging of humidity and temperature and raise a light (from an LED) and a sound alarming (from a sound buzzer). To achieve this, the components that include the Arduino Uno, resistors, LED, buzzer, RTC, SD Card module, LCD and Humidity and temperature sensor were fixed to the breadboard and connected as described in chapter three. Figure 10, shows the connections in progress. A jumper wire was connected from the 5 volts port from the Vcc port in the microcontroller chip to the positive channel of the breadboard. Another cable was grounded to the negative terminal of the breadboard from the GND port of the chip.
A piezo buzzer having two terminals, positive terminal was connected to the pin 8 at the Arduino while the negative part was interfaced with 330 Ohms resister and connected to the lower channel of the breadboard. When the power source was connected as in Figure 10, the piezo buzzer produced a single tone signal to indicate that power was flowing through it. The limit set for the Piezo Buzzer was to produce the sound alarm at the temperature greater than 00C and less than 270C.
The RTC was connected to the Arduino Nano board as follows: SDA pin is connected to a 4 analog pin Arduino Nano board; SCL pin connects to a 5 analog pin Arduino Nano board; a GND pin is connected to GND pin Arduino Nano board; a VCC (5V) pin connects to 5V Arduino Nano board pin; a SQW pin is not used. To work with RTC, the library RTC libs were included in the Arduino development environment. Upon powering of the Arduino, The RTC power LED lighted indicating that it was okay.
CS of mini SD card module was connected to digital pin 10 on the Arduino, SCK of mini SD card module to digital pin 13 on the Arduino, MOSI of mini SD card module to digital pin 11 on the Arduino, MISO of mini SD card module to digital pin 12 on the Arduino, VCC of mini SD card module to digital
LCD has 16 terminals which were connected to the Arduino as: Pin 14 to Pin 7, Pin 13 to pin 6, Pin 5 to GRD, pin 4 to pin 2, Pin 6 to pin 3, Pin 11 to pin 4 as shown. The 5V pin from the Arduino was connected to the positive line on the breadboard. Also, the ground pin from the Arduino was connected to the negative part of the breadboard. For the re-set of the intensity of the LCD screen, a 10 k potentiometer was interfaced to the breadboard with it middle terminal to pin 3. Potentiometer was connected to the breadboard, the positive terminal to the positive pin and the negative terminal to the ground pin to the ground pin as shown in Figure 11.
When the power was connected to the circuit, LCD produced a green yellow light and it displayed the details of the project followed then by the time, date, temperature and relative humidity values as in Figure 12 (Temperature, 23.6 and Relative Humidity as 95.0%).
The LED interfaced to the Arduino microcontroller were able to blink giving out the light signals upon the extreme readings, as well as the piezo buzzer producing alarming signal. The LED was also to produce light (HIGH) when the Temperature is greater than 250C. After wiring and writing the code, the program was run and the built device was successful in measuring humidity and temperature. The LCD display and serial monitor readings are shown in Figure 13.
To study the performance characteristics of the used Arduino-based humidity and temperature sensor, the test was done in The University Green House. The test was done
The research project was successfully carried out. The aim of the research project was to come up with a technique which will monitor humidity and temperature in real time, record and store the data in an SD card while displaying the parameters on the LCD screen, produce a recorded sound alarm by Piezo Buzzer and also light indication by LED. The outcome was as per the expectations of the study in comparison with the results obtained by Schwartz (2015) [11] and Rajesh Shrestha (2019)
The circuit was successfully connected and the program was sent to the Arduino microcontroller chip to run the circuit. The humidity and temperature sensor was able monitor the temperature and humidity, send the parameters to the micro controller chip for calculation of the relative humidity in real time before displaying them on the LCD screen and later to be stored into the SD Card and the alarm sound from the piezo buzzer was produced in conjunction with the LED.
The LED was also set to produce light signal in a particular set of temperature greater than 20 degrees Celsius. On the outcome, the LED produced light as it was expeced. The LCD was also expected to display the details of the project as well as the real time temperature and relative humidity values of humidity and temperature sensor. When the power was connected to the set-up, the details of the project were displayed in the LCD screen followed by the values monitored indicating that the connection was right. The intensity of the screen was expected to be controlled by the potentiometer of which the same was approved.
A single unit of the circuit was successfully assembled and only the potentiometer, LEDs, LCD and SD Card slot were not confined inside the box made for their proper working. They were able to produce the required results even when the entire circuit was closed inside the box.
H. Benyezza, M. Bouhedda, M. C. Zerhouni, M. Boudjemaa and S. A. Dura. Fuzzy Greenhouse Temperature and Humidity Control based on Arduino. In 2018 International Conference on Applied Smart Systems (ICASS), IEEE, 2008: pp. 1-6.
Arduino cc. Arduino and Genuino Products Overview (Arduino Newsletter, 2016 and https://www.arduino.cc/en/Main/ArduinoBoardUno, Accessed on October 15, 2019.)
Xiamen Emote Display CO.LTD, Specification of LCD Module LCD datasheet Modulesparkfun. [Online]. Available:https://www.sparkfun.com/datasheets/LCD. (29, Oct, 2008).
S. Rajesh. Study and Control of DHT11 Using Atmega328P Microcontroller , International Journal of Scientific & Engineering Research. IJSER (2019): 10(4).
The DHT11 is a basic, low cost, digital humidity, and temperature sensor. It measures temperature from 0-50°C with an accuracy of ±2 °C. It also measures humidity from 20-90% RH with an accuracy of ±5 %. It is available in a module form and a sensor form. We will be using the module form in this tutorial. Both of them differ in this sense that the sensor has a filtering capacitor and a pull-up resistor attached to the output pin of the sensor.
Sensor data will be displayed on a 16 x 2 LCD display. We will use Adafruit to easily operate this LCD in 4-bit mode, so we will install it in our Raspberry Pi. For this follow the following steps:
DHT11 sensor works by sensing the temperature and humidity and then transmitting the data through the output pin as serial data. We can read this data through the I/O pin on a microprocessor/microcontroller. In order to read the values you would have to go through thedatasheetof the DHT11 sensor, but for now, to keep things simple we will use a library to talk with the DHT11 sensor. We will be using the same procedure to install the DHT11 library as we did for the LCD library. We will only change the link of the Github page. Use the following commands one by one to install the DHT library.
For making building circuit you will make the following connections.Connect the LCD and DHT11 sensor to the 5V pins on the Raspberry Pi. In case you are using a module you do not need to attach a resistor on the output pin of the DHT11 sensor. If not then use a pull-up resistor of 1k. A trimmer potentiometer of 10k is added to the VEE pin of the LCD. Sensor Output Pin is Connected to GPIO17 ( 11 ) of raspberry pi.
Then next connections are pretty basic but take note of which GPIO pins you are using to connect the pins since we will need in our program. Make your connections according to the provided circuit diagram. Since we used a DHT11 module, we wired it directly to our Raspberry Pi.
Your LCD will display an intro message and then give you the current temperature and humidity values. In case of no display, check your python shell window for any errors, your connections and also adjust the potentiometer. Now you have completed this project!
This project is a full sensor suite device for a garden or your indoor plants. This has a Moisture Sensor, Temperature/ Humidity Sensor, Light Sensor and Real Time Clock that output to a 20×4 LCD I2C screen.
Want to keep a log of the climate in your greenhouse, build a humidor control system, or track temperature and humidity data for a weather station project? AOSONG’s DHT11 or DHT22 Temperature and Humidity Sensor could be the perfect fit for you!
These sensors are factory-calibrated and do not require any external components to function. With just a few connections and a bit of Arduino code, you can begin measuring relative humidity and temperature right away.
The DHT11 and the DHT22 are the two most widely used sensors in the DHTxx series. They look kind of the same and have the same pinout, but their specs are different.
Of the two, the DHT22 is more expensive and, undoubtedly, has better specifications. The DHT22 can measure temperatures from -40°C to +125°C with an accuracy of ±0.5°C, while the DHT11 can measure temperatures from 0°C to 50°C with an accuracy of ±2°C. In addition, the DHT22 sensor can measure relative humidity from 0 to 100% with an accuracy of 2-5%, while the DHT11 sensor can only measure relative humidity from 20 to 80% with an accuracy of 5%.
Despite the fact that the DHT22 is more accurate, precise, and capable of operating in a wider range of temperature and humidity, there are three areas where the DHT11 completely outperforms the DHT22 – It is more affordable, more compact, and has a higher sampling rate. DHT11 takes a reading once per second (or 1Hz sampling rate), while DHT22 takes a reading once every two seconds (or 0.5Hz sampling rate).
Despite these differences, the operating voltage of both sensors ranges from 3 to 5 volts, with a maximum current of 2.5mA (during conversion). The best part is that DHT11 and DHT22 sensors are swappable, which means that if you build your project with one, you can simply unplug it and replace it with another. Your code may need to be tweaked slightly, but the wiring remains the same!
Connecting DHT sensors to Arduino is straightforward. They have fairly long 0.1′′-pitch pins, allowing them to be easily plugged into any breadboard. Connect the VCC pin to the Arduino’s 5V and the GND pin to ground. Finally, connect the Data pin to digital pin #8.
After installing the library, copy and paste this sketch into the Arduino IDE. The following test sketch will print the temperature and relative humidity values to the serial monitor. Try out the sketch, and then we’ll go over it in more detail.
The sketch begins by including the DHT library. Following that, we specify the Arduino pin number to which our sensor’s Data pin is connected and create a DHT object.
In the loop, we use the read22(dataPin) function to read the DHT22. This function takes as a parameter the sensor’s Data pin number. When working with DHT11, you must use the read11() function; to do so, you just need to uncomment the second line.
If you’re constructing your own incubator or a similar project, you’ll need a 16×2 character LCD rather than a serial monitor to display the current temperature and humidity levels. So, in this example, we’ll also connect the LCD to the Arduino in addition to the DHT11 and DHT22 sensors.
The sketch below will display the temperature and relative humidity values on the 16×2 character LCD. This sketch is similar to the previous one, except that the values are printed on the LCD.
DHT11 is a Humidity and Temperature Sensor, which generates calibrated digital output. DHT11 can be interface with any microcontroller like Arduino, Raspberry Pi, etc. and get instantaneous results. DHT11 is a low cost humidity and temperature sensor which provides high reliability and long term stability.
In this project, we will build a small circuit to interface Arduino with DHT11 Temperature and Humidity Sensor. One of the main applications of connecting DTH11 sensor with Arduino is weather monitoring.
We will see the circuit design of DHT11 interfacing with Arduino. The DHT11 Humidity and Temperature sensor comes in two variants: just the sensor or a module.
Coming to the design, the data pin of the DHT11 Sensor is connected to the Pin 11 of Arduino. A 16 x 2 LCD display is used to display the results. The control pins of LCD i.e. RS and E (Pins 4 and 6 on LCD) are connected to pins 4 and 5 of Arduino. The data pins of LCD i.e. D4 to D7 (pins 11 to 14 on LCD) are connected to pins 0 to 3 on LCD.
NOTE: For ease of connection, we have connected the DHT11 Sensor Module at the ICSP pins of the Arduino as it provides adjacent VCC, DATA and GND pins. This type of connection is not necessary and you can connect the data pin of sensor to normal Digital I/O pins.
DHT11 is a part of DHTXX series of Humidity sensors. The other sensor in this series is DHT22. Both these sensors are Relative Humidity (RH) Sensor. As a result, they will measure both the humidity and temperature. Although DHT11 Humidity Sensors are cheap and slow, they are very popular among hobbyists and beginners.
The DHT11 Humidity and Temperature Sensor consists of 3 main components. A resistive type humidity sensor, an NTC (negative temperature coefficient) thermistor (to measure the temperature) and an 8-bit microcontroller, which converts the analog signals from both the sensors and sends out single digital signal.
DHT11 Humidity Sensor consists of 4 pins: VCC, Data Out, Not Connected (NC) and GND. The range of voltage for VCC pin is 3.5V to 5.5V. A 5V supply would do fine. The data from the Data Out pin is a serial digital data.
The following image shows a typical application circuit for DHT11 Humidity and Temperature Sensor. DHT11 Sensor can measure a humidity value in the range of 20 – 90% of Relative Humidity (RH) and a temperature in the range of 0 – 500C. The sampling period of the sensor is 1 second i.e.
A simple project is built using Arduino UNO and DHT11 Humidity and Temperature Sensor, where the Humidity and Temperature of the surroundings are displayed on an LCD display.
After making the connections, we need not do anything as the program will take care of everything. Although there is a special library for the DHT11 module called “DHT”, we didn’t use it. If you want to use this library, you need to download this library separately and add it to the existing libraries of Arduino.
The program written is based on the data timing diagrams provided in the datasheet. The program will make the Arduino to automatically read the data from the sensor and display it as Humidity and Temperature on the LCD Display.