Displaying Temperature and Humidity on an LCD

Integrate this easy-to-use DHT11 temperature and humidity sensor into your weather station, drone, weather balloon, or greenhouse.

Jul 19, 2019

55673 views

10 respects

Apps and platforms

1

Arduino IDE

Project description

Code

Display data on 20x4 LCD

arduino

Display data on 16x2 LCD

arduino

Display data on 16x2 LCD

arduino

Downloadable files

Wiring LCD and DHT11 to Arduino Uno

Wiring LCD and DHT11 to Arduino Uno

Wiring LCD and DHT11 to Arduino Uno

Wiring LCD and DHT11 to Arduino Uno

Comments

Only logged in users can leave comments

toastghost1767

a year ago

this code should work #include <DHT.h> #include <LiquidCrystal.h> const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; LiquidCrystal lcd(RS, EN, D4, D5, D6, D7); #define DHTPIN 8 // Define the pin where your DHT11 sensor is connected #define DHTTYPE DHT11 // Define the type of DHT sensor DHT dht(DHTPIN, DHTTYPE); void setup() { lcd.begin(16, 2); dht.begin(); // Initialize the DHT sensor } void loop() { delay(2000); // Wait for a few seconds between measurements float temperature = dht.readTemperature(); // Read temperature in Celsius float humidity = dht.readHumidity(); // Read humidity lcd.clear(); // Clear the LCD display lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(String(temperature, 1)); // Displays temperature with 1 decimal place lcd.print("C"); lcd.setCursor(0, 1); lcd.print("Humidity: "); lcd.print(String(humidity, 1)); // Displays humidity with 1 decimal place lcd.print("%"); }

Anonymous user

2 years ago

Hi! Is there any way to show the time instead of the Kelvin temperature? Thanks!

Herbman33

2 years ago

I have an error in the code. "dht DHT;" errors with 'dht' does not name a type. I am lost

Anonymous user

2 years ago

the <dht.h> script part is invalid for me. I made my own script for it in python3.9 that works but that's it.

Anonymous user

3 years ago

This is perfect for what I am going to need. Thank you . Felix C

Anonymous user

5 years ago

Hi! Is there any way to show the time instead of the Kelvin temperature? Thanks!