AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Make sure you have the 3 libraries noted #include Here is some simple code to output the DHT11 to a 16×2 LCD (with built in controller) If you have any questions about how to set up the DHT11 humidity and temperature sensor on your Arduino, just leave a comment below and I will try to answer it… And if you like our tutorials, please subscribe! Also, feel free to share this if you know anyone else that might find it helpful! You can watch how to set up the DHT11 and see how it works in this video: To see an example of using the DHT11 sensor outputs as variables in other functions, check out our article How to Set Up an Ultrasonic Range Finder on an Arduino, where we use the DHT.humidity and DHT.temperature variables in a formula that improves the accuracy of an ultrasonic range finder. You can add this to existing programs and use DHT.humidity and DHT.temperature as variables in any function. What if you don’t want to output the actual humidity and temperature readings, but need them to calculate or control other things? The code below is the bare minimum needed to initialize the sensor. To do this, first follow our tutorial on How to Set Up an LCD Display on an Arduino, then upload this code to the Arduino: #include Display Humidity and Temperature on an LCDĪ nice way to display the humidity and temperature readings is on a 16X2 LCD. If you don’t want to use pin 7 for the data signal, you can change the pin number in line 5 where it says #define DHT11_PIN 7. You should see the humidity and temperature readings displayed at one second intervals. ZIP Library and select the DHTLib.zip file.Īfter it’s installed, upload this example program to the Arduino and open the serial monitor: #include It’s easy to install, just download the DHTLib.zip file below and open up the Arduino IDE. It has all the functions needed to get the humidity and temperature readings from the sensor. Connecting a Three Pin DHT11: Connecting a Four Pin DHT11:ĭisplay Humidity and Temperature on the Serial Monitorīefore you can use the DHT11 on the Arduino, you’ll need to install the DHTLib library. Wiring the DHT11 to the Arduino is really easy, but the connections are different depending on which type you have. Here are the pin outs for both versions: How to Set Up the DHT11 on an Arduino The PCB mounted version is nice because it includes a surface mounted 10K Ohm pull up resistor for the signal line. One type has four pins, and the other type has three pins and is mounted to a small PCB. There are two different versions of the DHT11 you might come across. A 10K Ohm pull-up resistor is needed between the signal line and 5V line to make sure the signal level stays high by default (see the datasheet for more info). Power comes from separate 5V and ground wires. The DHT11 uses just one signal wire to transmit data to the Arduino. With the plastic housing removed, you can see the electrodes applied to the substrate:Īn IC mounted on the back of the unit converts the resistance measurement to relative humidity. It also stores the calibration coefficients, and controls the data signal transmission between the DHT11 and the Arduino: To learn more about how thermistors work and how to use them on the Arduino, check out our Arduino Thermistor Temperature Sensor Tutorial. The DHT11 measures temperature with a surface mounted NTC temperature sensor (thermistor) built into the unit. Higher relative humidity decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The DHT11 detects water vapor by measuring the electrical resistance between two electrodes. The humidity sensing component is a moisture holding substrate with electrodes applied to the surface. How the DHT11 Measures Humidity and Temperature At 100% RH, condensation occurs, and at 0% RH, the air is completely dry. Relative humidity is expressed as a percentage. The formula to calculate relative humidity is: Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated. The saturation point changes with air temperature. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew. the saturation point of water vapor in air. Relative humidity is the amount of water vapor in air vs. Here are the ranges and accuracy of the DHT11:ĭHT11 Datasheet What is Relative Humidity? It includes all of the parts, wiring diagrams, code, and step-by-step instructions for 58 different robotics and internet of things projects that are super fun to build! The 3-in-1 Smart Car and IOT Learning Kit from SunFounder has everything you need to learn how to master the Arduino.
0 Comments
Read More
Leave a Reply. |