|The weather station completed and mounted outdoors.|
The most common way that a Raspberry Pi (or any other computer) is interfaced is via a pre-built system that has a serial or USB connection. This is the fastest and easiest way to do this. But what fun is doing things the way everyone else does?
I had an old weather station that was relatively cheap (less than $100) and did not have any drivers for Linux. I ran it on an old PC for several years, but it finally stopped working. The wireless part was never very reliable and it was a pain to keep replacing batteries. I was able to salvage the anemometer (wind speed) and rain gauge and hack them into my new system.
For temperature and humidity readings I use the AM2315 from adafruit. For barometric pressure I use the MPL115A2, also from adafruit. Both of the devices interface via the I2C bus. I have to give a plug for adafruit. It's a great place to get parts to connect to the Raspberry Pi.
|The interface board and Pi on a mounting plate.|
The anemometer and rain gauge are simple contact closure interfaces. Each tiny bucket of rain and each rotation of the anemometer produce a single pulse. These are connected simply through GPIO pins and drive interrupts which count the pulses.
The interface board that connects to the Pi is actually very simple. It mostly just passes GPIO pins to screw terminals. The MPL115A2 is the tiny blue board next to the ribbon connector.
Adafruit also provided the perfect weatherproof enclosure. I will have to drill holes to feed wires in, but those will be sealed with silicone.
In the near future I will write up posts on some of the problems I had to overcome to complete this project.
- Handling GPIO interrupts
- Interfacing to the AM2315 via I2C
- Interfacing to the MPL115A2 via I2C
- Calibrating the rain and wind sensors
- Logging to my MySQL database server
- Logging to Weather Underground
- Providing a nice web interface to display the weather data
This has been a very fun project and I expect to use the weather station for many years to come.
Of course, Murphy had to strike - when I went to mount the system outdoors, it was raining!