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!
Looking forward to reading more about this project. My shop bought weather station batteries have just died again, less than 1 month after changing them and the wind direction had never worked.
ReplyDeleteI had just started looking for a good Raspberry Pi solution when this post popped up in my feed :-)
Great. It's possible to share your used scripts?
ReplyDeleteBR Andreas
I will be posting my source code (hopefully) in about a week.
DeleteHi Ted,
DeleteAny more updates on this project? I've started to build the outdoor weather station.
All of the code from my weather station can be found at
ReplyDeletehttps://github.com/tedhale/raspberry-pi-hobbyist
You can also get it using git:
git clone https://github.com/tedhale/raspberry-pi-hobbyist.git
Possible I missed something, but I did not see your header file on github...
ReplyDeleteThanks!
It does appear to be missing. I need to do an update with my latest code and will make sure it gets there this time. No major changes - just a few bug fixes. I will try to do that later today.
DeleteThe header file has been added to the repository
DeleteCan you mention the model of the old weather station you took parts from?
ReplyDeleteCan you mention the model of the old weather station you took parts from?
ReplyDeleteHi, sorry to jump in on an old post, but I picked up on this whilst trying to investigate the answer to a long standing problem
ReplyDeleteI want to build a remote weather station, predominantly Wind Speed / direction, temp and maybe rainfall.
problem is the location is remote in the middle of a lake on an island as we are a sailing club, the nearest WiFi access point is approx. 350M away line of site and I need to feed data to our clubs website.
I have some electronics and programming experience but it all seems a bit of a minefield knowing where to start.
Any help would be appreciated
Your best option is to buy or build the right type of antenna so that you can get wifi over that distance. Google this: high gain directional wifi antenna
DeleteYou can buy one but they are not that hard to build. I find that the biggest problem is finding a wifi adapter with an external antenna connector.