This is a small weather station project which measures the environment temperature and humidity then sends this data to a dedicated server and visualized afterwards. Currently, it was developed on Windows 11, and works on Ubuntu too but additional libraries need to be installed.
The weather station consists of three components:
The client is where the actual measuring will take in place. The client hardware components consists of the following:
- ESP01 - microcontroller with a built-in Wi-Fi module
- DHT22 - temperature and humidity sensor
The acquired data will be stored on the server in a MongoDB database and is accessible from a web browser or basically anything that allows to make HTTP requests (i.e. curl, Postman etc.). The server consists of the following:
- Golang 1.20
- MongoDB
The server components are wrapped in Docker files which allows to instantly build and run the server and database quickly. Make sure the Docker environment is properly installed in your machine.
Visualizes the weather data by temperature and humidity on a selected date. The application itself is written in Rust and is available for desktop.
- Make sure the Arduino IDE is installed with the accompanying ESP8266 package
- Connect the ESP01 module to your PC and make sure that the module is set in flashing/programming mode
- Select the
Port
andBoard
(label:Generic ESP8266 board
) inside the IDE (located under tools) - Compile (and upload) the code
Currently, there are environment variables located in the .ino
file which need to be changed for your case, and those
variables are:
SSID
- WiFi network namePASSWORD
- WiFi network passwordURL
- server URL
Example:
#define SSID "MyWifi";
#define PASSWORD "Password1234";
#define URL "http://192.168.1.1:3500/ping"
Assuming that the server is added to your local network, make sure to obtain the correct IP address from your router.
Navigate your terminal to the root of the project and execute the following command:
docker-compose up -d --build
Also, make sure that you enabled communication on port 3500
in your firewall so the data can be received by the
server.
Make sure you change the API endpoint address in frontend/src/requests.rs
on line 15
to the set local network
address, i.e.
// Endpoints
const BASE_URL: &str = "http://192.168.1.1:3500"; // Set YOUR server IP address
const FETCH_WEATHER_DATA_BY_DATE_ENDPOINT: &str = "/get/";
const FETCH_DATES_ENDPOINT: &str = "/dates";
const FETCH_LATEST_DATE_ENDPOINT: &str = "/latest";
Additionally, Ubuntu 22.04 needs the following libraries in order to compile successfully:
sudo apt-get update
sudo apt-get install pkg-config libglib2.0-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf-2.0-dev libssl-dev
This is working out-of-the-box on Windows 11, so no special attention needed there.
Once the measuring station and server are running, execute the following command inside the frontend
folder run
the desktop application.
cargo run .
After the weather station is wired as shown in the schematic, turn on the power supply and the ESP01 should begin the
initialization process by connecting to the provided Wi-Fi data and send the an initial ping
request to the server.
Make sure you follow the log output of the server by executing the following command:
docker logs sdws_server --follow
You should see all the activities on the server. Also, once the desktop application is running, click on the circle arrow button to fetch the data.
- [FRONTEND] Add input text field for server URL address
- [FRONTEND] Realtime weather data tracking
- [FRONTEND] Comparing data from different days
- [ESP8266] Median filter while capturing the environment data (reduce outliers possibility)
Special thanks to JetBrains for providing me with a free open-source license in order to create this project.