DIY Weather Station | Just Arduino Things | TW TechieTube
DIY Weather Station
Just Arduino Things | TW TechieTube
Create a DIY Weather Station easily.
Purpose:
This project can be done in DIY Methods as in the Above video, to make a DIY Weather Station in Home or in any place. Safe and Easy to use.
Components Required:
- Arduino UNO (1)
- DHT11 Sensor (1)
- LCD 16x2 module with I2C Interface (1)
- Breadboard (As per Requirement)
- Jumper Cables (As per Requirement)
- Arduino Bus Cable (1)
Construction:
A Simple project to check Room Temperature and Humidity.
Now connect the Sensors pins with the order given,
Vcc - Arduino 5v/3.3v Pin
Gnd - Arduino Gnd Pin
Data - Any Digital Pins except D1/D2 on UNO.
Incl. an LED in D13 and Gnd for external value.
As explained in the Video, the Code is written as Follows, Test code for DHT is also included.
Code:
// Example testing sketch for various DHT humidity/temperature sensors
// REQUIRES the following Arduino libraries:
// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
// - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor
#include "DHT.h"
#define DHTPIN 13
#define DHTTYPE DHT11 // DHT 11
// Initialize DHT sensor.
DHT dht(DHTPIN, DHTTYPE);
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
// initialize the LCD
lcd.begin();
// Turn on the blacklight and print a message, Change TWI to any name You wish
lcd.backlight();
lcd.print("Hello, TWI!");
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.print(f);
Serial.print(F("°F Heat index: "));
Serial.print(hic);
Serial.print(F("°C "));
Serial.print(hif);
Serial.println(F("°F"));
lcd.clear();
lcd.setCursor(0,0);
lcd.print("TW TechieTube");
lcd.setCursor(0,1);
lcd.print("Tf=");
lcd.print(int(f));
lcd.print(" T=");
lcd.print(int(t));
lcd.print(" H=");
lcd.print(int(h));
lcd.print("%");
}
Comments
Post a Comment