
Raspberry Pi 5 Weather Station with Wind and Rain - Proteus Simulation

Hello friends, I hope you all are doing great. Today, I am going to share the Raspberry Pi 5 Weather Station with Wind and Rain - Proteus Simulation, project 106 of our IoT Projects series. A weather station is one of the most loved Raspberry Pi projects: it measures the air, the wind and the rain in your own garden and shows them on a screen and on your phone. Most tutorials stop at a temperature sensor; this one is a complete station, with the same instruments as a real one, and a Proteus simulation in which a whole storm passes over it.
A BME280 measures the temperature, the humidity and the pressure. A cup anemometer measures the wind speed, a wind vane its direction, and a tipping-bucket rain gauge the rain. The Raspberry Pi 5 reads them all once a second and works out what a weather station should tell you: the dew point, the pressure at sea level and whether it is rising or falling, the mean wind and the gusts on the Beaufort scale, the rain today and how hard it is raining. When the wind turns strong, the rain heavy or the pressure falls fast, it raises an alert. Everything appears on an I2C LCD and on a web dashboard. In this tutorial, we will go through the circuit, how each instrument works, the formulas and the Python code. Then we watch a storm come and go in the simulation. At the end, you can download the project with the program and every library file.
NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the Raspberry Pi 5 weather station in Proteus simulation:
What Does This Raspberry Pi Weather Station Do?
- The air: temperature, humidity and pressure from a BME280, with the dew point and the pressure at sea level.
- The pressure trend: steady, rising or falling, and falling fast before a storm.
- The wind: the speed from a cup anemometer, its 30 s mean, the 3 s gust and the Beaufort force; the direction from a wind vane, as a vector mean.
- The rain: a tipping-bucket rain gauge gives the rain today and the rain rate in mm/h.
- Alerts: STRONG WIND, HEAVY RAIN, STORM and FROST.
- Two displays: an I2C LCD 16x2 with two pages, and a web dashboard on a laptop or a phone.
In the simulation, each instrument has its own pop-up: the BME280's presets change the weather, the anemometer's and the vane's chips change the wind, and the rain gauge plays a recorded storm.
Components Used in the Proteus Simulation
All the parts come from our Proteus libraries, each with its own tutorial. The project zip at the end includes every LIB and DLL file.
| Part | Proteus device | Library post | Connection |
|---|---|---|---|
| Raspberry Pi 5 | RASPBERRY PI 5 | Raspberry Pi 5 Library for Proteus | PI1, weather.py, Ethernet 192.168.1.51:8000 |
| BME280 sensor | BME280ADVTEP | BME280 Sensor Library for Proteus | U1: I2C 0x76 (SDA GPIO2, SCL GPIO3) |
| ADS1115 ADC | ADS1115ADVTEP | ADS1115 ADC Library for Proteus | U2: I2C 0x48, A0 = the wind vane |
| Cup anemometer | WINDSPEEDSENSORTEP | Anemometer Wind Speed Sensor Library for Proteus | AN1: 5 V pulses through Q1 to GPIO17 |
| Wind vane | WINDVANETEP | Wind Vane Direction Sensor Library for Proteus | WV1: SIG with R1 10k to 3.3 V, to A0 |
| Rain gauge | RAINGAUGETEP | Rain Gauge Library for Proteus | U3: the reed switch on GPIO27 (R4 10k to 3.3 V) |
| I2C LCD 16x2 | I2CLCD16X2BLUEADVTEP | I2C LCD 16x2 Library for Proteus | LCD1: I2C 0x27, 5 V |
| BC547B transistor | BC547BTEP | Small Transistors Library for Proteus | Q1: the anemometer's level shifter |
| Resistors | RESISTOR4BANDTEP | Resistor Library for Proteus | R1 - R4: 10k |
| Laptop WiFi Monitor | LAPTOP WIFI MONITOR | Laptop WiFi Monitor | PC1 |
| Mobile WiFi Monitor | MOBILE WIFI MONITOR | Mobile WiFi Monitor | MOB1 |
Proteus Simulation of the Weather Station: the Circuit
| Signal | Raspberry Pi 5 | Goes to |
|---|---|---|
| SDA / SCL | GPIO2 / GPIO3 (pins 3 / 5) | the BME280 (0x76), the ADS1115 (0x48) and the LCD (0x27) |
| WIND | GPIO17 (pin 11) | Q1's collector, R3 10k to 3.3 V: LOW on each anemometer pulse |
| RAIN | GPIO27 (pin 13) | the rain gauge's reed switch to ground, R4 10k to 3.3 V |
| VANE | - (ADS1115 A0) | the wind vane with R1 10k to 3.3 V |
| PULSE | - | the anemometer's output, through R2 10k to Q1's base |
Three I2C devices share one bus, each at its own address. The anemometer runs on 5 V and its pulses swing to 5 V, too much for a Pi pin, so a BC547 transistor switches the WIND line to ground on each pulse: a simple level shifter that inverts the signal and works for any sensor voltage. The rain gauge and the wind vane are plain switches and resistors, so they work from 3.3 V directly.
How the Weather Station Works
The BME280: Temperature, Humidity and Pressure
The BME280 is three sensors in one tiny package. It gives raw numbers, and Bosch writes a set of calibration words into every chip at the factory; the datasheet's compensation formulas turn the raw numbers into degrees, percent and pascals with those words. The program reads the calibration once, then the raw values every second. The pressure it measures is the station pressure, which depends on the height of the station, so the program also reduces it to sea level, the number weather maps use. From the temperature and the humidity comes the dew point: the temperature at which the air would be saturated. When the temperature falls close to the dew point, fog and dew form.
The Pressure Trend
A barometer's trend says more about the coming weather than the pressure itself. Weather services compare the pressure with the value three hours ago: within 1 hPa it is steady, beyond that rising or falling, and a fall of more than about 3.5 hPa is falling fast, the classic sign of a storm on its way. In the simulation, a 30 s window stands for the three hours, so the storm in the run can show its trend.
The Cup Anemometer and the Beaufort Scale
The anemometer's cups turn with the wind, and every turn gives pulses: the faster the wind, the more pulses a second. The maker's line turns the pulse rate into metres per second: 0.5 + 0.169 times the pulses in a second, with no pulses below 0.5 m/s, where the cups cannot overcome their friction. The program keeps the last 30 seconds: their mean is the wind, and the best 3-second average of the last 10 seconds is the gust, the way meteorologists define a gust (over 10 minutes on a real station). The gust also gives the Beaufort force, from 0 (calm) to 12 (hurricane), the scale sailors have used for 200 years.
The Wind Vane
Inside the wind vane, a magnet on the shaft closes one or two of eight reed switches, each with its own resistor, so the vane has a different resistance for each of 16 directions. With a 10 kohm pull-up, every direction gives its own voltage, which the ADS1115 measures. The program turns the voltage back into a resistance and picks the nearest of the 16. Averaging directions needs care: the plain average of 350 and 10 degrees is 180, due south, when the wind is really from the north. So the program averages the wind as vectors, each direction weighted by its speed.
The Tipping-Bucket Rain Gauge
The rain gauge collects rain in a funnel that fills a small see-saw bucket. At 0.2794 mm of rain, the bucket tips, empties, and a magnet passing a reed switch gives one pulse. The rain today is the number of tips times 0.2794 mm. The rain rate comes from the time between the last two tips: one tip a minute is 16.8 mm/h, heavy rain. This reacts quickly at any rate, where counting tips in a fixed window is slow in light rain. No tip for 5 minutes, or for twice the last gap, means the rain has stopped.
The Alerts
Four alerts watch the numbers. STRONG WIND comes at a gust of Beaufort 6, a strong breeze of 10.8 m/s and more, when umbrellas become hard to hold. HEAVY RAIN comes at 7.6 mm/h, the usual line between moderate and heavy rain. STORM comes when the pressure falls fast while the wind is strong or the rain heavy. FROST comes at 2 C, when frost on the ground becomes possible. Each alert is logged when it starts and when it ends.
The Python Code Explained
The program is weather.py, written for the Raspberry Pi 5 with the lgpio library. It has its own small drivers for the BME280, the ADS1115 and the LCD, so it needs nothing else. The pins and the rain gauge:
WIND, RAIN = 17, 27 # BCM numbers
TIP, RAIN_SPEED = 0.2794, 60 # mm of rain a tip; the gauge's SPEED (1 on a real station)
The BME280's temperature, the first step of Bosch's compensation, and what the driver returns:
v1 = (at / 16384.0 - T1 / 1024.0) * T2
return tf / 5120.0, max(0.0, min(100.0, x)), p / 100.0 # C, %, hPa
The wind vane: the resistance from the divider, then the nearest of the 16 by ratio:
OHMS = [33000, 6570, 8200, 891, 1000, 688, 2200, 1407, 3900, 3136, 16000, 14118, 120000, 42103, 64900, 21876] # N, NNE ... NNW
r = R_PULL * volts / (V_SUP - volts)
return min(range(16), key=lambda k: abs(math.log(r / OHMS[k])))
The anemometer's pulses are counted by lgpio in the background; once a second the count, divided by the real time since the last reading, becomes a speed:
wind_pulses = lgpio.callback(chip, WIND, lgpio.FALLING_EDGE) # (no function: it counts the edges)
f = c / (now - last_t); last_t = now # pulses a second over the real interval (a loop takes a little
v = 0.5 + 0.169 * f if c > 0 else 0.0 # over 1 s: counting per loop would read about 2 % high)
The gust, the dew point (the Magnus formula) and the sea-level pressure:
gust = max(sum(w[i:i + 3]) / len(w[i:i + 3]) for i in range(max(1, len(w) - 2))) # the best 3 s average of the last 10 s
return 243.12 * g / (17.62 - g)
return p * (1 - 0.0065 * ALTITUDE / (t + 0.0065 * ALTITUDE + 273.15)) ** -5.257
The rain rate from the gap between the last two tips, and the storm alert:
return TIP / max(gap, since, 0.001) * 60.0
if trend == 'FALLING FAST' and alerts: alerts.insert(0, 'STORM')
The dashboard's links are Refresh and RESET RAIN; /data gives every reading, the alerts and the last events as JSON.
How to Run the Proteus Simulation
- Download the project zip below and install the library files and the TEPPi folder (the steps are under the download button).
- Open Pi-5-Weather-Station.pdsprj from the Proteus Simulation folder. Keep weather.py and the DLL files next to it.
- Press Play. The rain gauge plays its recorded storm in the first 20 s: light rain, heavy rain, a downpour, then dry.
- Click the anemometer, the vane or the BME280 for their pop-ups: change the wind with the chips, the weather with the BME280's presets.
- Open the Laptop or the Mobile WiFi Monitor (press Go) for the dashboard.
Simulation Results: a Storm Passes Over the Station
We pressed Play on a mild, cloudy day: 24 C, 55 % and 1012 hPa on the BME280, a light breeze of 3 m/s from the south-west. The rain gauge then played its recorded storm, and with its heavy rain we brought in the storm front on the other instruments: the BME280's STORM preset, a gale on the anemometer and the wind swinging to the west. After the rain, the front passed, and at the end came a cold, calm night. The times are the program's clock; the whole run took 56.5 simulated seconds.
The Storm Arrives
The first tip came at 5.1 s: RAIN started - 3.4 mm/h, light rain. A second later the gauge's heavy rain began, and the BME280's STORM preset dropped the pressure from 1012 to 975 hPa, with 95 % humidity. The program saw all of it in the same reading at 6.2 s: ALERT STORM and ALERT HEAVY RAIN, with the rain at 40.0 mm/h and the pressure FALLING FAST, -37.0 hPa. As the anemometer's cups spun up, ALERT STRONG WIND followed at 8.2 s with a gust of 15.5 m/s, force 7, climbing to 20.0 m/s, force 8, a gale: 115.4 pulses a second on the anemometer's output, exactly what the maker's line gives for 20 m/s. The vane swung to the west: 120 kohm and 3.04 V on its signal, and the 30 s vector mean turned to W 267 degrees. At the peak, the gauge measured a downpour of 80 mm/h.
The laptop's dashboard put the three alerts on top, STORM + STRONG WIND + HEAVY RAIN, with the readings below: 22.0 C and 95 % with a dew point of 21.2 C, 988.6 hPa at sea level and falling fast, the wind 20.0 m/s from the west with a gust of 20.0 m/s, force 8, and 8.4 mm of rain at 80 mm/h.
The Front Passes
The rain eased and stopped: HEAVY RAIN over at 21.7 s, and RAIN stopped - 10.3 mm in all at 24.8 s, 37 tips, the same count as the gauge's own. Behind the front the sky cleared: the BME280's SUNNY preset (30 C, 35 %, 1020 hPa), a breeze of 8 m/s and the wind backing round to the north (33 kohm, 2.53 V on the vane, 2.5306 V on the ADS1115's AIN0). The pressure was now RISING FAST, so STORM over came at 25.8 s. The strong wind lasted a little longer: the gust is the best 3 s of the last 10 s, so STRONG WIND over came at 35.1 s, once the gale had left that window. The dashboard showed No alerts.
A Frosty Night
Finally, a cold, calm night: the BME280's SNOW preset (-5 C, 85 %) and a calm on the anemometer. At 43.2 s came ALERT FROST, with a dew point of -7.1 C. The LCD showed the alert page, and the phone's dashboard the frost with the day's rain still on it: 10.3 mm, and the most intense rain of 80.2 mm/h. RESET RAIN on the phone at 50.5 s set the rain total back to 0 for the next day.
The Pi's terminal kept the whole storm, each alert with the gust, the rain rate and the pressure trend at that moment, and the end of each alert.
Download the Project Files
Click the button below to download Raspberry-Pi-5-Weather-Station-Wind-Rain-Proteus-Simulation-v1.0.zip (about 15.5 MB, without the source code of the models):
Raspberry Pi 5 Weather Station with Wind and Rain - Proteus Simulation V1.0- Proteus Simulation: Pi-5-Weather-Station.pdsprj, weather.py and copies of the models.
- Python Code: weather.py, the program.
- Proteus Library Files: the LIB files of every part.
- Proteus Model Files: the DLL models and the TEPPi folder (the Pi's Python runtime).
- README.txt: the installation steps, the properties, the test results and the links to every library post.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install the Project Files
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy everything in Proteus Model Files, the DLL files and the TEPPi folder, into the MODELS folder.
- Start Proteus and open the project from the Proteus Simulation folder.
Changing the Code
weather.py is a plain Python file: open it in any editor, change the altitude, the alert levels or the LCD pages, save it next to the project and press Play again. On a real station, set RAIN_SPEED to 1 and TREND_S to 10800 (three hours).
Ideas to Extend the Project
- Log every reading to a CSV file once a minute and draw the day's charts.
- Send the readings to a weather network such as Weather Underground or your own server.
- Add a light sensor and a UV sensor for the sunshine hours and the UV index.
- Forecast from the pressure trend with the Zambretti method.
- Add a soil temperature probe for the gardeners.
- Send the alerts to your phone as push messages.
From Simulation to Real Hardware
- Siting: the anemometer and the vane high and clear of buildings (10 m is the standard), the BME280 in a shaded, ventilated screen 1.5 m above grass, the rain gauge level and away from trees.
- Weather meters: many wind and rain sets are plain reed switches; then the anemometer needs only a pull-up, no transistor.
- Cables: long sensor cables pick up noise; keep the I2C bus short and put the ADS1115 near the Pi.
- Times: set RAIN_SPEED to 1 and TREND_S to 10800 for a real station.
Troubleshooting
- The wind direction is wrong: the vane's north mark must point north; check its resistances against the table.
- The wind speed reads 0: no pulses on GPIO17; check Q1, R2 and R3.
- No BME280: the program stops if it does not find the chip ID 0x60 at 0x76; check SDO (to ground for 0x76).
- No dashboard: the program serves on port 8000 once the Ethernet is up; press Go again after a few seconds.
Limitations of the Simulation
- The BME280, the ADS1115, the anemometer, the wind vane and the rain gauge are our libraries' models, built from their datasheets and the parts' behaviour, not every detail of real parts.
- The weather is set in the pop-ups: the BME280's presets, the anemometer's and the vane's chips and the rain gauge's recorded storm.
- The rain gauge's storm runs 60 times faster and the pressure trend uses 30 s instead of 3 hours, so a storm fits into a minute of simulation.
- Raspberry Pi is a trademark of Raspberry Pi Ltd; this project is not made or endorsed by them or by Labcenter.
So, that was all about the Raspberry Pi 5 Weather Station with Wind and Rain - Proteus Simulation. I hope it helps you understand how each weather instrument works, how a Raspberry Pi reads them, and how a station turns raw readings into the numbers and warnings that matter, all tested in a simulation before you put anything on the roof. More popular projects with the ESP32 and the Raspberry Pi 5 are coming. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!























Comments
0