arduino dht11 lcd display factory
I have the dht11 reading and printing to lcd and serial monitor.I have the dht11 controlling two relays one for temp and one for humidity.When the relay turns on the dht11 stops sending readings and freezes and stops reading? Any way I can fix that ?thanks
The output is to the serial monitor, unless you have connected an LCD. The video will show you how to open the serial monitor if you don’t already know how to.
A quick question tho, do you have a tutorial on how to connect this to a wireless transceiver?? also in theory could i connect more then one humidity detector to an arduino in order to detect humidity from more then one spot? Thank you again and i’ve subscribed!
Hi Jose, you can definitely connect more than one sensor to a single Arduino. You would basically duplicate the code, and have a separate pins read the data from each sensor. As for connecting them to a wireless tranceiver, I’m sure it’s possible, but you would probably need to use another microcontroller as a hub to transmit the data. I haven’t tried it yet though, so don’t take my word for it!
Hello, I built my first arduino project (measuring the room temperature and humidity with the DHT11) during Christmas holidays. The readings of the values were shown on the screen of my laptop. The measured room temperature was correct, but the measured humidity was much too low (about 20%RH). What can be the reason for ithe low humidity? And how can the sensor (if needed) be recalibrated?
vcc is the left one, signal the middle one and ground is the round one, in case of a 3 pin DHT11. the diagram above is not right. i was getting the same problem here.
The diagram is correct for most three pin DHT11 modules. Depending on the manufacturer, the pins on the PCB might be different though. The pins should be labelled with S for signal and “-” or “GND” ground.
See the section “Output Humidity and Temperature Readings to an LCD Display” on a desktop… If you are viewing it on mobile, the full code might not display. Hope this helps
It sounds like you want to control the heater with the DHT11 and have the readings output to an LCD too… You can use the DHT11 to control the signal to a 5V relay, similar to what’s done in this article: https://www.circuitbasics.com/build-an-arduino-controlled-power-outlet/
Then you just need to add the code to initialize the LCD, include the LiquidCrystal library, and change the “serialprint()” functions to “lcd.print(). We have another article on setting up an LCD on the Arduino if you need help with it: https://www.circuitbasics.com/how-to-set-up-an-lcd-display-on-an-arduino/
i didnt have any trouble interfacing the arduino, lcd and the dht11 sensor and my codes were quite right since when i run it, nothing’s odd in the output. but when i connect the relay,in which an ac device is connected, as an output that turns on after a couple of minutes, the temperature and humidity dislayed on the lcd becomes odd, like chinese and numbers, after some time. i checked my codes but i cant figure out whats wrong with it.
please help me.. i won’t get Alarm temperature and humidity..and show in lcd display 16×2.. and changeing temperature, humidity alarm set point HOW IS DO… PLEASE HELP ME.
Any comments about DHTLib v0.1.14 vs. v0.1.21, and why this simple Arduino sketch works in the former, but not the latter? The brief history in the cpp file header for v0.1.21 looks like it took care of a few issues so my first instinct is to use that, but again, it results in all zero readings. Anyway, if no comments, well, I’ll have to take a look through the diffs between the two versions to see what might be causing the issue.
vcc is the left one, signal the middle one and ground is the right one, in case of a 3 pin DHT11. the diagram above is not right. i was getting the same problem here.
The diagram is correct, but your particular DHT11 could have a different pinout depending on the manufacturer. The DHT11 I used is from Keyes, what type do you have?
Are you using the four pin DHT11? If so you’ll need to put a 10K Ohm resistor between the Signal line and Vcc. I just added another diagram to the post to make it a bit clearer. That may be causing your issue.
Thanks a lot, may you please help me out, I am using a Mega 2560 with a DHT11 sensor, my problem is that both temperature and humidity reading is just being reed as 0.00 and they are not changing. What might i be doing wrongly, I have even tried the code that accompanies these tutorials
This seems like a really simple setup, but I’ve been having a lot of trouble setting this up. Have there been changes to this library? I have downloaded it, but arduino still refuses to recognize dht or any of the related functions, like temperature/humidity. It had a lot of trouble with line 3, dht DHT;. Any advice?
Hi, you mentioned you added a piece of code to show the “degree” symbol,” lcd.print((char)223)”, can you tell me if the number 223 is from the ASCII table.
vcc is the left one, signal the middle one and ground is the right one, in case of a 3 pin DHT11. the diagram above is not right. i was getting the same problem here.
i am doing fire alarm system using dht and lcd and GSM sim800l how can i make argument to send message from gsm if the sensor reading is higher that the set temp and how to declare it thanks for your response
I am very happy to inform you that I fixed successfully the temp and humidity project with LCD display. I would like to subscribe but cannot find the link.Many thanks
C:\Users\mhine\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/Arduino.h:227:63: error: cannot convert ‘volatile uint32_t* {aka volatile unsigned int*}’ to ‘volatile uint8_t* {aka volatile unsigned char*}’ in initialization
Hi. I have the same issue with the same board. Did you get it to succeed in the end? I would be interested, but I feel that it may be a compatibility issue with a 3rd-party board. I have tried the exact code with other Arduinos that I have and it works just fine.
I get this same error when I try to use the Arduino 101 instead of the Uno. I think the library doesn’t support the board. I would try finding a different DHT library, there are several others out there.
I Have issues with the Arduino recognizing the file dht.h. Was told no such file exist, meanwhile I have uploaded the zip file into the Arduino IDE, which showed in the file directory.
Did you use the library in the zip file from the post, or did you download it from the Arduino.cc page? Version 0.1.21 has some issues and doesn’t appear to work. The zip file in the post is version 0.1.14, and it does work. Also, are you using the Uno, or another board? I couldn’t get the library to work on my Arduino 101…
In this language, does declaring an object variable (as in “dht DHT;”) automatically instantiate it? I am more used to other languages that would need to follow the declaration with something along the lines of “DHT = new dht(params, for, constructor);” Does this normally go without saying in C++, or is this something the Arduino environment automatically adds at the preprocessing** stage?
**: If not “preprocessing,” then whatever else Arduino parlance calls the process of converting/expanding the “Processing” (??) or “Wiring” (???) code into standard C/C++ ????
hey can you pls help me how to use rf module with the above project. i am using two arduino uno, DHT11, LCD, RF transmitter and receiver. please can u give me a code to display temperature and humidity on the receiver side lcd…
I connected the LCD and the DHT11 and copied and pasted the code. It uploaded and then I look at my LCD and all I see are white boxes on the top of the display. Can anyone help me?
I copied this exactly and got it to display temperature and humidity, but it flashes -999 for temp and -999 for humidity every other second. For example, it will display correct readings for one second, then the -999 for both readings the next second.. Flashing between the two. Any ideas why it might be doing this. I have been playing with the code, rechecking pins, etc, but I cant seem to pinpoint the problem. Any input is appreciated.
hello, i need some help, i want code for, if i m sending message from mobile (e.g. ABC) to arduino via gsm module then the values of temperature and humidity receiving specific number
I have arn Arduino y module that I am using to trgger an extractor fan in a shower. I was wondering whether this humidity sensor could be used to simply close the 5v circuit so teh fan runs on until teh humidity is below a set vaue. Is that possible simply?
Hi.recently i conduct sensor circuitry.in source code,i notice that it use \xF8 to display temperature in degree celcius.what is the function of that?
I followed the instructions exactly, wiring was good, code was an exact replica of that given. Everything was correct, but I got -999 error message every time. I was using a three pin sensor, triple checked my wiring against the diagram. I increased the delay time to 3000ms. I was definitely using the correct older version of the library. After throwing out the sensor thinking it faulty, I have since discovered that the diagram above is does not apply to every dht11, that there are some where the pins are in a different order.
What does this mean? in every other arduino program I can find that uses additional libraries, the library is called first, then the code goes straight on to initialising the variables and describing the setup. I have not been able to find any other mention of the library name mentioned twice like this. A few people have asked about this, with no answers given. I cant even search for it because I dont know what to search by.
You will get 100% humidity if you put the sensor in water and it works. Use an SHT31-D breakout board to detect humidity and temperature. I’m sure you didn’t mean you are going to submerge the sensor. The SHT31-D is more accurate and easier to install and costs about the same as the DHT11 /22 both of which really aren’t accurate at all.
Ine is set up exactly as you show. I get -999.00 for both humidity and temperature. I have 2 different sensors (both DHT11) and I get the same readings. I even set this up on an RPI 3B+ and the readings were similar. 1.0 temp and humidity. What am I doing wrong?
I can not keep my display from blinking the temp and humidity values. It displays the value but blinks back and forth to -999.00. Thanks for the help I’m new
Still getting -999.00 on both temperature and humidity with LCD. If I connects ONLY DTH11 to Arduino with serial monitor it works fine, BUT if I connect it to LCD as described above it shows -999.00 In both LCD and serial monitor. It looks like it disables the DTH11 when connected to LCD. It does not work with dely(2000); or any other value.
i don’t know why but the LCD shows me white circles and within them the text is written also the temp and humidity are a constant 0 even with the serial monitor
It’s good idea for projects. I am thinking of building my own weather unit soon. Please can someone help me with a simulation circuit that will show the response graphs of dht11 for temperature and humidity
How would you configure Celsius to Fahrenheit when doing the LCD version? I read others commenting how with out the LCD but not with the code for using the LCD.
If you do not know about DHT11, DHT22 temperature sensor and LCD (pinout, how it works, how to program ...), learn about them in the following tutorials:
The above code also work for Arduino Nano. A grandfather, who learns through this tutorial to guide his grandchild has tested this code with Arduino Nano and send us the result like below:
ArduinoGetStarted.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com, Amazon.it, Amazon.fr, Amazon.co.uk, Amazon.ca, Amazon.de, Amazon.es and Amazon.co.jp
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.
Let"s get started with this innovative Arduino tutorial where you will learn about the DHT11 Temperature and Humidity Sensor Module and how to use it with our Arduino Board to create our own weather station project at home.
The DHT11 module is a temperature and humidity sensing module that uses Digital Signal Acquisition to translate temperature and humidity to a digital reading that a microcontroller can easily read. The DHT11 has a temperature range of 0°C to 50°C, which is ideal for home or hobby use.
The DHT11 Humidity and Temperature Sensor is made up of three main parts. A resistive type humidity sensor, an NTC thermistor (to calculate temperature), and an 8-bit microcontroller that transforms the analog signals from both sensors into a single digital signal.
The DHT11 Sensor can detect humidity levels ranging from 20% to 90% relative humidity (RH) and temperatures ranging from 0 to 50°C. The sensor"s sampling time is one second.
Initially Arduino sends a high to low start signal to DHT11 with 18µs delay to ensure DHT’s detection. The Arduino then pulls up the data line and waits 20-40µs for DHT to respond. When DHT detects a start signal, it sends a low voltage level response signal to the Arduino with an 80µs delay. The DHT controller then pulls up the data line and holds it for 80µs for DHT’s arrangement of sending data.
When the data bus voltage is low, the DHT11 is sending a response signal. After that, DHT performs another data line pull-up for 80µs to prepare data transmission.
Data format that is sent by DHT to the Arduino for every bit starts with 50µs low voltage level and length of high voltage level signal decides whether data bit is0or1.
LCD modules are a critical component in many Arduino-based embedded systems. As a result, understanding how to attach an LCD module to an Arduino is crucial when designing embedded systems. Here you will learn how to connect an Arduino to a 16x2 LCD display.
The JHD162A is a 16x2 LCD module based on Hitachi"s HD44780 driver. The JHD162A has 16 pins and can be used in 4-bit or 8-bit mode (using only four data lines) or (using all 8 data lines) respectively. In this case, the LCD module is set to 4-bit mode.
Pin4(RS): Register select pin.The JHD162A has two registers namely command register and data register. Logic HIGH at RS pin selects data register and logic LOW at RS pin selects command register. If we make the RS pin HIGH and feed an input to the data lines (DB0 to DB7), this input will be treated as data to display on the LCD screen. If we make the RS pin LOW and feed an input to the data lines, then this will be treated as a command ( a command to be written to LCD controller – like positioning cursor or clear screen or scroll).
Pin15(Backlight +): Anode of the back light LED. When operated on 5V, a 560 ohm resistor should be connected in series to this pin. In arduino based projects the back light LED can be powered from the 3.3V source on the arduino board.
LCD module enable pin to the Arduino"s digital pin 11. The LCD module and the Arduino are connected in 4-bit mode in this project. This means that only four of the LCD"s digital input lines (DB4 to DB7) are used.
This method is very simple and needs fewer connections, and allows you to almost fully leverage the LCD module"s capabilities. The digital lines DB4, DB5, DB6, and DB7 are connected to the Arduino"s digital pins 5, 4, 3, and 2. The 10K potentiometer is used for controlling the contrast of the light. The current through the back light LED is limited by the 560 ohm resistor R1.
A built-in library in Arduino called LiquidCrystal.h> to enable communication between the Arduino and the LCD module is used here. This library is written for LCD modules that use the Hitachi HD44780 chipset (or a compatible chipset). This library can accommodate LCD wiring in both 4 bit and 8 bit modes.
LiquidCrystal lcd()– is a constructor used to declare a variable of its kind. Here ‘lcd’ is the variable declared using the constructor and is used to call methods defined inside the library LiquidCrystal.h
We imported the DHT and LiquidCrystal libraries in the first two lines of this code. Then we created a variable DPIN to hold the PIN to which the DHT11 data pin is attached. Next, we created a new variable DTYPE, which contains the name of the sensor"s type (DHT11 or DHT22)
Similarly, rs, en, d4, d5, d6, and d7 are the pins of the LCD whose values are assigned to the number of the pins they are attached to respectively. To set up our LCD and sensor, we now use two functions called LCD and DHT.
The setup() function is then used to start our LCD display and DHT11 sensor. Since the setup() function only runs once after the project is powered on, the syntax in it starts the LCD and sensor at the beginning.
After that, we"ll look at the loop() feature. Since we need a time interval to display the results, we added a delay of 0.5 seconds or 5000 milliseconds. Following that, we declared two float variables, ‘h" and ‘t." The letters ‘h" and ‘t" represent the percentage value of humidity and the centigrade value of temperature, respectively.
The loop() function"s if statement tests if we"re getting both humidity and temperature; otherwise, the LCD will show "Failed to read from DHT sensor!" The following lines of code simply provide the syntax for printing our result on the LCD.
DHT11 is a Temperature and humidity sensor which as the name implies is used to measure the atmospheric temperature and humidity in a particular environment or in a confined closed space. The sensor is commonly used in monitoring environmental parameters in many applications like Agriculture, Food Industries, Hospitals, Automobile, Weather Stations etc.
Today in this tutorial we will learn how to interface the popular DHT11 Temperature and Humidity sensor with STM32 microcontroller. We have already learnt the basics of STM32 board and how to use it Arduino IDE. For those who are new, the STM32 a.k.a BluePill development board,consists of the STM32F103C8T6microcontroller from ST Microelectronics. It is a 32-bit ARM Cortex M3 controller with high clock frequency suitable for high speed and power constraint application. Check all the STM32 related Tutorials here.
Before proceeding with the interface procedure lets learn few things about the DHT11 sensor. As discussed earlier, the Temperature and humidity. The sensor comes with a dedicated in-built NTC to measure temperature. It has an 8-bit microcontroller on-board to output the values of temperature and humidity as serial data through one-wire protocol. Meaning, the sensor has only one data pin through which both the temperature and humidity values can be read, thus saving pins on the microcontroller side. The sensor is also factory calibrated and hence easy to interface with other microcontrollers.
As you can see, we have used an I2C interface module to connect the LCD module to STM32. This makes the connections simple and further reduces the number of pins used on the controller side. However if you do not have this module you can also interface LCD directly STM32 by following the link.
If you have an interface module, then the circuit Connections between I2C Serial Interface Module (Fixed with 16X2 LCD Display) & STM32F103C8 is tabulated below:
We have to write a program to read the temperature and humidity value from the DHT11 senor and display it on the LCD module. Here the LCD display is connected through I2C adapter, hence we have first find the I2C address of this adapter to communicate with LCD.
3.Program for scanning the I2C device connected is present in the examples (In Arduino IDE: Files->Examples->Wire->I2C scanner wire). Before that select the board in Tools->Board->Generic STM32F103C8 Series as shown below.
Now that we know the I2C address we need to download a library for communicating to the LCD display through I2C. The I2C LCD display library can be downloaded from this link. After downloading the zip file install I2C LCD library in the Arduino IDE by sketch->import library.This library can also be used with Arduino boards for communicating with I2C LCD display modules.
Similarly in order to read the serial data from DHT11 sensor we will use the DHT11 library. Download the library as a ZIP file using the link provided and after downloading, install DHT library in the Arduino IDE by using sketch->import library. Again the same library can also be used with Arduino boards.
The complete code for this article can be found at the bottom of this page, the explanation for the same is as follows. Initially include the required libraries. Include Wire.h library for using I2C in STM32F103C8, LiquidCrystal_I2C.h for using I2C type LCD display and DHT.h for using DHT sensor functions
The value is received from the DHT11 sensor continuously. In order to get the separate values of temperature and humidity and store it in a variable following statement is used.
Once your hardware and code is ready, just the code to your hardware and you should notice your LCD displaying the welcome screen followed by the real time Temperature and Humidity values as shown below
If your displays shows nothing you can check adjusting the contrast potentiometer at the back of the I2C module. I tried varying my room temperature using an Air conditioner and found the sensor value to also vary accordingly. The AC also has an option to measure room temperature and as you can see in below image my remote displays the room temperature to be 27°C and our sensors also displays 27.3°C on the LCD which is pretty much close.
Each DHT11 sensors features extremely accurate calibration of humidity calibration chamber. The calibration coefficients stored in the OTP program memory. Internal sensors detect signals in the process in accordance with their calibration coefficients. The single-wire serial interface system is integrated to become quick and easy to use. The small size, low power, and signal transmission distance up to 20 meters makes it useful in a variety of applications and even the most demanding applications. The product is 4-pin single row pin package. Convenient connections and special packages can be provided according to users need.
My job was to automate a small greenhouse using my budding Arduino skills. The main objective of Så Ett Frö is education amongst grades 7-9. So for now we haven"t spent time calculating economic value or carbon footprint. Future iterations will hopefully allow us to tackle these engineering issues which will make the greenhouse more sustainable.
I"ve already used a soil moisture sensor so my first assignment was to integrate a temperature/humidity sensor into the greenhouse. We used the well-known DHT11 because it was available everywhere and there are two good libraries for reading data from it.
The setup is as simple as can be. VCC, GND, and a SIG are all the connections you need. In order to report both temperature and humidity, the DHT11 sensor outputs a stream of 40 bits so there are libraries to help read the raw data off whatever pin you connect. That means you can plug SIG into any pin, analog or digital. We waited until setting the LCD up to choose a pin.
To read data, we opted for the SimpleDHT because we did want to keep it simple. There"s another more standard library but they both work the same and I was able to peruse the entire source code of the SimpleDHT lib and understand what it was doing a bit more thoroughly. You can install it via the Arduino IDE by navigating through the menu as follows:
We had an LCD from the Arduino Starterkit, a backlit display with two 16-character rows. I"ll skip the connections because we followed the official LCD connection instructions without making any modifications. If you follow that tutorial you should be good. Our code below uses the pins in that tutorial, in case you"re wondering about the numbers supplied as parameters to the lcd() initialization below.
You"ll notice the official tutorial includes a potentiometer (a knob). It controls the contrast of the display. If it"s unreadable give the knob a twist and find the right setting so the characters are easy to read. While wiring our display, we tried to make it "easier" by omitting this component... it made it more difficult in the end. Be sure to include it!
After connecting everything for the LCD, we chose digital 6 for our DHT11 signal since it was still available, and lining up all the pins next to each other makes adding additional components easier.
The #include statements at the beginning reference libraries available to your Arduino IDE. Remember when we installed SimpleDHT before using the IDE? The include statement won"t work unless it was installed beforehand. The LiquidCrystal library comes pre-packaged with the Arduino IDE, so that include statement doesn"t require a download beforehand.
The dht11.read() function doesn"t return output. Instead, the & symbol in front of &temperature and &humidity means that the variables are passed by reference. That is, instead of returning new values, the read() function alters the variables we supplied. This can be destructive, but since each new loop resets them to zero, this simple code doesn"t have the possibility of data loss.
The LCD"s setCursor command is zero-based, meaning the 16th column is 15 and the 2nd row is 1. So the top-left would be setCursor(0,0) and bottom right would be setCursor(15,1).
We attempted to use the degrees symbol for the temperature, but the display output other characters instead. The symbol does happen to be in the display"s character set, but it"s good to be aware that the display doesn"t contain all the modern conveniences that make text so easy to render on a word processor or web page.
We noticed when the readings dropped to single digits that the last character in the display seemed to be printed twice. But they aren"t, the real issue is that when the shorter string is printed, it doesn"t automatically overwrite the previous string. Adding a lcd.clear() caused a small but noticeable blink in the display, so I opted to pad the output with spaces in the case that the readings change from double to single digit. This solves the visual glitch while maintaining persistence for the static labels on the display.
After everything was connected and running properly, this is what we saw on our display. We tested that it worked by cupping the sensor in our hands and blowing into them. Human breath is warm and humid so the numbers should both go up after a few breaths of air.
Each character of the LCD is actually a 5x8 matrix of booleans. That means you have 40 bits that you can manually draw within each character if you"re so inclined. 40 bits x 16 x 2 = 1280 bits total. If you are willing to sit and hand-code a drawing, you can make a fairly high-resolution picture. You could also make manual drawings of any character you want if it"s not included in the default character set, then just reference them using variables.
The display has a decent refresh rate, so you can achieve a few levels of brightness by redrawing a few times per second. But like all LCDs it has some "memory" between each pass so don"t expect the same amount of precision that you can achieve with PWM on a LED.
Since temperature and humidity are two of the main environmental factors, they also have an impact on human lives. As a result, measuring them is critically vital. Application areas for temperature measuring range from assessing the condition of rivers and streams to ensuring the accuracy of sterilizing processes. Measuring humidity is crucial for both managing and forecasting indoor and outdoor weather. Controlling humidity is crucial in places like homes, warehouses, and industries. To keep this all in mind we have decided to make aPortable “Temperature/Humidity Sensor” with LCD & Arduino.
Only the Arduino, the provided sensor, the LCD, and a very small number of readily accessible electronic components are needed to build this portable temperature/humidity sensor with LCD and Arduino. After that, you must complete the following steps:
First, you need to install Arduino IDE Software from its official website Arduino. Here is a simple step-by-step guide on “How to install Arduino IDE“.
Before you start uploading a code, download and unzip the following libraries at /Progam Files(x86)/Arduino/Libraries (default),to use the sensor with the Arduino board. Here is a simple step-by-step guide on “How to Add Libraries in Arduino IDE“.
Now that we have made the connections and uploaded the code, it’s time to test the results. For this, power your Arduino. You will see the readings coming to the LCD screen.
We first have included the required libraries that need to be there to communicate to the sensor and LCD. After this, we define the Arduino pin that is connected to the sensor. Then we make an LCD object and define Arduino pins that are connected to the LCD. The DHT object instance must then be created with the correct DHT type and connection. We utilize the function for this. DHT(pin,type) . We called the sensor dht in this example.
In the void loop, after giving some delay, By using the function lcd.setCursor(), we set the cursor to display reading on an LCD to column 0 and line 1. Given that counting starts at 0, line 1 is the second row. We then provide dht.readHumidity(); dht.readTemperature() functions to read the humidity and temperature. We stored their float values. Next, we look to see if the temperature or humidity readings are unusual. The LCD then shows the message “error” in that situation. A value’s status as a Not-a-Number is determined by theisnan ()function. In the event that the value is NaN, this method returns true. If not, false is returned. If the values are normal, they will be displayed on the LCD screen.
We need the temperature and humidity measurement to understand the environmental conditions for a given zone. We might use google or any whether predicting site for the same but often they do not show the real time data and most of the data is averaged out and often based on predicting algorithms. We might also need to measure temperature and humidity level of a closed chamber manufacturing process where controlling the temperature and humidity of a process is of utmost importance. In this project we will be using Arduino Uno and DHT11 Temperature and Humidity Sensor to measure the ambient temperature and humidity in the air and display the measured values on a 16x2 LCD screen.
Now coming on to the working of the DHT11 sensor. It has an NTC Thermistor and a humidity measuring component on a PCB in it.For measuring humidity, they use the humidity sensing component which has two electrodes with moisture holding substrate between them. So as the humidity changes, the conductivity of the substrate changes or the resistance between the electrodes changes. This change in resistance is measured by the PCB connected to it and then is transmitted for reading to the controller. For measurement of Temperature it employs NTC (Negative Temperature Coefficient) Thermistor which has, as evident by name, a negative temperature coefficient, it means its resistance will decrease with increase in temperature and increase with decrease in temperature.
The PCB also measure this change in resistance and transmit the data to the microcontroller board in digital format.DHT11 gives us very precise value of humidity and temperature and ensures high reliability and long term stability.The temperature range of DHT11 is from 0 to 50 degree Celsius with a 2-degree accuracy. Humidity range of this sensor is from 20 to 80% with 5% accuracy. The sampling rate of this sensor is 1Hz .i.e. it gives one reading for every second. DHT11 is small in size with operating voltage from 3 to 5 volts. The maximum current used while measuring is 2.5mA.
DHT11 module works on serial communication i.e. single wire communication. This module sends data in form of pulse train of specific time period. Before sending data to arduino it needs some initialize command with a time delay. And the whole process time is about 4ms. A complete data transmission is of 40-bit and data format of this process is given below:
For displaying the data received, we have used 16*2 LCD display. You can also use the serial monitor of the Arduino to display the readings coming from sensor on your monitor screen.
Here we can see that the DHT11 sensor module is connected to Arduino by connecting Pin 1 (Vcc) to 5V power pin, Pin 3 (GND) is connected to GND of Arduino and Pin 2 (DATA) is connected to the Digital pin 2. For connecting 16*2 LCD screen connect VSS to GND, VDD to 5V supply, VO to the output of potentiometer to vary the contrast of the characters, RS to pin 0 on Arduino, RW to GND, E to pin 1 on Arduino. Now data lines D4, D5, D6 and D7 are connected to pin 8, 9, 10 and 11 pins respectively. Connect A to 5V supply via 220Ωresistor and connect K to GND.
LCD is connected to Arduino in 4 bit mode i.e. the Arduino and LCD are communicating in 4 bit at a time which is bit slower than 8 bit communication but as our DHT 11 has a sampling freq. of 1 Hz it will work just fine also it means less number of connecting wires and improved reliability.
To write the Arduino DHT11 sensor interfacing code, we start with including the two libraries for LCD display and DHT11 sensor so that we don’t have to worry about reading and separating the data from the data stream coming through the sensor.
The LCD will light up only when the all my components are located in the bottom right of the breadboard. Why am I not able to use the entire breadboard for my circuit?
DHT11 is one of the most used Temperature and Humidity Sensor. It is cheap, compact and provides a reliable data, it is thebest for a DIY electronics project.
The DHT11 can measure Temperature between 0 to 50° C with ±2 °C accuracy. It can measure Humidity between 20 to 80% with ±5% accuracy. The sampling rate of DHT11 is 1 HZ which is 1 reading per second. The Operating Voltage of DHT11 is 3 to 5V and uses a 2.5 mA of maximum current while operating.
The DHT11 Temperature and Humidity 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.
The Humidity is measured by the electrical resistance between two electrodes. The humidity sensing component of the DHT11 is a moisture holding substrate (usually a salt or conductive plastic polymer) with the electrodes applied to the surface. The ions are released by the substrate as water vapor is absorbed by it, which in turn increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity.