Temp & Humidity Sensor With LCD Disp & LED Indicator
Introduction: Temp &
Liquid(); } void loop() { delay(1000); // Reading temperature or humidity takes about 250 milliseconds! float h = dht.readHumidity(); float t = dht.readTemperature(); // Read temperature as Celsius (the default)
lcd.clear(); lcd.setCursor(0,0); lcd.print("Temp: "); lcd.print(t); //printing temperarture to the LCD display
lcd.print("'C"); lcd.setCursor(0,1); lcd.print("Humid: "); lcd.print(h); //printing humidity to the LCD display lcd.print("%");
//the 3-led setup process if (t<=22) { digitalWrite(7, HIGH); digitalWrite(8, LOW); digitalWrite(9, LOW); } else if (t>22) { digitalWrite(8, HIGH); digitalWrite(7, LOW); digitalWrite(9, LOW); } else if (t>=35) { digitalWrite(9, HIGH); digitalWrite(7, LOW); digitalWrite(8, LOW); } } :)
if (t<=22)
{
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
else if (t<35)
{
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(9, LOW);
}
else
{digitalWrite(9, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
}
The red High Led wil not work > = 22C wath can i do about it............
if (t<=19)
{
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
else if (t>19)
{
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(9, LOW);
}
else if (t>=22)
{
Fantastic Final Project. This project was fun and challenging. I love to experiment and have something to show for it.
what do i do
M:\sketch_nov22b\sketch_nov22b.ino:3:17: fatal error: DHT.h: No such file or directory
#include "DHT.h"
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
What is the pin layout for a 18 pin LCD
Very nice. Is there an easy way to display Fahrenheit?
Change this line
"float t = dht.readTemperature()"
To
"float t = dht.readTemperature(true)"
Then change the values for the LEDs or it will always think its hot
This project should be in the Elegoo Super Starter kit that i bought from Amazon, it had everything i needed to do the build. Thank you, now the next thing is to get it to trigger a relay and turn on and off a humidifier .
Thank you, i wanted to make this and your instructions were perfect. I wss thinking about replacing the LEDs with one RGB LED to save some space. I changed it to F from Celsius by putting
"float t = dht.readTemperature(true)" in the code instead of
"float t = dht.readTemperature()"
Then changed Print C to Print F.
I also changed the Values for the LED thresholds to correspond to using F values. I bought the Elegoo Super Starter kit on Amazon and it had everything i needed for this project. Thanks again.
HI! I think this code is wrong and Red Led will not work..
Sir, "error compiling for board....." what should I do. Thanks.
Yes, same here. Void loop error
Hi Rahul, nice project. I do have some comments to make. Please do not take it personally, as this is for the benefit of those who would like to recreate your device. For the start when you specify temperature accuracy in your specifications, do not put degrees Celsius after the % sign. You either say ± 2 °C, or ± 2 %, but not both. Now to the LCD. You can create your own characters with these displays (I think up 4 off, check the data sheet) so you can make degrees symbol instead of apostrophe. OK and last comment, probably the most important. The use of LEDs without series resistors will most definitely damage your ports on the microcontroller eventualy. Use one resistor around 470 Ω to 1kΩ in series with each LED. Good luck and keep at it. It's fun...
Agreed. Should always protect the LEDs!
Thanks a lot :) I will keep those in mind. I am a newbie to the LCD,and could u please share the procedure to print a degree symbol? I could not find any relevant hex code for that (it didnt show up in the LCD, so i went for apostrophe sign)
Hi Raul. The instructions how to make custom characters are in the LCD data sheets. If you do not have the data sheet at hand, google "how to create custom characters on 16x2 lcd" . Here is one of them to get you started:
Good luck. abbabba
Very fun project. Thanks for sharing.
Thank you so much! Glad!!
Dht22 is more precise. I have made a bit different clock/thermometer based on it.
Wow :) Keep it up buddy!
How to connect it if i have IIC/I2C for lcd and what part of code to change. Thanks in advance!
This might help you :
great job bro !!! keep up the good job !!! :D
Thanks ! :)
Nice. Here is a suggestion: Add a blue LED and use that for cool. Then green can be "perfect", and yellow warm. Not if it's too cold/hot, then flash red with the blue/yellow to signify they're out of range. You won't even need the LCD except for humidity (or humidity can be incorporated into the comfort "equation" too).
Thanks for your ideas. Even I thought of doing so. But the blue LED i had was infact way more brighter than all the rest. I had to switch to Green/Yellow/Red setup :D
This is cool! You should use Xbee radios to send this data wirelessly.That would be sick.
I have to try this myself, I'll let you know when I get the parts and build it!
Hey that would be awesome. Do upload the project.