Weather Station - Parker Frederick - 2022-01-30
by pa291fr in Circuits > Arduino
290 Views, 1 Favorites, 0 Comments
Weather Station - Parker Frederick - 2022-01-30
Since I live in Canada I've decided to make a weather station that would tell me the temperature. As well I did it for my Tech class. It seems do work pretty well, I have some problems with the LCD but other than that it tells you the temperature as well as weather or not its T-Shirt Weather or if its chilly!
Supplies
- Arduino LCD 16x2 x1 - From Arduino kit
- DHT11 Weather Module x1 - From Arduino kit
- Arduino Board - From Arduino kit
- LED x2 - From Arduino kit
- Arduino Potentiometer x1 - From Arduino kit
What the Supplies Do
Arduino LCD 16x2: This is pretty self explanatory, it will display the temperature as well as tell you whether or not its nice weather out or too cold.
DHT11 Weather Module: The module is what get the temperature of the the room or outside.
Arduino Board: What the information gets put into and sent out.
LED: The blue and red LED
Arduino Potentiometer: In this project the Potentiometer will be used to turn the LCD screen on and off.
The Project Working
This is the project working as you can see its warm since the red LED is on as well as you can see its 14C which is pretty warm. I couldn't seem to get the other one to turn on because I could not develop that cold in the classroom.
The Labeled Picture
This picture is the things labeled
The Code
#include<LiquidCrystal.h> // The Libaries #include <DHT.h> #define dhtpin A1 //Defines the pin of the weather module const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // pins of the LCD int warm = 10; // The degrees in which whether or not its warm int cold = 0; // The degrees in which whether or not its cold float celsius; // Celsius int temp = A1; // Temperature pin void setup(){ pinMode(temp,INPUT); // Pins pinMode(7, OUTPUT); pinMode(8, OUTPUT); } void loop(){ DHT.read(dhtpin); // reads the weather from the pin A1 celsius = analogRead(temp) - 1000); // Uses the Temperature lcd.setCursor(0,0); // This section is what will display on the LCD lcd.print("Temp: "); lcd.print(celsius); lcd.print(" C"); delay(1000); lcd.clear(); if (celsius > warm) { // If the celcius is about the Warm integer it will say Tshirt weather! digitalWrite(8, HIGH); digitalWrite(9, LOW); lcd.setCursor(0,2); lcd.print("Tshirt weather!"); } if (celsius < cold) { // If its cold it will say Its cold out! digitalWrite(8, LOW); digitalWrite(9, HIGH); lcd.setCursor(0,1); lcd.print("Brrr it's cold out!"); }
Where the code came from:
I figured out by myself how to connect the DHT to the LCD which took me a while.
Things I Struggled With When Making This
One of my main problems when making this was the LCD screen, I could not seem to get the text on the LCD down to the second line which I figured out, instead of having the LCD at 0.0 it had to be at 0.1 then for the second line it was 0.2 ( lcd.setCursor(0,1); ( lcd.setCursor(0,2);). Another problem I had in real life is my mother threw out my Arduino kit by accident since I had it in a box so I could not work on it at home I had to use a friends! Which made it much more difficult to work on.
Wire Connections
The middle pin on the DHT11 was for A1 the LEFT pin was for Power and the right one was for Ground.
A1 to Middle pin DHT
Pins 1 to 7 will be connect to the D1, D2, D3, D4, D5, D6, D7 slots on the LCD as shown in the picture
The rest is pretty self explanatory by looking at the pictures
What I Could Add On
One thing that I could think to add on is a box for the weather station with holes for the LCD.