Temperature and Humidity Sensor

Easy to build temperature and humidity sensor with a cheap 2x16 LCD.

Apr 21, 2018

113772 views

32 respects

Components and supplies

1

Resistor 10k ohm

1

DHT11 Temperature & Humidity Sensor (4 pins)

1

Rotary potentiometer (generic)

1

Arduino Leonardo

1

Standard LCD - 16x2 White on Blue

Project description

Code

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

arduino

Easy temperature and humidity sensor on DHT11 with LCD

Downloadable files

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Simple temperature and humidity sensor with LCD

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Simple temperature and humidity sensor with LCD

DHT11 temperature and humidity sesnor with LCD on Arduino Leonardo

Comments

Only logged in users can leave comments

marc85

a year ago

votre code ne fonctionne pas

kingboyleo

2 years ago

#include <DHT.h> This cannot be declared.

Anonymous user

2 years ago

hai . can you do code for dh11 and potentiometer only without LCD please

Anonymous user

2 years ago

Im having some trouble, i am using the dhtlib which sees to be the same library, and and UNO R3, but it id saying DHT does not name a type. Here is my code, it is the same except for pins and other slight variations #include <dht.h> #include <LiquidCrystal.h>; #define DHTPIN 2 //defines what digital pin is used by sensor #define DHTTYPE DHT11 //tells the arduino that we are using a dht11 and not a dht22 DHT dht (DHTPIN, DHTTYPE); //initializes dht sensor LiquidCrystal lcd(12, 11, 10, 9, 8, 7); //what pints the lcd uses void setup() { Serial.begin(9600); //lcd.begin(16, 2); dht.begin(); } void loop() { delay(10000); //time between data update float t = dht.readTemperature(); //reads temperature in celcius float h = dht.readHumidity(); //reads humidity data float hic = dht.commputeHeatIndex(t, h); //serial monitor display for troubleshooting Serial.println("temperature: "); Serial.print(t); Serial.print("*C"); Serial.println("Humidity: "); Serial.print(h); Serial.print("%"); Serial.println("Heat Index: "); Serial.print(hic); //lcd display /*lcd.setCursor(0,0); * lcd.print("T= "); * lcd.setCursor(2,0 ); * lcd.print(t); * lcd.setCursor(4,0); * lcd.print("*C"); * lcd.setCursor(0,1); * lcd.print("H= "); * lcd.setCursor(2,1); * lcd.print(h); * lcd.setCursor(4,1); * lcd.print"%"); * lcd.setCursor(8,1); * lcd.print("HI= "); * lcd.print(hic); */ }

Amarantowy

2 years ago

In future I would like to add pressure sensor and make the whole thing compakt and cheap - replace Arduino Leonardo with some cheap ATmega microcontroller board (e.g. Nano) or ATmega328P alone.

Anonymous user

2 years ago

can i use arduino UNO for this project.?

Amarantowy

2 years ago

It should work fine with Arduino UNO. Just check, if you ca use the same I/O pins. In case any problems occur let me know and I will try to help.

Anonymous user

2 years ago

i have arduino/UNo, can your instructions don't work on my board.

Anonymous user

2 years ago

// DHT11 sensor #include <DHT.h> #define DHTPIN 7 // what digital pin we're connected to #define DHTTYPE DHT11 //DHT 11 /* LiquidCrystal Library - display() and noDisplay() Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and uses the display() and noDisplay() functions to turn on and off the display. The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe modified 7 Nov 2016 by Arturo Guadalupi This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay */ // include the library code: #include <LiquidCrystal.h> // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); DHT dht (DHTPIN, DHTTYPE); //Initialize DHT sensor. void setup() { // put your setup code here, to run once: // Serial.begin(9600); dht.begin(); } void loop() { delay(10000); // Waiting time between measurements float t = dht.readTemperature(); // Read temperature in *C (default) float h = dht.readHumidity(); // Read humidity % float hic = dht.computeHeatIndex(t, h); /* Serial.print("Temerature: "); Serial.print(t); Serial.print("*C\ "); Serial.print("Humidity: "); Serial.print(h); Serial.print("%\ "); Serial.print("Heat index: "); Serial.println(hic); */ // LCD display lcd.begin(16, 2); // display diamensions lcd.setCursor(0,0); lcd.print("T="); lcd.setCursor(2,0); lcd.print(t); lcd.setCursor(4,0); lcd.print("*C "); lcd.setCursor(0,1); lcd.print("H="); lcd.setCursor(2,1); lcd.print(h); lcd.setCursor(4,1); lcd.print("% "); lcd.setCursor(8,1); lcd.print("HI="); lcd.print(hic); }

Anonymous user

2 years ago

Im having some trouble, i am using the dhtlib which sees to be the same library, and and UNO R3, but it id saying DHT does not name a type. Here is my code, it is the same except for pins and other slight variations #include <dht.h> #include <LiquidCrystal.h>; #define DHTPIN 2 //defines what digital pin is used by sensor #define DHTTYPE DHT11 //tells the arduino that we are using a dht11 and not a dht22 DHT dht (DHTPIN, DHTTYPE); //initializes dht sensor LiquidCrystal lcd(12, 11, 10, 9, 8, 7); //what pints the lcd uses void setup() { Serial.begin(9600); //lcd.begin(16, 2); dht.begin(); } void loop() { delay(10000); //time between data update float t = dht.readTemperature(); //reads temperature in celcius float h = dht.readHumidity(); //reads humidity data float hic = dht.commputeHeatIndex(t, h); //serial monitor display for troubleshooting Serial.println("temperature: "); Serial.print(t); Serial.print("*C"); Serial.println("Humidity: "); Serial.print(h); Serial.print("%"); Serial.println("Heat Index: "); Serial.print(hic); //lcd display /*lcd.setCursor(0,0); * lcd.print("T= "); * lcd.setCursor(2,0 ); * lcd.print(t); * lcd.setCursor(4,0); * lcd.print("*C"); * lcd.setCursor(0,1); * lcd.print("H= "); * lcd.setCursor(2,1); * lcd.print(h); * lcd.setCursor(4,1); * lcd.print"%"); * lcd.setCursor(8,1); * lcd.print("HI= "); * lcd.print(hic); */ }

Anonymous user

3 years ago

hai . can you do code for dh11 and potentiometer only without LCD please

Anonymous user

6 years ago

What compiler did you use and how doyou connect to android studio

kingboyleo

6 years ago

#include <DHT.h> This cannot be declared.

Douglasplus

6 years ago

i have arduino/UNo, can your instructions don't work on my board.

ihsanbu

2 years ago

// DHT11 sensor #include <DHT.h> #define DHTPIN 7 // what digital pin we're connected to #define DHTTYPE DHT11 //DHT 11 /* LiquidCrystal Library - display() and noDisplay() Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and uses the display() and noDisplay() functions to turn on and off the display. The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe modified 7 Nov 2016 by Arturo Guadalupi This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay */ // include the library code: #include <LiquidCrystal.h> // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); DHT dht (DHTPIN, DHTTYPE); //Initialize DHT sensor. void setup() { // put your setup code here, to run once: // Serial.begin(9600); dht.begin(); } void loop() { delay(10000); // Waiting time between measurements float t = dht.readTemperature(); // Read temperature in *C (default) float h = dht.readHumidity(); // Read humidity % float hic = dht.computeHeatIndex(t, h); /* Serial.print("Temerature: "); Serial.print(t); Serial.print("*C\ "); Serial.print("Humidity: "); Serial.print(h); Serial.print("%\ "); Serial.print("Heat index: "); Serial.println(hic); */ // LCD display lcd.begin(16, 2); // display diamensions lcd.setCursor(0,0); lcd.print("T="); lcd.setCursor(2,0); lcd.print(t); lcd.setCursor(4,0); lcd.print("*C "); lcd.setCursor(0,1); lcd.print("H="); lcd.setCursor(2,1); lcd.print(h); lcd.setCursor(4,1); lcd.print("% "); lcd.setCursor(8,1); lcd.print("HI="); lcd.print(hic); }

Douglasplus

6 years ago

can i use arduino UNO for this project.?

Amarantowy

2 years ago

It should work fine with Arduino UNO. Just check, if you ca use the same I/O pins. In case any problems occur let me know and I will try to help.

Amarantowy

7 years ago

In future I would like to add pressure sensor and make the whole thing compakt and cheap - replace Arduino Leonardo with some cheap ATmega microcontroller board (e.g. Nano) or ATmega328P alone.