Elegoo Arduino Uno R3- “Temperature and Humidity Monitor”

By: Conner Elling, Reporter

In this article, you will hopefully learn how to create a working temperature and humidity monitor using the Elegoo Arduino Uno R3. The pieces you will need for this are:

  1. DHT11 Temperature module or DHT22
  2. Elegoo Arduino Uno
  3. Breadboard (if you are using male to male jumper wires)
  4. Jumper Wires

Set-Up:

I am doing this with female to male jumper wires so I do not need the breadboard. First off you need to connect a jumper wire to the very left pin of the DHT11 to 5v on the Arduino. This connects it to the power. Next, you need to connect a jumper wire from the second pin on the DHT11 to pin 7 on the Elegoo Arduino. That connects it to the data. And lastly, connect a jumper from the third pin on the DHT11 to the ground in the power section near 5v.

Code: You can copy and paste the code into the Arduino editor and it should work when you plug in your Arduino.

/* How to use the DHT-22 sensor with Arduino uno
   Temperature and humidity sensor
*/

//Libraries
#include <DHT.h>;

//Constants
#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino


//Variables
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

void setup()
{
  Serial.begin(9600);
  dht.begin();
}

void loop()
{
    delay(2000);
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(10000); //Delay 2 sec.
}

   RELATED ARTICLES:
https://create.arduino.cc/projecthub/mafzal/temperature-monitoring-with-dht22-arduino-15b013?ref=tag&ref_id=arduino&offset=5
https://www.hackster.io/Anti_Spoofed/digital-thermometer-for-beginners-1f455d