AI Weather Station: Machine learning how to forecast the weather

By Rob Zwetsloot. Posted

Air quality is a big issue in many parts of the world – especially in cities and other built-up areas. While we’ve seen a couple projects like this before which just show current air quality readings, this project does something a bit more special.

“I focused on creating an AI-driven, budget-friendly device to collect local weather data with ozone concentration to train a TinyML (TensorFlow Lite) neural network model,” Kutluhan Akar, the project’s maker tells us. “[It runs] the trained model to forecast air quality levels so as to get prescient warnings regarding pulmonary risk factors to avert potential hazardous respiratory diseases.”

It’s built like a regular home weather station, with sensors that can track local conditions. Combining those with the ozone concentration and online data in the training model adds that extra sauce to the project.

Arduino and Raspberry Pi

Data is fed to Raspberry Pi from an Arduino Nano 33 BLE for analysis.“I decided to utilise an Arduino Nano 33 BLE in this project since it can easily collect local weather data with ozone concentration and run my neural network model outdoors after being trained,” Kutluhan explains. “To collect the required data to train my model, I connected an I2C ozone sensor, an anemometer, and a BMP180 precision sensor to the Nano 33 BLE. Then, I added an SSD1306 OLED display to monitor the collected data in the field.

“Since I collected local weather data with ozone concentration on my balcony, I was able to transmit the collected data from the Nano 33 BLE to a Raspberry Pi 4 in my house over BLE instead of sending data packets to a web server as usual. In that regard, I was able to transfer data packets via the Nano 33 BLE without requiring any additional procedures.”

After running the data through TensorFlow, he assigned the results to three categories: Good, Moderate, and Unhealthy. With the training done, he transferred the model back to the Nano 33 BLE as a C array so it could use the model on the system for predictions.

“Lastly, to make the weather station as sturdy and robust as possible while enduring harsh weather conditions, I designed a windmill-themed case (3D-printable),” Kutluhan finishes.

Good quality

According to Kutluhan, the predictions are at roughly 92% accuracy for the three quality classes.

“After publishing my project, I received encouraging comments to keep improving this weather station as an SDG (Sustainable Development Goals) project,” he reveals. “[I also got] questions regarding how to make the station compatible with WiFi or GPRS by utilising different development boards.”

Kutluhan is planning to add LoRaWAN and GPS capabilities to the weather station in the future, for collecting data in forests and industrial areas. We look forward to seeing how it goes!

From The MagPi store