How to use DHT22 AM3302 Temperature and Humidity sensor with Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 มิ.ย. 2024
  • I will reply to all Subscriber's 🔔 questions. So make sure to Subscribe.😊
    In this video you will learn How to use DHT22 Temperature and Humidity sensor with Arduino code.
    **Purchase DHT22 from **
    Amazon USA: amzn.to/3mK2EKo
    Amazon Canada: amzn.to/3wO3FFA
    Amazon Europe (All Europe): amzn.to/3mK2EKo
    Download the code: bit.ly/rjx-dht22
    ** Purchase Arduino Start Kit **
    Amazon USA: amzn.to/3z88F9G or just UNO board amzn.to/3aY7KOL
    Amazon Canada: amzn.to/31an88J or just UNO board amzn.to/3pYxSNN
    Amazon Europe (all Europe): amzn.to/3pMCHge or Just UNO board amzn.to/2PgGItD
    AliExpress: s.click.aliexpress.com/e/_9uc7Xe
    Banggood: www.banggood.com/custlink/3GD... or UNO board www.banggood.com/custlink/vKm...
    eBay: ebay.us/B1JWLi
    ***** Purchase Authentic Arduino Uno from ***
    Amazon USA: amzn.to/2KApAwK
    Amazon Canada: amzn.to/37LZ8sW
    All Europe Amazon: amzn.to/36YDSzn
    If you wan to DHT22 to show temperature on 7-Segment Display, watch my other video:
    • Using DHT22 Temperatur...
    00:00 Start
    00:44 Introduction
    03:48 Wiring Explained
    04:16 Downloading the library
    06:34 Code explained
    12:50 Demonstration
    Tutorial by Ahmad Shamshiri form Canada
    ****************************
    Arduino Step by Step Course (over 100 lectures) Starts here • Lesson 00 What is Ardu...
    Learn Arduino in 30 Minutes (video): robojax.com/L/?id=135
    ****************************
    If you found this tutorial helpful, please support me so I can continue creating contents like this. Here is PayPal link paypal.me/robojaxTV
    Follow me on Facebook robojaxTV
    Follow me on Twitter: / robojaxtv
    Follow me on Instagram: / robojax
    Tutorial by Robojax.com
    Get other projects code and learn Arduino
    robojax.com/learn/arduino
    #robojax #robojax_temperature
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 127

  • @sconescon6691
    @sconescon6691 5 ปีที่แล้ว +5

    Out of every Arduino tutorial out there, from every site across the board - and I've been to em all (or so it feels like, it's a lot!!) - you are BY FAR, the best at explaining things. Thank you so much and please carry on :))

    • @robojax
      @robojax  5 ปีที่แล้ว +1

      You are very welcome. I am please that you found my tutorials helpful. I appreciate sharing my channel with your friends.

  • @ronnytoro3
    @ronnytoro3 2 ปีที่แล้ว +2

    Awesome page ! thanks for all your advices and information that you share!

  • @aminnonplus
    @aminnonplus 2 ปีที่แล้ว +2

    Thanks pal ! Love from France

  • @projardgreen2568
    @projardgreen2568 ปีที่แล้ว

    explain more videos like this, the code in detail, I subscribed because of how detailed explenation was.

  • @gamestv4875
    @gamestv4875 5 ปีที่แล้ว

    Good tutorial.Worked flawlessly.
    Thanks

    • @robojax
      @robojax  5 ปีที่แล้ว

      You are welcome.

  • @tonysicily2687
    @tonysicily2687 3 ปีที่แล้ว +1

    Awesome video,
    No music
    Clean video
    Nice VO
    Lots of info
    Thank you,
    Subscribed, Liked and Saved

    • @robojax
      @robojax  3 ปีที่แล้ว

      Much appreciated!

  • @UpSpider
    @UpSpider 6 ปีที่แล้ว

    Amazing video. Really helpful.

    • @robojax
      @robojax  6 ปีที่แล้ว

      You are welcome.

  • @aminkelate
    @aminkelate 3 ปีที่แล้ว +1

    Thank you bro, you make my day..

    • @robojax
      @robojax  3 ปีที่แล้ว

      My pleasure

  • @truthseeker7775
    @truthseeker7775 5 ปีที่แล้ว

    Thank you so much Robojax. What a great video. I wish you had continued on to tell us how to write the code so that the sensor could turn on or turn off a light or motor when the temperature reached or declined to a certain temperature.=====================================================================================

    • @robojax
      @robojax  5 ปีที่แล้ว

      You are welcome. I will make video on that as well.

  • @alnoorratansi9364
    @alnoorratansi9364 4 ปีที่แล้ว

    as always I love watching your videos, how do handle negative temp. what changes do you have make in the code ?

    • @robojax
      @robojax  4 ปีที่แล้ว

      thank you very much. For negative temperature, it should just work fine. No change it needed.

  • @danmusiceasy
    @danmusiceasy ปีที่แล้ว

    Great tutorial, very clearly explained! I just made my first air monitor :) Do you have any tutorials on particle sensors and VOC sensors, or plan to do any in the future?

    • @robojax
      @robojax  ปีที่แล้ว

      I am glad you found it useful. This was the first time I heard VOC sensors. I just checked it, very interesting sensor for Air quality. I might make videos in the future. thanks

  • @cheikhanoumar9788
    @cheikhanoumar9788 2 ปีที่แล้ว

    thank you very match

    • @robojax
      @robojax  2 ปีที่แล้ว

      You are welcome. The best thank you for me is to subscribe to my channel. Thanks

  • @videotronicmaker
    @videotronicmaker 4 ปีที่แล้ว

    Thank you.

    • @robojax
      @robojax  4 ปีที่แล้ว

      You are welcome.

  • @allan6952
    @allan6952 3 ปีที่แล้ว

    Thank you very much !! I have a question. Do you know the difference between the Temperature value and the Heat index value ? Which one is more accurate ?

    • @robojax
      @robojax  3 ปีที่แล้ว +1

      You are welcome. Please see the details for heat index from National Weather Services of USA: www.weather.gov/ama/heatindex#:~:text=The%20heat%20index%2C%20also%20known,sweat%20to%20cool%20itself%20off.

  • @michaelmotis3580
    @michaelmotis3580 3 ปีที่แล้ว +1

    Thank you bro!! good job! it does work for me

    • @robojax
      @robojax  3 ปีที่แล้ว

      You're welcome!

  • @patrickduhirwenzivugira4729
    @patrickduhirwenzivugira4729 5 ปีที่แล้ว +1

    Thank you for the video. Any idea how I can add a wifi module and send the data read as REST API ?

    • @robojax
      @robojax  5 ปีที่แล้ว +1

      You are welcome. I would have to make video that. I have no tested code or components in hand.

  • @jamesdumancas9597
    @jamesdumancas9597 4 ปีที่แล้ว

    Hi sir thanks for this helpful video i just wanna ask if the dht 22 can go faster than every 2 seconds loop?

    • @robojax
      @robojax  4 ปีที่แล้ว +1

      Because it measure humidity, it makes it to read slowly and you will not get accurate data less than 2sconds. See page 9 robojax.com/learn/arduino/robojax-DHT22_manual.pdf if you just need temperature measurement, then use another sensor and there are a lot other sensors that can read much faster .

  • @fpt380
    @fpt380 5 ปีที่แล้ว +1

    Hello . Thank you for your nice video .
    I have a question:
    Are the sensors like LM35 and DH11-22 accurate and reliable?
    Are it need to calibrate?
    thank you

    • @robojax
      @robojax  5 ปีที่แล้ว

      You are welcome. I have not compared it with LM35. Because this is digital while LM35 is analogue, this should be much better.
      No calibration is needed. Datasheet/manual has been provided.

    • @fpt380
      @fpt380 5 ปีที่แล้ว

      Robojax thank you for explain

  • @JohnWick-id6pk
    @JohnWick-id6pk 4 ปีที่แล้ว

    Hi, thank you for the informative video. What do you think would be the cheapest cable tu use the sensor at 3 meters from Raspberry ? Thanks

    • @robojax
      @robojax  4 ปีที่แล้ว +1

      You are welcome. This module doesn't need much power. Any wire will work.

    • @JohnWick-id6pk
      @JohnWick-id6pk 4 ปีที่แล้ว

      Nice ! So just a basic USB wire is fine ? Thanks

  • @kikoinvents
    @kikoinvents 5 ปีที่แล้ว

    tanks bro

    • @robojax
      @robojax  5 ปีที่แล้ว

      You are welcome.

  • @fatimamgaedeh4082
    @fatimamgaedeh4082 3 ปีที่แล้ว

    Hello, great video and tutorial. My question is, when I have to use a resistor?
    So, if I want to connect 4 dht22 sensors together when I need a resistor?

    • @robojax
      @robojax  3 ปีที่แล้ว +1

      Hello Fatima, you don't need resistor if you have the module shown in the video. I have the code on our website robojax.com. I added the link to that page on the same page where you get the code. the link to code page is below this video in the description. good luck.

    • @fatimamgaedeh4082
      @fatimamgaedeh4082 3 ปีที่แล้ว

      @@robojax Thank you so much, appreciate your reply.

  • @wesleywalsh4025
    @wesleywalsh4025 5 ปีที่แล้ว

    Hello Robojax, Is it possible to have more than one DHT22 in the same project? Thanks

    • @robojax
      @robojax  5 ปีที่แล้ว

      Yes. I will going to make a video on that but if you watch this video, it should work for you. th-cam.com/video/c90NszbNG8c/w-d-xo.html

  • @alialvi419
    @alialvi419 4 ปีที่แล้ว

    kindly tell me that while you run DHT tester ,your uno borad is connected or not?

    • @robojax
      @robojax  4 ปีที่แล้ว

      Of course it is connected. I connected to USB but you can connect it ot 6V to 15V power adapter .

  • @dtn2529
    @dtn2529 ปีที่แล้ว

    The DHT22 sensor enables temperature measurement in the range of -40 to 80°Celsius
    Does your program accept this? I.e it also shows negative temperatures?

    • @robojax
      @robojax  ปีที่แล้ว

      of course it does. if you get incorrect reading, either you have not selected the sensor in the code or there is wiring issue. I am assuming you have followed the instruction and installed the library. You may use the code for DHT22 from this video ignoring the WiFi feature th-cam.com/video/JXCcmZUmzy8/w-d-xo.html

    • @dtn2529
      @dtn2529 ปีที่แล้ว

      Thank you very much for your reply. It is OK.
      Otherwise, you have very good, clear and understandable instructions.
      (Sory,google translation)
      @@robojax

  • @fauzanfikri4340
    @fauzanfikri4340 2 ปีที่แล้ว

    Hi robojax, can i use this sensor and a mega arduino stand alone without connecting it to a pc ?

    • @robojax
      @robojax  2 ปีที่แล้ว

      when we say Arduino it means stand alone. We use PC to just upload it after that we don't need the PC. yes this module works with any Arduino board. including Arduino Mega. Here is Arduino Step by step course with 100 video and codes Arduino Step by Step course that starts here th-cam.com/video/-6qSrDUA5a8/w-d-xo.html

  • @sreejithunnikrishnan8484
    @sreejithunnikrishnan8484 3 ปีที่แล้ว

    should we connect a resistor of 10k if its an Arduino mega 2560? or jus direct connection

    • @robojax
      @robojax  3 ปีที่แล้ว

      you made me worry with your question. my videos are totally different. I never leave the details out. if you watch it fully, your project should work. So after watching the "wiring explained" section, I saw that I have shown it. you don't need anything expect the wires.

    • @sreejithunnikrishnan8484
      @sreejithunnikrishnan8484 3 ปีที่แล้ว +1

      @@robojax
      Ok thanks

  • @jasperblase1374
    @jasperblase1374 2 ปีที่แล้ว

    I know this is a bit of late but when I see the humidity readings on your video, it's very low. Is your room dry or just error from the sensor?

    • @robojax
      @robojax  2 ปีที่แล้ว

      I don’t remember what was the humidity but this sensor is very accurate.

  • @iamsalia
    @iamsalia 2 ปีที่แล้ว

    Please I would like to know if this temperature sensor can work on poultry farms. Thank you

    • @robojax
      @robojax  2 ปีที่แล้ว +1

      Hello, it just senses the temperature and humidity and does not care about environment. Just make sure dirt does not cover it.

  • @shecterelectric432
    @shecterelectric432 4 ปีที่แล้ว

    I have this error when I trie to run it. I t says ´error compling for board Arduino/genuino uno.´ I am using an Arduino uno board with the 1.8.11 version. Do you think you can help me?

    • @robojax
      @robojax  4 ปีที่แล้ว +1

      it means you have not selected the right COM Port for your Arduino. when your Arduino is connected click on Tools->Port and select another port and the try to upload.

  • @rianhamman6187
    @rianhamman6187 5 ปีที่แล้ว

    The DTH22 sensor isn't working with this setup for me, the sensor is pulling to much power from my arduino, any idea why it would (in the exact same setup as the video)

    • @robojax
      @robojax  5 ปีที่แล้ว

      either your are connecting the wires incorrectly or the sensor is bad. The only way to know is to connect another sensor.

  • @mohdfarezsamin1493
    @mohdfarezsamin1493 5 ปีที่แล้ว

    Possible to provide the code if a turbidity sensor is used instead of temperature & humidity? my code doesn't seem to work.

    • @robojax
      @robojax  5 ปีที่แล้ว

      I would have to have the device, then I would be able to say it it works or not. i just add it to my "to do " list.

  • @mohammednidal5206
    @mohammednidal5206 3 ปีที่แล้ว

    can we code this along with autonomous obstacle avoiding code??

    • @robojax
      @robojax  3 ปีที่แล้ว

      Yes you can.

  • @ezstudio3d
    @ezstudio3d 5 ปีที่แล้ว

    I getting "Failed to read from DHT sensor!". I am using the dht22 but mine doesn't have the black and adapter and I use a 10k omh resistor to 5v any suggestions ?

    • @farenhartman5559
      @farenhartman5559 5 ปีที่แล้ว

      I get the same thing! Did you get a solution for this problem?

    • @ezstudio3d
      @ezstudio3d 5 ปีที่แล้ว

      I did, I bought one with the little black thing that has the resistor and maybe some thing extra www.amazon.com/gp/product/B01N9BA0O4/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

  • @Fubo777
    @Fubo777 3 ปีที่แล้ว

    Would it be possible to use two of these sensors simultaneously with Arduino?

    • @robojax
      @robojax  3 ปีที่แล้ว +1

      Hello, yes you can use the idea from this video th-cam.com/video/L6ekl2ABcuY/w-d-xo.html to use two or more of this and here is how you can see it temperature from this sensor on mobile phone th-cam.com/video/1A4-6hDARQc/w-d-xo.html

    • @Fubo777
      @Fubo777 3 ปีที่แล้ว

      @@robojax Thank you very much. I'm thinking of making a simple weather station that shows indoor and outdoor humidity and temperature

  • @ilhamrahmatmuharam8501
    @ilhamrahmatmuharam8501 4 ปีที่แล้ว

    when i running this program and open serial monitor "Failed to read from DHT sensor!" you have an idea ? i have try with different device but same result

    • @robojax
      @robojax  4 ปีที่แล้ว

      it means you have either incorrect wiring or dead module.

  • @sachinsadhale1789
    @sachinsadhale1789 5 ปีที่แล้ว

    Plz name the library to be included there are many dht Libraries

    • @robojax
      @robojax  5 ปีที่แล้ว

      I have provided the library from original source and from my own with my own code. I mentioned the link in the video and have provided the link under the video description.

  • @zhouri7758
    @zhouri7758 5 ปีที่แล้ว

    Hello
    Can I take this code and make some changes to work with DHT11

    • @robojax
      @robojax  5 ปีที่แล้ว

      have you looked at the code? there is DHT11. just comment (select) the right sensor.

    • @zhouri7758
      @zhouri7758 5 ปีที่แล้ว

      @@robojax no I have not
      Thanks

    • @arjaysibug843
      @arjaysibug843 5 ปีที่แล้ว +1

      just the same.
      22 is just an upgraded version

  • @jrsbrothers6724
    @jrsbrothers6724 2 ปีที่แล้ว

    if the distance of the sensor is 20 meters with the arduino, can the sensor work?

    • @robojax
      @robojax  2 ปีที่แล้ว

      I did the search, found the information for you with the link from manufacturer. read the datasheet and id you did not find, it contact the manufacturer. Use ESP32 or ESP8266 to read it over wifi. Search my channel. Here is how to find Specific TH-cam Video in a channel bit.ly/findTH-camVideo

  • @ELKopps11
    @ELKopps11 ปีที่แล้ว

    Mine fails. In troubleshooting if found that "nan" is in temp_hum_val[0] and 0 is in temp_hum_val[1].

    • @robojax
      @robojax  ปีที่แล้ว

      Nan means wiring is incorrect

  • @divakarans8015
    @divakarans8015 3 ปีที่แล้ว

    Hi, why we had resistor in data pin

    • @robojax
      @robojax  3 ปีที่แล้ว

      Hi, I have replied to this in one the comments earlier. Please scroll down.

  • @azwaqar
    @azwaqar 5 ปีที่แล้ว

    i get this error "Error compiling for board Arduino/Genuino Mega or Mega 2560" how to solve it????

    • @robojax
      @robojax  5 ปีที่แล้ว

      port problem. Try to select the right port.

    • @azwaqar
      @azwaqar 5 ปีที่แล้ว

      Thanks for reply the error was due to missing library I download it and error disappear thank you

    • @Paul7mac
      @Paul7mac 4 ปีที่แล้ว

      @@azwaqar which library i have the same problem

  • @divakarans8015
    @divakarans8015 3 ปีที่แล้ว

    Hi, I'm using Dht 22, & I'm receiving *Nan%* errors, pls solve

    • @robojax
      @robojax  3 ปีที่แล้ว

      bad wiring

  • @mikahjbvf8166
    @mikahjbvf8166 4 ปีที่แล้ว

    Hi.. why did i get 'Failed to read from DHT sensor!' ?

    • @robojax
      @robojax  4 ปีที่แล้ว +1

      Wiring problem. Check all 3 wires.

    • @mikahjbvf8166
      @mikahjbvf8166 4 ปีที่แล้ว

      @@robojax ok.. thank you.. i'll try

  • @scottwaters7286
    @scottwaters7286 4 ปีที่แล้ว

    Why do I get "Sync timeout"?

    • @robojax
      @robojax  4 ปีที่แล้ว

      I haven't see it but google search showed this forum.arduino.cc/index.php?topic=91569.0

  • @chawinchokchaimongkolkij563
    @chawinchokchaimongkolkij563 5 ปีที่แล้ว

    DHT22' was not declared in this scope

    • @robojax
      @robojax  5 ปีที่แล้ว

      You have not downloaded the library. Make sure to download and add it to the Arduino library folder. or if you have included the library make sure to uncomment the line // #define DHTTYPE DHT22 // DHT 22
      by removing the // from the beginning of the line. Watch video for instrcution

  • @humanfromthefuture4430
    @humanfromthefuture4430 4 ปีที่แล้ว

    failed to read dht sensor what happenned

    • @robojax
      @robojax  4 ปีที่แล้ว

      incorrect wiring, bad pin connection or bad modue.

  • @stelaririna
    @stelaririna 2 ปีที่แล้ว

    Why does it read that my humidity 99.9% and temperature 129.9°C.
    And both don’t change no matter what

    • @robojax
      @robojax  2 ปีที่แล้ว

      It could be wiring problem

    • @stelaririna
      @stelaririna 2 ปีที่แล้ว

      @@robojax and if it’s not a wiring problem, what other cause can it be?

    • @robojax
      @robojax  2 ปีที่แล้ว

      Not sure, perhaps wrong model is selected in code.

    • @stelaririna
      @stelaririna 2 ปีที่แล้ว

      @@robojax can the sensor be broken? Cause I checked the wires and the voltage and amps are good, the code is good, I picked the right model, but the reading won’t change no matter what I do

    • @robertomalatesta6604
      @robertomalatesta6604 2 ปีที่แล้ว

      @@stelaririna na You might try and reload the bootloader. Then run the Blink scketch and if it cycles a few times only or not at all, the board might have gone astray.

  • @aswathy1609
    @aswathy1609 ปีที่แล้ว

    code pls

    • @robojax
      @robojax  ปีที่แล้ว +1

      I just watch the video . You skipped the first 40 seconds where I mentioned how to get code.

  • @gabrielebarbaraci3161
    @gabrielebarbaraci3161 9 หลายเดือนก่อน

    code is wrong it says F1 is not declared

    • @robojax
      @robojax  9 หลายเดือนก่อน

      you did not folow the instuction or wrong library is used.

  • @aniszed3641
    @aniszed3641 5 ปีที่แล้ว

    thanck you so much

    • @robojax
      @robojax  5 ปีที่แล้ว

      You are welcome.

  • @jrsbrothers6724
    @jrsbrothers6724 2 ปีที่แล้ว

    if the distance of the sensor is 20 meters with the arduino, can the sensor work?

    • @robojax
      @robojax  2 ปีที่แล้ว

      Yes the distance of communication is 20m mentioned here www.aosong.com/en/products-22.html

    • @jrsbrothers6724
      @jrsbrothers6724 2 ปีที่แล้ว

      @@robojax no need capasitor?

    • @robojax
      @robojax  2 ปีที่แล้ว

      why you ask about resistor? if you have this sensor, just watch and you should get all answers.

    • @jrsbrothers6724
      @jrsbrothers6724 2 ปีที่แล้ว

      @@robojax because the store that sells the sensor recommends if the distance is more than 2 meters requires a capacitor

    • @robojax
      @robojax  2 ปีที่แล้ว

      Datasheet is always the most correct information because that is from manufacturer.