Weather Station using OLED

The project is a miniature weather station, which makes use of DHT11 sensor to measure the temperature and humidity of its environment, along with a DS1307 Real-Time Clock to measure and keep track of the time and an OLED monochrome display to show the temperature, humidity, time, date and day. These three units are interconnected with the help of an Arduino Nano. 


Components Required:
  1.  Arduino Nano(Atmel Mega 328P)
  2.   OLED monochrome display, 1.3 inch, 128x64 pixels, SPI interface
  3.   DHT11 Temperature and Humidity sensor 
  4.   DS1307 Real Time Clock, I2C interface
  5.  3.7V battery, 2000mAh

OLED Connections:


CSàD10                  DCàD9

RESàD8                 MOSIàD11
CLKàD12              VCCà3.3V

The OLED display used here is 1.3 inch, 128 x 64 pixels and a monochrome display. The OLED display uses an SPI communication interface. The library used is “U8glib.h”. It is required to display the temperature and humidity and battery level on one page, and the time, date and day with battery percentage on another page. The pages are displayed for 2 seconds each. The library allows us to do that by assigning the pages a variable which takes the values ‘0’ and ‘1’. The following code snippet shows how it is done.

Real-Time Clock
                                                                                                                                                                                                                                                           

A DS1307 Real Time Clock is used here. It makes use of an I2C communication interface. The RTC has a 3V cell that powers it when the Arduino is not powered. Two libraries are used to

interface the RTC with the Arduino; “RTClib.h” and “Wire.h”. The first library includes functions that allow the user to access the time & date (seconds, minutes, hours, day, month, year) separately. The second library takes care of the communication with the RTC.
While uploading the code onto the board the following line sets the date and time of the RTC to that of the computer the systems at the time of uploading:


Temperature and Humidity Sensor



The DHT11 is a commonly used temperature and humidity sensor. The sensor can measure temperature from 0 to 50 C and humidity from 20% to 90% with an accuracy of 1 C and 1%. The sensor comes with a dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data.
The “DHT.h” library is used to interface the above sensor.

On uploading the two lines of code into the Arduino, it reads the corresponding values of temperature and humidity from the DHT11 sensor and stores it in the variables t and h respectively which is then is displayed on the OLED.

Here it  is your Weather Station





Post a Comment

0 Comments