One day, while exploring the internet, I came across an interesting Arduino board. I was very interested in this fee. With its help, you can make yourself a robot, meteorological station, alarms, and even something more serious, for example, "Smart Home".
Having bought this device, I began to study its features. Having played enough with LEDs, a temperature sensor and an LCD display, I decided to do something interesting and something that might be useful to me at home.
And that's what came out of it ...
Today I want to tell you about my small home project, namely about the room weather station on the Arduino. I think everyone would like to see, for example, what is the temperature in the room or humidity, and so, my project will allow you to do this.
')
This is how the weather station will look complete:

Probably, you wanted to assemble the same device, well, let's not pull.
Opportunities
But first, let's see what our weather station can do:
1) Show current date and time;
2) Show current temperature;
3) Show current humidity;
4) Show current atmospheric pressure.
Composition
What we need to implement this weather station:
1) The Arduino microcontroller itself (I used the Arduino nano v3);
2) Temperature and humidity sensor Dht22 (small errors in the readings);
3) Barometer BMP085, it can do a lot of things, for example, measurement of atmospheric pressure, temperature, sea level;
4) DS3231 real time clock (it is very accurate and easy to adjust);
5) We also need to display this somewhere, I chose the well-known screen from Nokia 5110;
6) Straight arms, without this in any way.
Of necessity:
7) Battery pack for powering the whole design. I am powered by usb. Batteries do not live a couple of days;
8) Switch, it is here to turn on the backlight at the screen as needed;
9) A piece of plywood and legs.
10) Connector for power supply.
Connection
Now let's consider where and how to connect.
1) The first will be our screen:
pin 3 - Serial clock out (SCLK)
pin 4 - Serial data out (DIN)
pin 5 - Data / Command select (D / C)
pin 7 - LCD chip select (CS)
pin 6 - LCD reset (RST)
3.3V power supply
2) Next, the temperature and humidity sensor Dht22:
pin 10 - DAT
5V power supply
3) The third is the barometer:
pin 4 - SDA
pin 5 - SCL
5V power supply
4) Next, the real time clock:
pin 4 - SDA
pin 5 - SCL
5V power supply
Do not forget to connect the power and ground.
Code
Well, now the most interesting is our code.
I tried to comment it well, so that it was clear, but there will be inserts in English from the libraries. I think there will be no problems with translation.
Code#include <LCD5110_Graph.h> #include "DHT.h" #include <Wire.h> #include <BMP085.h> #include "RTClib.h" #define DHTPIN 10 // 10 pin DHT22 #define DHTTYPE DHT22 RTC_DS1307 RTC; BMP085 dps = BMP085(); DHT dht(DHTPIN, DHTTYPE); long temp3 = 0, Pressure = 0, Altitude = 0; // pin 3 - Serial clock out (SCLK) // pin 4 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 7 - LCD chip select (CS) // pin 6 - LCD reset (RST) LCD5110 myGLCD(3, 4, 5, 6, 7); extern unsigned char SmallFont[]; void setup() { myGLCD.InitLCD(); myGLCD.setFont(SmallFont); Wire.begin(); RTC.begin(); dht.begin(); delay(2000); dps.init(MODE_ULTRA_HIGHRES, 3200, true); // 3200 32 ( + ) } void loop() { dps.getPressure(&Pressure); dps.getAltitude(&Altitude); dps.getTemperature(&temp3); DateTime now = RTC.now(); // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius float t = dht.readTemperature(); myGLCD.setFont(SmallFont); // myGLCD.clrScr(); // myGLCD.print("Time=", LEFT, 0); // myGLCD.printNumI(int(now.hour()), 32, 0); // 32,0 32= , . 0= myGLCD.print(":", 45, 0); myGLCD.printNumI(int(now.minute()), 50, 0); myGLCD.print(":", 62, 0); myGLCD.printNumI(int(now.second()), 67, 0); myGLCD.print("Date=", LEFT, 10); // myGLCD.printNumI(int(now.day()), 32, 10); myGLCD.print("/", 44, 10); myGLCD.printNumI(int(now.month()), 50, 10); myGLCD.print("/", 62, 10); myGLCD.printNumI(int(now.year() - 2000), 68, 10); myGLCD.print("T=", LEFT, 20); // myGLCD.printNumF(t, 2, 13, 20); // DHT22 myGLCD.print("/", 45, 20); myGLCD.printNumF(temp3 * 0.1, 2, 53, 20); // myGLCD.print("Hum=", LEFT, 30); // DHT22 myGLCD.printNumF(h, 2, 28, 30); myGLCD.print("%", 63, 30); myGLCD.print("Pres=", LEFT, 40); // myGLCD.printNumF(Pressure / 133.3, 2, 31, 40); // myGLCD.print("mm", 68, 40); // Serial.print(" Alt(m):"); , // Serial.print(Altitude / 100); myGLCD.update(); // delay (1000); // 1 }
An example of a weather station
Sources
The necessary libraries and the program code itself are available by
link .
If you have any questions or suggestions - write.