Temperature and Humidity (LCD | DHT11)
Display for DHT11 (temperature and humidity). Temperature: Grad Celsius and Fahrenheit (possible).
Components and supplies
1
DHT11 Temperature & Humidity Sensor (3 pins)
1
Standard LCD - 16x2 White on Blue
1
Arduino UNO
1
Rotary potentiometer (generic)
1
Jumper wires (generic)
Project description
Code
[GER] Code (Grad Celsius) with Serial Monitor
c_cpp
For DHT11 with LCD Display (Grad Celsius) and with Serial Monitor
1/* 2------------------------------------------------------------------------------------------- 3- Library required: - 4- "LiquidCrystal", "DHT_sensor_library" and "Adafruit_Sensor-master" - 5- Download: Adafruit_Sensor-master on Github: https://github.com/adafruit/Adafruit_Sensor - 6- Put it in your Arduiono dictory "libraries" - 7- License: GNU General Public License version 3 or later (GPL3+) - 8- By HilfePlus - 9------------------------------------------------------------------------------------------- 10*/ 11 12// Library / Bibliotheken 13 #include <LiquidCrystal.h> 14 #include "DHT.h" 15 #include <DHT_U.h> 16 17// Sensor DHT11 (DHT11 Temperature and Humidity Sensor) 18 #define DHTPIN 8 19 #define DHTTYPE DHT11 20 21// LCD Display (PIN)(LCD1602 Module) 22 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 23 DHT dht(DHTPIN, DHTTYPE); 24 25void setup() { 26// Serial Monitor 27 Serial.begin(9600); 28 29// LCD Display 30 lcd.begin(16, 2); 31 lcd.setCursor(7,1); 32 lcd.print("By Hilfe+"); 33 34// LCD Display (Temp and Humidity) (Temperatur und Luftfeuchtigkeit) 35 dht.begin(); 36 lcd.setCursor(0,0); 37 lcd.print("Temp:"); 38 lcd.setCursor(0,1); 39 lcd.print("Humid:"); 40 delay(1500); 41 } 42 43 44void loop() { 45 lcd.setCursor(12,1); 46 lcd.print("%"); 47// Load (Arrow) 48 delay(250); 49 lcd.setCursor(13,0); 50 lcd.print("<"); 51 delay(50); 52 lcd.setCursor(14,0); 53 lcd.print("-"); 54 delay(50); 55 lcd.setCursor(15,0); 56 lcd.print("-"); 57 delay(50); 58 lcd.setCursor(15,1); 59 lcd.print("-"); 60 delay(50); 61 lcd.setCursor(14,1); 62 lcd.print("-"); 63 delay(50); 64 lcd.setCursor(13,1); 65 lcd.print("<"); 66 67// ... 68 lcd.setCursor(12,0); 69 lcd.print(" "); 70 lcd.setCursor(12,1); 71 lcd.print(" "); 72 73// --Temp and Humidity-- (Temperatur und Luftfeuchtigkeit) 74// Temp = Temperature in Grad Celsius 75// Humid = Humidity (Luftfeuchtigkeit) 76 float f = dht.readHumidity(); 77 float c = dht.readTemperature(); 78 79 // Sensor Error (For Example No Sensor)(Zum Beispiel keinen Sensor) 80 if (isnan(f) && (c)) { 81 lcd.clear(); 82 lcd.setCursor(4,1); 83 lcd.print("|SENSOR|"); 84 lcd.setCursor(4,0); 85 lcd.print("|ERROR |"); 86 delay(1000); 87 return; 88 } 89 90// LCD Display (values)(Ergebnisse) 91 lcd.setCursor(7,0); 92 lcd.print(c); 93 lcd.setCursor(7,1); 94 lcd.print(f); 95 96// Serial Monitor 97 Serial.println("- Result -"); 98 Serial.print("Temp: "); 99 Serial.println(c); 100 Serial.print("Humid: "); 101 Serial.println(f); 102 Serial.println("- - - - - -"); 103 Serial.println(" "); 104 Serial.println(" "); 105 106// Ende (Arrow)(Pfeil) 107 delay(400); 108 lcd.setCursor(15,1); 109 lcd.print(" "); 110 delay(50); 111 lcd.setCursor(14,1); 112 lcd.print(" "); 113 delay(50); 114 lcd.setCursor(13,1); 115 lcd.print(" "); 116 delay(50); 117 lcd.setCursor(13,0); 118 lcd.print(" "); 119 delay(50); 120 lcd.setCursor(14,0); 121 lcd.print(" "); 122 delay(50); 123 lcd.setCursor(15,0); 124 lcd.print(" "); 125 delay(50); 126}
[ENG] Code (Fahrenheit) with Serial Monitor
c_cpp
For DHT11 with LCD Display (Fahrenheit) and with Serial Monitor
1/* 2------------------------------------------------------------------------------------------- 3- Library required: - 4- "LiquidCrystal", "DHT_sensor_library" and "Adafruit_Sensor-master" - 5- Download: Adafruit_Sensor-master on Github: https://github.com/adafruit/Adafruit_Sensor - 6- Put it in your Arduiono dictory "libraries" - 7- License: GNU General Public License version 3 or later (GPL3+) - 8- By HilfePlus - 9------------------------------------------------------------------------------------------- 10*/ 11 12// --Library-- / Bibliotheken 13 #include <LiquidCrystal.h> 14 #include <DHT.h> 15 #include <DHT_U.h> 16 17// Sensor DHT-11 (DHT-11 Temperature and Humidity Sensor) 18 #define DHTPIN 8 19 #define DHTTYPE DHT11 20 21// LCD Display (PIN)(LCD1602 Module) 22 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 23 DHT dht(DHTPIN, DHTTYPE); 24 25 26void setup() { 27// Serial Monitor 28 Serial.begin(9600); 29 30// LCD Display 31 lcd.begin(16, 2); 32 lcd.setCursor(7,1); 33 lcd.print("By Hilfe+"); 34 dht.begin(); 35 36// LCD Display (Temp and Humidity) 37 lcd.setCursor(0,0); 38 lcd.print("Temp:"); 39 lcd.setCursor(0,1); 40 lcd.print("Humid:"); 41 delay(1500); 42 } 43 44 45void loop() { 46 lcd.setCursor(12,1); 47 lcd.print("%"); 48// Load (Arrow) 49 delay(550); 50 lcd.setCursor(13,0); 51 lcd.print("<"); 52 delay(50); 53 lcd.setCursor(14,0); 54 lcd.print("-"); 55 delay(50); 56 lcd.setCursor(15,0); 57 lcd.print("-"); 58 delay(50); 59 lcd.setCursor(15,1); 60 lcd.print("-"); 61 delay(50); 62 lcd.setCursor(14,1); 63 lcd.print("-"); 64 delay(50); 65 lcd.setCursor(13,1); 66 lcd.print("<"); 67 68// ... 69 lcd.setCursor(12,0); 70 lcd.print(" "); 71 72// -- Temp and Humidity -- 73// Temp = Temperature in Fahrenheit and Humid = Humidity 74 float f = dht.readHumidity(); 75 float c = dht.readTemperature(true); 76 77 // Sensor Error (For Example No Sensor) 78 if (isnan(f) && (c)) { 79 lcd.clear(); 80 lcd.setCursor(4,1); 81 lcd.print("|SENSOR|"); 82 lcd.setCursor(4,0); 83 lcd.print("|ERROR |"); 84 delay(1000); 85 return; 86 } 87 88// LCD Display (values) 89 lcd.setCursor(7,0); 90 lcd.print(c); 91 lcd.setCursor(7,1); 92 lcd.print(f); 93 94// Serial Monitor 95 Serial.println("- Result -"); 96 Serial.print("Temp: "); 97 Serial.println(c); 98 Serial.print("Humid: "); 99 Serial.println(f); 100 Serial.println("- - - - - -"); 101 Serial.println(" "); 102 Serial.println(" "); 103 104// Ende (Arrow) 105 delay(400); 106 lcd.setCursor(15,1); 107 lcd.print(" "); 108 delay(50); 109 lcd.setCursor(14,1); 110 lcd.print(" "); 111 delay(50); 112 lcd.setCursor(13,1); 113 lcd.print(" "); 114 delay(50); 115 lcd.setCursor(13,0); 116 lcd.print(" "); 117 delay(50); 118 lcd.setCursor(14,0); 119 lcd.print(" "); 120 delay(50); 121 lcd.setCursor(15,0); 122 lcd.print(" "); 123 delay(50); 124}
[ENG] Code (Fahrenheit) with Serial Monitor
c_cpp
For DHT11 with LCD Display (Fahrenheit) and with Serial Monitor
1/* 2------------------------------------------------------------------------------------------- 3- 4 Library required: - 5- 6 "LiquidCrystal", "DHT_sensor_library" and "Adafruit_Sensor-master" - 7- 8 Download: Adafruit_Sensor-master on Github: https://github.com/adafruit/Adafruit_Sensor 9 - 10- Put it in your Arduiono dictory "libraries" - 11- 12 License: GNU General Public License version 3 or later (GPL3+) - 13- 14 By HilfePlus - 15------------------------------------------------------------------------------------------- 16*/ 17 18// 19 --Library-- / Bibliotheken 20 #include <LiquidCrystal.h> 21 #include <DHT.h> 22 23 #include <DHT_U.h> 24 25// Sensor DHT-11 (DHT-11 Temperature and Humidity 26 Sensor) 27 #define DHTPIN 8 28 #define DHTTYPE DHT11 29 30// LCD Display (PIN)(LCD1602 31 Module) 32 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 33 DHT dht(DHTPIN, DHTTYPE); 34 35 36void 37 setup() { 38// Serial Monitor 39 Serial.begin(9600); 40 41// LCD Display 42 43 lcd.begin(16, 2); 44 lcd.setCursor(7,1); 45 lcd.print("By Hilfe+"); 46 47 dht.begin(); 48 49// LCD Display (Temp and Humidity) 50 lcd.setCursor(0,0); 51 52 lcd.print("Temp:"); 53 lcd.setCursor(0,1); 54 lcd.print("Humid:"); 55 56 delay(1500); 57 } 58 59 60void loop() { 61 lcd.setCursor(12,1); 62 lcd.print("%"); 63// 64 Load (Arrow) 65 delay(550); 66 lcd.setCursor(13,0); 67 lcd.print("<"); 68 69 delay(50); 70 lcd.setCursor(14,0); 71 lcd.print("-"); 72 delay(50); 73 74 lcd.setCursor(15,0); 75 lcd.print("-"); 76 delay(50); 77 lcd.setCursor(15,1); 78 79 lcd.print("-"); 80 delay(50); 81 lcd.setCursor(14,1); 82 lcd.print("-"); 83 84 delay(50); 85 lcd.setCursor(13,1); 86 lcd.print("<"); 87 88// ... 89 90 lcd.setCursor(12,0); 91 lcd.print(" "); 92 93// -- Temp and Humidity -- 94// 95 Temp = Temperature in Fahrenheit and Humid = Humidity 96 float f = dht.readHumidity(); 97 98 float c = dht.readTemperature(true); 99 100 // Sensor Error (For Example No 101 Sensor) 102 if (isnan(f) && (c)) { 103 lcd.clear(); 104 lcd.setCursor(4,1); 105 106 lcd.print("|SENSOR|"); 107 lcd.setCursor(4,0); 108 lcd.print("|ERROR 109 |"); 110 delay(1000); 111 return; 112 } 113 114// LCD Display 115 (values) 116 lcd.setCursor(7,0); 117 lcd.print(c); 118 lcd.setCursor(7,1); 119 120 lcd.print(f); 121 122// Serial Monitor 123 Serial.println("- Result -"); 124 125 Serial.print("Temp: "); 126 Serial.println(c); 127 Serial.print("Humid: 128 "); 129 Serial.println(f); 130 Serial.println("- - - - - -"); 131 Serial.println(" 132 "); 133 Serial.println(" "); 134 135// Ende (Arrow) 136 delay(400); 137 lcd.setCursor(15,1); 138 139 lcd.print(" "); 140 delay(50); 141 lcd.setCursor(14,1); 142 lcd.print(" 143 "); 144 delay(50); 145 lcd.setCursor(13,1); 146 lcd.print(" "); 147 delay(50); 148 149 lcd.setCursor(13,0); 150 lcd.print(" "); 151 delay(50); 152 lcd.setCursor(14,0); 153 154 lcd.print(" "); 155 delay(50); 156 lcd.setCursor(15,0); 157 lcd.print(" 158 "); 159 delay(50); 160}
[GER] Code (Grad Celsius) with Serial Monitor
c_cpp
For DHT11 with LCD Display (Grad Celsius) and with Serial Monitor
1/* 2------------------------------------------------------------------------------------------- 3- Library required: - 4- "LiquidCrystal", "DHT_sensor_library" and "Adafruit_Sensor-master" - 5- Download: Adafruit_Sensor-master on Github: https://github.com/adafruit/Adafruit_Sensor - 6- Put it in your Arduiono dictory "libraries" - 7- License: GNU General Public License version 3 or later (GPL3+) - 8- By HilfePlus - 9------------------------------------------------------------------------------------------- 10*/ 11 12// Library / Bibliotheken 13 #include <LiquidCrystal.h> 14 #include "DHT.h" 15 #include <DHT_U.h> 16 17// Sensor DHT11 (DHT11 Temperature and Humidity Sensor) 18 #define DHTPIN 8 19 #define DHTTYPE DHT11 20 21// LCD Display (PIN)(LCD1602 Module) 22 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 23 DHT dht(DHTPIN, DHTTYPE); 24 25void setup() { 26// Serial Monitor 27 Serial.begin(9600); 28 29// LCD Display 30 lcd.begin(16, 2); 31 lcd.setCursor(7,1); 32 lcd.print("By Hilfe+"); 33 34// LCD Display (Temp and Humidity) (Temperatur und Luftfeuchtigkeit) 35 dht.begin(); 36 lcd.setCursor(0,0); 37 lcd.print("Temp:"); 38 lcd.setCursor(0,1); 39 lcd.print("Humid:"); 40 delay(1500); 41 } 42 43 44void loop() { 45 lcd.setCursor(12,1); 46 lcd.print("%"); 47// Load (Arrow) 48 delay(250); 49 lcd.setCursor(13,0); 50 lcd.print("<"); 51 delay(50); 52 lcd.setCursor(14,0); 53 lcd.print("-"); 54 delay(50); 55 lcd.setCursor(15,0); 56 lcd.print("-"); 57 delay(50); 58 lcd.setCursor(15,1); 59 lcd.print("-"); 60 delay(50); 61 lcd.setCursor(14,1); 62 lcd.print("-"); 63 delay(50); 64 lcd.setCursor(13,1); 65 lcd.print("<"); 66 67// ... 68 lcd.setCursor(12,0); 69 lcd.print(" "); 70 lcd.setCursor(12,1); 71 lcd.print(" "); 72 73// --Temp and Humidity-- (Temperatur und Luftfeuchtigkeit) 74// Temp = Temperature in Grad Celsius 75// Humid = Humidity (Luftfeuchtigkeit) 76 float f = dht.readHumidity(); 77 float c = dht.readTemperature(); 78 79 // Sensor Error (For Example No Sensor)(Zum Beispiel keinen Sensor) 80 if (isnan(f) && (c)) { 81 lcd.clear(); 82 lcd.setCursor(4,1); 83 lcd.print("|SENSOR|"); 84 lcd.setCursor(4,0); 85 lcd.print("|ERROR |"); 86 delay(1000); 87 return; 88 } 89 90// LCD Display (values)(Ergebnisse) 91 lcd.setCursor(7,0); 92 lcd.print(c); 93 lcd.setCursor(7,1); 94 lcd.print(f); 95 96// Serial Monitor 97 Serial.println("- Result -"); 98 Serial.print("Temp: "); 99 Serial.println(c); 100 Serial.print("Humid: "); 101 Serial.println(f); 102 Serial.println("- - - - - -"); 103 Serial.println(" "); 104 Serial.println(" "); 105 106// Ende (Arrow)(Pfeil) 107 delay(400); 108 lcd.setCursor(15,1); 109 lcd.print(" "); 110 delay(50); 111 lcd.setCursor(14,1); 112 lcd.print(" "); 113 delay(50); 114 lcd.setCursor(13,1); 115 lcd.print(" "); 116 delay(50); 117 lcd.setCursor(13,0); 118 lcd.print(" "); 119 delay(50); 120 lcd.setCursor(14,0); 121 lcd.print(" "); 122 delay(50); 123 lcd.setCursor(15,0); 124 lcd.print(" "); 125 delay(50); 126}
Downloadable files
Build
Temperature and Humidity
Build

Comments
Only logged in users can leave comments