# DIY Arduino Weather Station (ATmega328P)
A compact, resource-optimized weather station built on **Arduino Nano** featuring a 24-hour temperature history graph, microclimate monitoring, and automatic display brightness control.
---
## 🛠 Technical Specifications & Constraints
* **Microcontroller:** ATmega328P (5V, 16 MHz)
* **Memory Constraints:** ~80% Flash utilized, SRAM limited to 2048 bytes
* **OLED Driver Mode:** OLED\_NO\_BUFFER (direct page writing over I2C without a frame buffer to conserve SRAM)
* **Graph Resolution:** 24-hour timeline (96 data points, 15-minute sampling interval)
* **Power Supply:** 5V DC via USB or external regulated supply
---
## 🔌 Hardware Pinout
### 1. I2C Display (SSD1306 128x64) & BME280 Sensor
| Module Pin | Arduino Pin | Description |
| :--- | :--- | :--- |
| **SDA** | A4 | I2C Serial Data |
| **SCL** | A5 | I2C Serial Clock |
| **VCC** | 5V | Main 5V Power Rail |
| **GND** | GND | Common Ground |
### 2. Real-Time Clock Module (DS1302)
| DS1302 Pin | Arduino Pin | Function |
| :--- | :--- | :--- |
| **RST / CE** | D8 | Chip Enable / Reset |
| **DAT / IO** | D7 | Serial Data I/O |
| **CLK / SCLK**| D6 | Serial Clock |
| **VCC** | 5V | Main Power |
| **GND** | GND | Common Ground |
### 3. Peripherals & Indicators
| Component | Arduino Pin | Description |
| :--- | :--- | :--- |
| **Push Button** | D2 | UI Screen Toggle (Hardware Interrupt) |
| **RGB LED (Red)** | D9 | PWM Channel |
| **RGB LED (Green)**| D10 | PWM Channel |
| **RGB LED (Blue)** | D11 | PWM Channel |
| **LDR Photoresistor** | A2 | Ambient Light Sensor (Analog Input) |
---
## 🖥 UI Screen Modes
1. **Main Screen:** Real-time Clock, Date, Day of Week, Temperature, Humidity, Barometric Pressure (mmHg), Ambient Light Level.
2. **Extremes Screen:** Minimum and Maximum recorded values for T, H, and P.
3. **24H Graph:** Bar-chart histogram showing 24-hour temperature trend with dynamic Y-axis scaling.
- **Diagnostics:** I2C/RTC bus status, raw ADC light readings, System Uptime.
---
## 🚀 Build & Compilation Guide
1. Open main.ino in **Arduino IDE**.
2. Install required libraries:
* GyverOLED
* Adafruit\_BME280
* Rtc\_by\_Makuna
3. Select Target:
* **Board:** Arduino Nano
* **Processor:** ATmega328P (or ATmega328P Old Bootloader)
4. Compile and flash the firmware.