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.”
Advertisement
Get started with Raspberry Pi – everything you need to know to start your journey!
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!
Rob is amazing. He’s also the Features Editor of Raspberry Pi Official Magazine, a hobbyist maker, cosplayer, comic book writer, and extremely modest.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Get started with Raspberry Pi in Raspberry Pi Official Magazine 161
There’s loads going on in this issue: first of all, how about using a capacitive touch board and Raspberry Pi 5 to turn a quilt into an input device? Nicola King shows you how. If you’re more into sawing and drilling than needlework, Jo Hinchliffe has built an underwater rover out of plastic piping and […]
Read more →
Win one of three DreamHAT+ radars!
That’s right, an actual working radar for your Raspberry Pi. We reviewed it a few months ago and have since been amazed at some of the projects that have used it, like last month’s motion sensor from the movie Aliens. Sound good? Well we have a few to give away, and you can enter below. […]
Read more →
RP2350 Pico W5 review
It’s Raspberry Pi Pico 2, but with a lot more memory
Read more →