← All projectsPage 2 · Continued

IoT · Machine Learning · 2024–25

Disaster prediction on a Raspberry Pi weather station

A weather station for under ₹4,500. A k-nearest-neighbours model classifies the weather, and threshold rules on top warn of flood, drought and cyclone risk.

Illustration

Why we built it

Weather stations are expensive and thinly spread, and the ones that exist rarely warn the communities most exposed to floods and droughts. We wanted to see how much of that one low-cost board could do. The hardware comes to under ₹4,500.

How it works

Every two seconds the Raspberry Pi reads temperature and humidity from a DHT11 sensor and light from an LDR through an MCP3208 converter, then pulls temperature, wind speed and pressure for its location from the OpenWeatherMap API. A classifier labels the current weather, threshold rules check for disaster conditions, and the result goes to an LCD beside the sensors, a ThingSpeak channel in the cloud, and an Android app that reads from ThingSpeak. A buzzer sounds when the classifier calls rain.

In

DHT11Temperature, humidity
LDR via MCP3208Light
OpenWeatherMap APITemperature, wind, pressure

Raspberry Pi 3 · every 2 s

kNN weather classifierk = 4 · three weather states
Threshold rulesFlood · drought · cyclone

Out

16×2 LCD and buzzerWeather state and warning
ThingSpeakCloud log of every reading
Android appMIT App Inventor, reads ThingSpeak
Fig. 1 · How the station works

The model

It works in two layers. A k-nearest-neighbours classifier (k = 4) takes temperature, humidity, light and wind speed and assigns one of three weather states: clear with high temperature, clear and normal, or rain with low temperature. It was trained on an 80/20 split of a small local dataset. Fixed thresholds on top then decide whether to raise a warning:

ConditionWarning
Humidity above 90% and temperature below 25 °CFlood risk
Humidity below 30%Drought risk
Wind speed above 60 km/hCyclone risk
Anything elseNormal

We kept the warning layer as rules on purpose. With a small dataset and a device that has to be debugged in the field, a rule you can read beats one you have to reverse-engineer.

Results

The station ran end to end on the Pi: every cycle produced sensor readings, API data, a weather state and a warning, logged to ThingSpeak and shown in the app.

Limits

The station measures temperature, humidity and light itself. Wind and pressure come from the API rather than sensors on the device, and there is no rainfall or seismic sensor, so heavy rain and earthquakes go unmeasured.

Next

Retrain on a larger, multi-region dataset; replace the thresholds with a learned second stage; add rainfall and seismic sensors; and link several stations into a mesh to cover a wider area.

Code

github.com/Ashvinj2004/disaster-prediction-system, including the Android app.