Mako
Published

Arduino Temperature - Humidity - Rain Sensor

On the display is printed temperature (celsius) and humidity (%) with a DHT11. When it's raining the LED lights up. You need a rain sensor!

BeginnerShowcase (no instructions)34,709
Arduino Temperature - Humidity - Rain Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Resistor 221 ohm
Resistor 221 ohm
220 ohm
×2
Rotary potentiometer (generic)
Rotary potentiometer (generic)
10k
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×25

Schematics

Weather Station Schematics

Weather Station Schematics

Code

Weather Station Code

Arduino
#include <dht.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

dht DHT;

#define DHT11_PIN 7
int pin=8;
int pinLed=9;

void setup(){
  lcd.begin(16, 2);
  Serial.begin(9600);
  pinMode(pin, INPUT);
  pinMode(pinLed,OUTPUT);
}
int rain=0;
int measurement=0;

void loop()
{
  int chk = DHT.read11(DHT11_PIN);
  lcd.setCursor(0,0); 
  lcd.print("Temp: ");
  lcd.print(DHT.temperature);
  lcd.print((char)223);
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Umid: ");
  lcd.print(DHT.humidity);
  lcd.print("%");
  delay(1000);
  rain = digitalRead(pin); 
  if(rain==1) 
    digitalWrite(pinLed,LOW);
  if(rain==0)
    digitalWrite(pinLed,HIGH);
    measurement = analogRead(A0);
    Serial.println(measurement);
  
  
  
  delay(1000);
  }

Credits

Mako

Mako

4 projects • 49 followers
Welcome to Mako! Visit the website for complete projects

Comments