# Introduction
The idea of building a weather station that can collect comprehensive weather information, including wind speed, wind direction, temperature, and humidity, while offering flexible sensor configurations and connectivity options, is an exciting and versatile project. This weather station aims to provide users with a customizable solution that meets their specific needs and requirements.
The core feature of this weather station is its capability to connect to multiple wind sensors or air sensors. This allows for measuring weather parameters at various heights or different locations, providing a more comprehensive understanding of the local weather conditions. By integrating multiple sensors into a single weather station, users can capture data from different elevations or areas, enabling them to analyze the vertical distribution of wind, temperature, and humidity.
Additionally, this weather station project emphasizes affordability and ease of installation. The final product is designed to be cost-effective, utilizing affordable components without compromising on data accuracy. By using readily available and reasonably priced materials, the weather station can be developed at an affordable price point, making it accessible to a wider audience.
The installation process of the weather station is user-friendly and straightforward. Clear instructions and intuitive setup procedures are provided to enable individuals with varying levels of technical expertise to easily install the weather station. The goal is to minimize the time and effort required for installation, allowing users to quickly set up and start collecting weather data.
Connectivity is a key aspect of this weather station project. The weather station is designed to connect to the internet, allowing the collected weather data to be transmitted and processed on a server or cloud platform. Various connectivity options, including Wi-Fi, Ethernet, Cellular, and LoRaWAN, are available to suit different installation scenarios and user preferences. Whether it's a single internet connection or a Bluetooth connection to nearby devices, the weather station's connectivity can be tailored to meet the specific needs of the user and the installation location.
By combining affordability, ease of installation, customizable sensor configurations, and flexible connectivity options, this weather station project offers a comprehensive solution for collecting and sharing accurate weather information. Whether it's for personal use, educational purposes, or professional applications, this weather station provides a versatile and user-friendly platform to understand and monitor local weather conditions.
# Product Design
## General
```mermaid
graph LR
A[Controller] --- C(Sensors)
A --- D(Power Supply)
A --- E(Connection)
```
```mermaid
graph LR
A[Processor] --- C(Sensors)
A --- D(Power Supply)
A --- E(Connection)
C --- F(Wind Sensor)
C --- G(Air Sensor)
D --- H(DC Power)
D --- I(Solar Energy)
E --- J(Bluetooth)
E --- K(Cellular)
E --- L(LoRaWAN)
E --- M(Wi-Fi / Ethernet)
```
## Hardware
### Controller
#### **Raspberry Pi 3B+**
**Features:**
- **CPU:** Quad-core 1.4GHz Broadcom BCM2837B0
- **RAM:** 1GB LPDDR2 SDRAM
- **Connectivity:** 2.4GHz and 5GHz 802.11b/g/n/ac Wi-Fi, Bluetooth 4.2/BLE, Gigabit Ethernet
- **Storage:** MicroSD
- **I/O:** 4 x USB 2.0, HDMI, 3.5mm analog audio-video jack, 2 x micro USB power
**Pricing:**
- Approx. 300 PLN
**Benefits:**
- Multifunctional: Capable of running a full OS.
- Strong community support.
- More processing power and memory compared to Arduino boards.
- In-built Wi-Fi and Bluetooth.
**Drawbacks:**
- Requires a proper OS shutdown; sudden power losses can corrupt the SD card.
- Higher power consumption than Arduino boards.
- **Does not natively support analog input, making it unsuitable for projects that require direct analog sensor readings.**
#### **Arduino Nano**
**Features:**
- **Microcontroller:** ATmega328P
- **Operating Voltage:** 5V
- **I/O Pins:** 14 (6 provide PWM output)
- **Flash Memory:** 32 KB (2 KB used by bootloader)
- **SRAM:** 2 KB
- **EEPROM:** 1 KB
- **Clock Speed:** 16 MHz
**Pricing:**
- Approx. 25 - 35 PLN per unit
**Benefits:**
- Compact and lightweight.
- Low power consumption.
- Suitable for simple projects and tasks.
**Drawbacks:**
- Limited memory and computational capability.
- No built-in connectivity like Wi-Fi or Bluetooth.
- Not enough communication pin on one board.
#### **Arduino Mega 2560**
**Features:**
- **Microcontroller:** ATmega2560
- **Operating Voltage:** 5V
- **I/O Pins:** 54 (15 provide PWM output)
- **Flash Memory:** 256 KB (8 KB used by bootloader)
- **SRAM:** 8 KB
- **EEPROM:** 4 KB
- **Clock Speed:** 16 MHz
**Pricing:**
- Approx. $12 - $15 per unit (As of 2021)
**Benefits:**
- Increased memory and I/O pins compared to Arduino Nano.
- Supports multiple libraries and shields.
- Suitable for larger projects requiring numerous inputs and outputs.
**Drawbacks:**
- Larger board size compared to Nano.
- Still lacks built-in connectivity options.
---
**Conclusion & Selection:**
The **Arduino Mega 2560** stands out as the most suitable choice for this project for several reasons:
- **Pin Availability:** The Mega 2560 provides ample GPIO pins, sufficient to support up to 16 wind sensors and over 8 air sensors simultaneously.
- **Memory Consideration:** With its significant flash memory, the Mega 2560 can accommodate multiple libraries, allowing for flexible integration and functionality.
- **Analog Readings:** Unlike the Raspberry Pi 3B+, the Mega 2560 natively supports analog input, crucial for this project's sensor requirements.
- **Reliability and Simplicity:** Arduino platforms, being microcontroller-based, are less prone to issues from sudden power losses and do not require a complex OS. This ensures stable, continuous readings and straightforward interfacing with sensors.
Based on these considerations, the **Arduino Mega 2560** emerges as the optimal choice for ensuring the project's success, balancing pin availability, memory considerations, and native support for the sensors' requirements.
### Sensors
#### Wind sensor
| | [UICPAL Wind Sensor](https://pl.aliexpress.com/item/1005005500304078.html) | [Blebox Wind Speed Sensor](https://botland.store/withdrawn-products/19978-blebox-windsensor-wind-sensor-5900168580374.html) |
| ------------------ | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Measure properties | Wind speed + Wind direction | Wind speed |
| Output signal | Pulse | Pulse |
| Measure range | 0-30 m/s + 0 - 360 degree | 0-30 m/s |
| Price | 130.42 PLN | 294.07 PLN |
#### Air temperature / humidity
| | [DHT11](https://botland.com.pl/czujniki-multifunkcyjne/3030-czujnik-temperatury-i-wilgotnosci-dht11-modul-niebieski-5904422359294.html) | [DHT22](https://botland.com.pl/czujniki-multifunkcyjne/2637-czujnik-temperatury-i-wilgotnosci-dht22-am2302-modul-przewody-5904422372712.html) |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Measure properties | Temperature, humidity | Temperature humidity |
| Measure range | 0 - 50 °C, 20 - 90% RH | -40 do +80 °C, 0 - 100% RH |
| Price | 11 PLN | 45 PLN |
#### Conclusion & Selection
Between the **UICPAL Wind Sensor** and **Blebox Wind Speed Sensor**, the UICPAL stands out for its comprehensive functionality and cost-effectiveness. It provides measurements for both wind speed and direction, ensuring a broader range of data for applications. Additionally, its competitive price of 130.42 PLN, especially when juxtaposed against the limited capabilities of the Blebox Wind Speed Sensor priced at 294.07 PLN, further underscores its value proposition.
Between the **DHT11** and **DHT22**, the DHT22 is a more robust choice. It offers a wider temperature measuring range (-40 to +80 °C) and a complete humidity range (0 - 100% RH). Although the DHT22 is priced higher at 45 PLN compared to DHT11's 11 PLN, the enhanced features justify the cost difference, providing more accurate and comprehensive data.
### Connection
In order to send the collected data to the server, we need the have some connection to the internet.
#### Bluetooth
| Parameter | [HC-05](https://botland.com.pl/moduly-bluetooth/2570-modul-bluetooth-hc-05-5903351241311.html) | [AT-09](https://botland.com.pl/moduly-bluetooth/9515-modul-bluetooth-40-ble-hm-10-at-09-mlt-bt05-33v5v-5904422313524.html) | [HM-10](https://botland.com.pl/moduly-bluetooth/8591-modul-bluetooth-40-ble-hm-10-33v5v-5904422311896.html?) |
|--------------------------|-----------------------------------------|-----------------------------------------------------|--------------------------------------------|
| **Protocol** | Classic Bluetooth 2.0+EDR | Bluetooth Low Energy (BLE) 4.0 | Bluetooth Low Energy (BLE) 4.0 |
| **Operating Voltage** | 3.3V - 6V | 2.0V - 3.6V | 2.0V - 3.7V |
| **Range** | Up to 60 meters | Varies, typically up to 30 meters | Up to 100 meters in open space |
| **Default Baud Rate** | 9600 bps | 9600 bps | 9600 bps |
| **Profiles** | SPP (Serial Port Profile) | Generic Access, Attribute | Generic Access, Attribute |
| **Configurable Pins** | Yes (Using AT commands) | Limited (Mostly via AT commands) | Yes (Using AT commands) |
| **Price** | 65 PLN | 50 PLN | 60 PLN |
Comparing the Bluetooth modules HC-05, AT-09, and HM-10, the **HM-10** is our choice. It offers BLE 4.0 support, ensuring compatibility with both Android and iOS devices. Additionally, its reliability, feature set, and energy efficiency make it a superior choice for our application.
#### Wifi Module
| Feature/Module | ESP8266 | ESP32 | NRF24L01 |
|----------------|-----------|------------------|----------------------|
| **CPU Cores** | Single | Dual | N/A |
| **GPIO Pins** | Limited | More than ESP8266| Limited |
| **Power** | Standard | Improved Power Mgmt | Very Low (standby) |
| **Price** | Low | Medium | Low |
| **Complexity** | Moderate | Higher due to more features | Low |
Considering its balance between price, features, and extensive community support, the **ESP8266** stands out as a reliable choice for WiFi-enabled projects. Its wide usage and proven track record in many IoT projects make it an optimal choice for scenarios that require WiFi connectivity without the added features and cost of more advanced modules.
#### Ethernet Module
| Feature/Parameter | ENC28J60 | Arduino Ethernet Shield |
|-----------------------|---------------------------|------------------------------------|
| **Controller IC** | ENC28J60 (Microchip) | W5500/W5100 (WIZnet) |
| **Data Rate** | 10 Mbps | 10/100 Mbps |
| **Interface** | SPI | SPI |
| **PoE** | No (need external module) | Yes (with supporting variants) |
| **Integrated TCP/IP Stack**| Limited | Yes |
| **Supported Libraries**| EtherCard, UIPEthernet | Ethernet |
| **Additional Features** | None | microSD card slot |
| **Price** | 40 PLN | 70 PLN |
| **Complexity** | Moderate | Low (due to mature Arduino support)|
Both the **ENC28J60** and **Arduino Ethernet Shield** offer Ethernet capabilities, with the latter providing higher speeds and more features. Given its robust performance and ease of use within the Arduino ecosystem, we use the **Arduino Ethernet Shield** for reliable Ethernet connectivity.
#### Cellular
To connect to the internet in the place have Ethernet or Wifi, we can use the Cellular network to send and receive data from the server, one Cellular board need to used, it can be:
- [Extend HAT GSM/GPRS/GNSS/Bluetooth do Raspberry Pi - Waveshare 13460](https://botland.com.pl/raspberry-pi-hat-komunikacja/9893-nakladka-hat-gsmgprsgnssbluetooth-do-raspberry-pi-waveshare-13460-5904422376376.html)
(155 PLN)
- [LTE GPS HAT - NB-IoT/LTE/GPRS/GPS SIM7000E - Waveshare 14865](https://botland.com.pl/raspberry-pi-hat-komunikacja/12531-lte-gps-hat-nb-iotltegprsgps-sim7000e-nakladka-dla-raspberry-pi-3b3b2bzero-waveshare-14865-5904422319496.html)
(179 PLN)
#### LoraWan
The collected data from sensors can also be send back to server using LoraWan technology, by using the existing infrastructure of [Helium LoraWan](https://www.helium.com/lorawan) community network, we can reduce the cost of maintaining cellular subscription to around 1$ per year per station.
To connect the weather station to the LoraWan network, we need to have an additional module [LoRa-E5 mini STM32WLE5JC - moduł LoRaWAN 868/915 MHz](https://botland.com.pl/moduly-radiowe/19267-lora-e5-mini-stm32wle5jc-modul-lorawan-868915-mhz-seeedstudio-113990939-5904422369026.html)
### Power supply
To run the this weather station with all set of sensor, a power of 5V 3A or 12V 1A is required, it can be supply with the power adapter if convinience, or use a solar panel with accumulator to generate and store the electric resource.
## Proposed hardware
Base on the funcionality and price of above elements, the proposed design of the completed set for this weather station will be:
- Arduino Mega 2560
- Wind sensor: UICPAL Wind Sensor
- Air sensor: DHT22
- Wifi module: ESP8266
- Ethernet module: Arduino Ethernet Shield
- LoRa-E5 module
- GPS module: GPS-NEO-7M
This will be the completed set of the product, and can be adjust base on user need.
## Software
Library using:
- SoftwareSerial
- Ethernet
- TinyGPS++
- LiquidCrystal_I2C
-
--------------
# Working Progress
## Hardware:
### Connection Diagram
**Module Connection**
```mermaid
graph LR
WindSensor[UICPAL Wind Sensor] -- Analog --> Mega[Arduino Mega 2560]
AirSensor[DHT22] -- Digital --> Mega
GPS -- UART --> Mega
Mega -- I2C --> LCD[LCD Display]
Mega <-- UART --> Bluetooth[HM-10 Bluetooth]
Mega <-- UART --> WiFi[ESP8266 WiFi Module]
Mega <-- SPI --> EthernetShield[Ethernet Shield]
Mega <-- UART --> LoRaWAN[LoRa-E5 mini STM32WLE5JC]
Mega <-- UART --> Sim800L[Sim800L GSM Module]
MobileApp[Mobile App] <-.-> Bluetooth
```
**Power connection**
```mermaid
graph TD
Power[12V 3A] --> XL4015[XL4015 DC-DC Converter 5V]
Power --> Mega[Arduino Mega 2560]
Power --> DC3.3V[DC-DC Converter 3.3V]
Power --> WindS[Wind Sensor - Speed, Direction]
XL4015 --> LCD[LCD Display]
XL4015 --> Bluetooth[HM-10 Bluetooth]
XL4015 --> Sim800L[Sim800L GSM Module]
XL4015 --> LoRaM[LoRa-E5 mini]
XL4015 --> DHT22[DHT22]
DC3.3V --> EthernetM[ENC28J60 Ethernet Module]
DC3.3V --> WiFiM[ESP8266 WiFi Module]
DC3.3V --> GPSM[GPS Module]
Mega --> Ethernet[Ethernet Shield]
```
Power consumption for each component:
| Component | Voltage | Current (Peak) | Power Consumption |
|-----------------------------|:-------:|:-------: |:-----------------:|
| Arduino Mega 2560 | 12V | - | 1W |
| Wind Direction Sensor | 10-30V | - | 0.75W |
| Wind Speed Sensor | 10-30V | - | 1.2W |
| LCD 20x4 with I2C Converter | 5V | 40mA | 0.2W |
| Bluetooth HM-10 | 5V | 50mA | 0.25W |
| Sim800L | 5V | 2A | 10W |
| LoRa-E5 | 5V | 111mA | 0.555W |
| DHT22 | 5V | 2mA | 0.01W |
| Ethernet | 3.3V | 180mA | 0.594W |
| ESP8266 | 3.3V | 70mA | 0.231W |
| GPS | 3.3V | 35mA | 0.1155W |
## Software
### General
To help users can interact with the data collected from the stations, we need to have a way to configure the devices, collect, process and show the data. It can be:
**Web App**
- **Data Collection**: The web app will provide a centralized platform to gather data from multiple sources over the internet, ensuring consistent and timely data acquisition.
- **Interactive User Interface**: Users can interact with the platform to access the collected data in a user-friendly manner, allowing for more intuitive and efficient data analysis.
- **LoRa Webhook Integration**: Integration of webhooks will enable seamless transmission and receipt of data from LoRa devices directly to the web platform, optimizing the data flow and reducing manual intervention.
**Mobile App**
- **Bluetooth Configuration**: With a mobile app in place, users can effortlessly configure the devices via Bluetooth, ensuring a hassle-free and wireless setup process.
- **Testing and Debugging**: A mobile app can serve as a dynamic tool for real-time testing and debugging, allowing users to quickly identify and resolve issues during the setup or operation phase.
- **Live Data Access**: Users can view live data directly from the station using the mobile app when they are in proximity. This ensures immediate access to the most recent data without needing to connect to the web platform.
Given the essential requirements of data interaction, configuration, and accessibility for the Weather Station project, it is imperative to develop both a Web App and Mobile App.
**Data transmission diagram**
```mermaid
graph LR
WS(Weather Station)
WS -->|HTTP via Cellular| S(Server)
WS -->|HTTP via Wi-Fi| S
WS -->|HTTP via Ethernet| S
WS -->|BLE| P(Phone)
WS -->|LoraWAN| LH(LoraWAN Hotspot)
LH -->|Webhook| S
```
### Web Server
### Mobile App
- Use UML diagram
- Low level diagram
- Explain the modularity of the system, how can expand to multiple sensors (can be from different producer)
-