{"id":483,"date":"2018-11-17T20:22:35","date_gmt":"2018-11-17T19:22:35","guid":{"rendered":"https:\/\/www.honey-pi.de\/?p=483"},"modified":"2020-03-09T22:18:12","modified_gmt":"2020-03-09T21:18:12","slug":"dht22-bzw-dht11-verwenden","status":"publish","type":"post","link":"https:\/\/honey-pi.de\/en\/dht22-bzw-dht11-verwenden\/","title":{"rendered":"Connect and configure the DHT22 or DHT11 correctly"},"content":{"rendered":"\n<p>In this article I show you how to connect and configure the temperature and humidity sensor DHT22 or DHT11 to HoneyPi. But first I will talk about the differences between DHT22 and DHT11.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DHT22 vs. DHT11<\/h2>\n\n\n\n<p>The following data table shows that the DHT22 (white) is more accurate than the DHT11 (blue). The temperature range of the DHT22 is -40 to 125\u00b0C, with an accuracy of \u00b1 0.5\u00b0C. The temperature range of the DHT11 is only from 0 to 50 \u00b0C with an accuracy of \u00b1 2 \u00b0C. The temperature range of the DHT22 is from -40 to 125 \u00b0C, with an accuracy of \u00b1 2 \u00b0C. This means that it does not go into the negative temperature range, which can be a disadvantage on cold winter days at the hives. The humidity range of the DHT22 measures the full range (0 to 100 %), while the DHT11 can only measure 20 to 80 % humidity.<\/p>\n\n\n\n<p>We recommend to use the DHT22 for HoneyPi, because it can also measure negative temperature values. In addition, it is more accurate than the DHT11, which is why it costs a little more than the DHT11, but is still very cheap. <a aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2QNHwSw\">Here you can buy the DHT22<\/a><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2QNHwSw\" target=\"_blank\">?<\/a>.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><strong>Category<\/strong><\/td><td><strong>DHT22<\/strong><\/td><td><strong>DHT11<\/strong><\/td><\/tr><tr><td><strong>Colour<\/strong><\/td><td>white<\/td><td>blue<\/td><\/tr><tr><td><strong>Temperature range<\/strong><\/td><td>-40 \u2013125 \u00b0C<\/td><td>0 \u2013 50 \u00b0C<\/td><\/tr><tr><td> <strong>Temperature accuracy<\/strong><\/td><td>\u00b1 0,5 \u00b0C<\/td><td>\u00b1 2 \u00b0C<\/td><\/tr><tr><td><strong>Humidity range<\/strong><\/td><td>0 \u2013 100 %<\/td><td>20 \u2013 80 %<\/td><\/tr><tr><td><strong>Humidity accuracy<\/strong><\/td><td>\u00b1 2 \u2013 5 %<\/td><td>\u00b1 5 %<\/td><\/tr><tr><td><strong>Dimensions<\/strong><\/td><td>15,1 mm x 25 mm x 7,7 mm<\/td><td>15,5 mm x 12 mm x 5,5 mm<\/td><\/tr><tr><td><strong>Operating voltage<\/strong><\/td><td>3 \u2013 5 V<\/td><td>3 \u2013 5 V<\/td><\/tr><tr><td><strong>Current<\/strong><\/td><td>2,5 mA<\/td><td>2,5 mA<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Structure of the DHT22\/DHT11<\/strong><\/h2>\n\n\n\n<p>The functions of the pins of the two sensors are identical. Pin 1 in the following figure supplies the sensor with current (3 &#8211; 5 V). Pin 2 transmits the measurement data. The third pin does not have to be connected. And the fourth pin provides grounding.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"225\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447-300x225.png\" alt=\"DHT11 und DHT22\" class=\"wp-image-486\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447-300x225.png 300w, https:\/\/honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447-768x576.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447-1024x768.png 1024w, https:\/\/honey-pi.de\/wp-content\/uploads\/IMG_20181117_143447-660x495.png 660w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>DHT22 und DHT11<\/figcaption><\/figure><\/div>\n\n\n\n<p><strong>1 =&nbsp;V<sub>CC<\/sub> (3 &#8211; 5 V)<\/strong><\/p>\n\n\n\n<p><strong>2 = Daten<\/strong><\/p>\n\n\n\n<p><strong>3 = no connection<\/strong><\/p>\n\n\n\n<p><strong>4 = Ground<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Attaching components to the Raspberry Pi<\/h2>\n\n\n\n<p>The DHT22 or DHT11 is connected to the Raspberry Pi Zero W (or Raspberry Pi 3B\/B+) as follows. I also connected a <a href=\"https:\/\/amzn.to\/2Bci6sy\">button ?<\/a> (square on the right side of the breadboard) to switch the <a href=\"https:\/\/www.honey-pi.de\/wartungsmodus-webinterface\/\">maintenance mode<\/a> on and off and to configure the sensor.<\/p>\n\n\n\n<p>Neben dem Sensor selbst und ein paar Kabel, ben\u00f6tigt ihr einen <strong>Pull-Up-Widerstand<\/strong> mit <strong>4,7 k\u03a9 &#8211; 10 k\u03a9<\/strong>. <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2ORkisS\" target=\"_blank\">Diesen k\u00f6nnt ihr hier kaufen ?<\/a>.&nbsp;Leider kann man Widerst\u00e4nde nur in gro\u00dfen Mengen online kaufen. Falls ihr nur wenige Widerst\u00e4nde ben\u00f6tigt, k\u00f6nnt ihr diese nat\u00fcrlich auch im Elektrohandel kaufen oder <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/amzn.to\/2Sa0Auv\" target=\"_blank\">als Bundle mit anderen Bauteilen&nbsp;?<\/a>.<br><br>Besides the sensor itself and a few cables, you need a <strong>pull-up resistor<\/strong> with <strong>4.7 k\u03a9 &#8211; 10 k\u03a9<\/strong>. You can buy it <a href=\"https:\/\/amzn.to\/2ORkisS\">here ?<\/a>. Unfortunately you can only buy resistors in large quantities online. If you only need a few resistors, you can also buy them in electrical stores or as a <a href=\"https:\/\/amzn.to\/2Sa0Auv\">bundle with other components ?<\/a>.<\/p>\n\n\n\n<p>A<strong>ttention: The DHT sensors do not support the 1-Wire interface. Multiple sensors cannot be connected to the same pin (such as the DS18B20). Each DHT sensor needs its own data pin.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image alignnone\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine.png\"><img loading=\"lazy\" decoding=\"async\" width=\"250\" height=\"300\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine-250x300.png\" alt=\"DHT22 Steckplan\" class=\"wp-image-492\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine-250x300.png 250w, https:\/\/honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine-768x921.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine-854x1024.png 854w, https:\/\/honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine-660x791.png 660w, https:\/\/honey-pi.de\/wp-content\/uploads\/DHT_Steckplatine.png 876w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><figcaption>DHT22 plugging chart<\/figcaption><\/figure>\n\n\n\n<p>The following figure shows how to solder one end of the <strong>resistor to pin 1 (VCC)<\/strong> of the sensor and the other <strong>end to pin 2 (data)<\/strong> together with the corresponding cables.<\/p>\n\n\n\n<figure class=\"wp-block-image alignnone\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/F5G24VWIH54GPUC.LARGE_.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"216\" height=\"300\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/F5G24VWIH54GPUC.LARGE_-216x300.jpg\" alt=\"Widerstand l\u00f6ten\" class=\"wp-image-494\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/F5G24VWIH54GPUC.LARGE_-216x300.jpg 216w, https:\/\/honey-pi.de\/wp-content\/uploads\/F5G24VWIH54GPUC.LARGE_.jpg 504w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/a><figcaption>Soldering resistor (Source: <a rel=\"noopener noreferrer\" href=\"https:\/\/www.instructables.com\/id\/Raspberry-PI-and-DHT22-temperature-and-humidity-lo\/\" target=\"_blank\">here<\/a>)<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Configuring the Sensor in Maintenance Mode<\/h2>\n\n\n\n<p>After you have flashed the <a href=\"https:\/\/www.honey-pi.de\/downloads\/\">firmware<\/a> onto the MicroSD card and powered the Raspberry Pi, wait about 90 seconds until the Raspberry Pi is powered up. Then you can press the connected <a href=\"https:\/\/amzn.to\/2Bci6sy\">button ?<\/a> to start the <a href=\"https:\/\/www.honey-pi.de\/wartungsmodus-webinterface\/\">maintenance mode<\/a>. You should now see the network HoneyPi among the available networks of your PC or Smartphone. The default password is: <strong>HoneyPi!<\/strong><\/p>\n\n\n\n<p>If you are connected to the HoneyPi network, you can go to the configuration page in your browser at <strong>http:\/\/192.168.4.1\/<\/strong> and click on &#8220;Configure&#8221;. If you haven&#8217;t done so yet, you will need to enter your <strong>Channel ID<\/strong> and <strong>Write API key<\/strong> under <strong>&#8220;ThingSpeak Settings&#8221;<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image alignnone\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"169\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-2-300x169.png\" alt=\"ThingSpeak-Daten eingeben\" class=\"wp-image-564\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-2-300x169.png 300w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-2-768x432.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-2-1024x576.png 1024w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-2-660x371.png 660w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-2.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>Enter ThingSpeak data<\/figcaption><\/figure>\n\n\n\n<p>You can find this data in your ThingSpeak account under your <strong>channel <\/strong>in the <strong>&#8220;API Keys&#8221;<\/strong> tab. If you haven&#8217;t created a ThingSpeak account or channel yet, you can follow <a rel=\"noreferrer noopener\" aria-label=\"these instructions (opens in a new tab)\" href=\"https:\/\/www.honey-pi.de\/thingspeak-konto-anlegen-und-in-der-app-konfigurieren\/\" target=\"_blank\">these instructions<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image alignnone\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"169\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-7-300x169.png\" alt=\"Channel-ID und Write-API-Key\" class=\"wp-image-497\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-7-300x169.png 300w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-7-768x432.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-7-1024x576.png 1024w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-7-660x371.png 660w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-7.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>Channel-ID and Write-API-Key<\/figcaption><\/figure>\n\n\n\n<p>Under <strong>&#8220;Connected Sensors&#8221;<\/strong> click on <strong>&#8220;Add Sensor&#8221;<\/strong> and then select the <strong>DHT11\/DHT22<\/strong>. Below you can select the <strong>ThingSpeak fields<\/strong> for temperature and humidity and enter the <strong>GPIO number (not pin number)<\/strong> to which you have connected the <strong>sensor&#8217;s data pin<\/strong>. Finally click on <strong>&#8220;Save&#8221;<\/strong> in the upper right corner.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"169\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Screenshot-1-300x169.png\" alt=\"Sensor konfigurieren\" class=\"wp-image-563\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-1-300x169.png 300w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-1-768x432.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-1-1024x576.png 1024w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-1-660x371.png 660w, https:\/\/honey-pi.de\/wp-content\/uploads\/Screenshot-1.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>Configuring sensor<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft\"><a href=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins.png\"><img loading=\"lazy\" decoding=\"async\" width=\"100\" height=\"300\" src=\"https:\/\/www.honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins-100x300.png\" alt=\"Raspberry Pi Pinbelegung\" class=\"wp-image-450\" srcset=\"https:\/\/honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins-100x300.png 100w, https:\/\/honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins-768x2304.png 768w, https:\/\/honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins-341x1024.png 341w, https:\/\/honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins-660x1980.png 660w, https:\/\/honey-pi.de\/wp-content\/uploads\/Raspberry-Pi-Pins.png 900w\" sizes=\"auto, (max-width: 100px) 100vw, 100px\" \/><\/a><figcaption>Raspberry Pi pin assignment<\/figcaption><\/figure><\/div>\n\n\n\n<p>Now your DHT11 or DHT22 should be correctly connected and configured to your HoneyPi \ud83d\ude42<\/p>\n\n\n\n<p style=\"text-align:right\"><em>Translated 11.08.2019 by JK<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I show you how to connect and configure the temperature and humidity sensor DHT22 or DHT11 to HoneyPi. But first I will talk about the differences between DHT22 and DHT11. DHT22 vs. DHT11 The following data table shows that the DHT22 (white) is more accurate than the DHT11 (blue). The temperature range of the DHT22\u2026 <span class=\"read-more\"><a href=\"https:\/\/honey-pi.de\/en\/dht22-bzw-dht11-verwenden\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":486,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[22,16,21],"class_list":["post-483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-component","tag-software-instruction","tag-sensor","tag-temperature-sensor"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"en","enabled_languages":["de","en"],"languages":{"de":{"title":true,"content":true,"excerpt":false},"en":{"title":true,"content":true,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/posts\/483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/comments?post=483"}],"version-history":[{"count":22,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/posts\/483\/revisions"}],"predecessor-version":[{"id":1701,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/posts\/483\/revisions\/1701"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/media\/486"}],"wp:attachment":[{"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/media?parent=483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/categories?post=483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/honey-pi.de\/en\/wp-json\/wp\/v2\/tags?post=483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}