loading

Back in late February I saw this post on the Raspberry Pi site.

http://www.raspberrypi.org/school-weather-station-...

They had created Raspberry Pi Weather Stations for Schools. I totally wanted one! But at that time (and I believe still as of writing this) they are not publicly available (you need to be in a select group of testers). Well, I wanted on and I didn't feel like shelling out hundreds of dollars for an existing 3rd party system.

So, like a good Instructable user, I decided to make my own!!!

I did a little research and found some good commercial systems I could base mine off. I found some good Instructables to help with some of the Sensor or Raspberry PI concepts. I even found this site, which was pay dirt, they had tore down an existing Maplin system:

http://www.philpot.me/weatherinsider.html

Fast forward about a month and I have a basic working system. This is a complete Raspberry Pi Weather system with just the base Raspberry Pi hardware, camera, and some assorted analog and digital sensors to make our measurements. No buying pre-made anemometers or rain gauges, we are making our own! Here's it's features:

  • Records info to RRD and CSV, so can be manipulated or exported/imported to other formats.
  • Uses the Weather Underground API to get cool info like historical highs and lows, moon phases, and sunrise/sunset.
  • Uses the Raspberry Pi Camera to take a picture once a minute (you can then use them to make timelapses).
  • Has webpages that display the data for the current conditions and some historical (last hour, day, 7 days, month, year). The website theme changes with the time of day (4 options: sunrise, sunset, day and night).

All of the software for record and displaying the information is in a Github, I've even done some bug tracking, feature requests in there as well:

https://github.com/kmkingsbury/raspberrypi-weather...

This project was a great learning experience for me, I got to really dive into the capabilities of the Raspberry Pi especially with the GPIO, and I hit some learning pain points as well. I hope you, the reader, can learn from some of my trials and tribulations.

Step 1: Materials

Electronics:

Hardware

  • Raspberry Pi - I used the B+
  • Wireless adapter
  • Pi Camera
  • A solid 5V power adapter (this turned out to be painfully annoying, I eventually got the Adafruit one, otherwise the camera pulls too much juice and can/will hang the Pi, it's here: https://www.adafruit.com/products/501)

Materials:

  • 2 Thrust Bearings (or skateboard or roller-skate bearings will work too), I got these on Amazon: http://amzn.com/B0034G64XE
  • 2 Waterproof Enclosures (I used an electrical enclosure from the local big box store), doesn't matter much, just need to find a good size enclosure that's going to have enough space and protect everything).
  • Some PVC Pipe and End Caps (various sizes).
  • PVC mount brackets
  • Couple sheets of thin Plexiglass (nothing too fancy).
  • plastic standoffs
  • mini screws (I used #4 bolts and nuts).
  • 2 Plastic Christmas Tree Ornament - used for the anemometer, I got mine at the local Hobby Lobby.
  • Small dowel
  • Small piece of plywood.

Tools:

  • Dremel
  • Glue Gun
  • Soldering Iron
  • Multimeter
  • Drill

Step 2: Main Enclosure - Pi, GPS, Camera, Light

The main enclosure houses the PI, the Camera, the GPS and the light sensor. It is designed to be waterproof since it houses all the critical components, the measurements are taking from the remote enclosure and that one is designed to be exposed/open to the elements.

Steps:

Pick an enclosure, I used an electrical junction box, various project boxes and waterproof cases will work just as well. Key point is it has enough space to hold everything.

My Enclosure contains:

  • The raspberry pi (on standoffs) - Needs a WIFI chip, don't want to be running Cat5e into the backyard!
  • The Camera (also on standoffs)
  • The GPS chip, connected via USB (using a sparkfun FTDI cable: https://www.sparkfun.com/products/9718) - The GPS provides latitude and longitude, which is nice, but more importantly, I can get accurate time from the GPS!
  • two ethernet/cat 5 jacks to connect the Main enclosure to the other enclosure that houses the other sensors. This was just a convenient way of having cables going between the two boxes, I have roughly 12 wires, and the two cat5 provide 16 possible connections, so I have room to expand/change things around.

There is a window in the front of my enclosure for the Camera to see out of. The case with this window protects the camera, but I did have issues where the red led on the camera (when it's taking a photo) reflects off the plexiglass and shows up in the photo. I used some black tape to mitigate this and try and block it (and other LEDs from the Pi and GPS), but it's not 100% yet.

Step 3: 'Remote Enclosure' for Temperature, Humidity, Pressure

This is where I stored the Temperature, Humidity, and Pressure sensors as well as the "hook ups" for the rain gauge, wind direction and wind speed sensors.

It's all very straightforward, pins here connect via the ethernet cables to the required pins on the Raspberry Pi.

I tried to use Digital sensors where I could and then any Analog are added on to the MCP 3008 it takes up to 8 analog which was more than enough for my needs, but gives room to improve / expand.

This enclosure is open to the air (it has to be for accurate temperature, humidity and pressure). The bottom holes are popped out, so I gave some of the circuits a spray of a Silicone Conformal Coating spray (you can get it online or a place like Fry's Electronics). Hopefully it should protect the metal from any moisture, though you have to be careful and not use it on some of the sensors.

The top of the enclosure is also where the wind speed sensor fits. It was a toss up, I could have put the wind speed or wind direction on top, I didn't see any major advantages of one over the other. Overall you want both sensors (wind dir and speed) high enough where buildings, fences, obstacles don't interfere with the measurements.

Step 4: Rain Gauge

I mostly followed this instructable to make the actual gauge:

http://www.instructables.com/id/Arduino-Weather-St...

I made this out of plexiglass so I could see what was going on and I thought it would be cool. Overall the plexiglass worked ok, but combined with the Gluegun, rubber sealant and overall cutting and drilling it doesn't stay looking that pristine, even with the protective film.

Key points:

  • The sensor is a simple reed switch and magnet treated like a button press in the RaspberryPi code, I simple count buckets over time and then make the conversion later to "inches of rain".
  • Make it big enough to hold enough water to tip, but not so much that it needs a lot in order to tip. My first pass I made each tray not large enough so it would fill and start draining over the edge before it tipped.
  • I also found that residual water could add some error to the measurement. Meaning, completely dry it took X drops to fill a side and tip it, once wet it took Y drops (which is less than X) to fill and tip. Not a huge amount but came into affect when trying to calibrate and get a good "1 load equals how much" measurement.
  • Balance it, you can cheat by adding gluegun glue to the underneath ends if one side is vastly heavier then the other, but you need it as close to balanced as you can.
  • You can see in the photo I setup a little testing rig using some sponges and a wood holder to test and get it balanced properly before installing.

Step 5: Wind Direction

This was a simple weather vane. I based the electronics off the Maplin system:

http://www.philpot.me/weatherinsider.html

Key Points:

  • This is an analog sensor. The eight reed switches combined with various resistors divide up the output into chunks so I can identify which coordinate the sensor is in by the value. (The concept is explained out in this instructable: http://www.instructables.com/id/Accessing-5-button...

  • After screwing on the weather vane part you do need to calibrate it so that "this direction is what points north".
  • I made a test rig with wood so that I could switch in and out resistors easily that covered the full range of values for me, that was super helpful!
  • I used a thrust bearing, it did fine, I'm sure a regular skateboard or rollerskate bearing would have been just as fine.

Step 6: Wind Speed

This one I once again turned to the Instructable community and found and followed this instructable:

http://www.instructables.com/id/Data-Logging-Anemo...

Key points:

  • You can use the hall sensor or switch to a reed sensor as well. The hall sensor is more of an analog sensor so if you are using it in a digital way, like a button press, you need to make sure the reading/voltage is high enough that it acts like a true button press, rather than not enough.
  • Size of the cup is crucial, so is the length of the stick! Originally I used ping pong balls and they were way too small. I also put them on long sticks which didn't work either. I got very frustrated and then came across that instructable, Ptorelli did a great job explaining and it helped me out when my original design didn't work as well.

Step 7: Software

Software is written in Python to record the data from the sensors. I used some other 3rd party Git libraries from Adafruit and others to get the information from the sensors and GPS. There are also some cron jobs that pull some of the API information as well. Most is explained/outlined in the Git documentation at docs/install_notes.txt

The web software is in PHP to display it on the webpage while also utilizing YAML for the config files and of course the RRD tool to store and graph the data.

It utilizes the Weather Underground API to get some of the interesting data that sensors can't pull: Record Hi's and Lows, Phase of the Moon, Sunset and Sunrise times, there's also Tides available on their API, which I thought was really neat, but I live in Austin TX which is very far from water.

All of it is available on Github and is actively maintained and currently being used as I further refine and calibrate my own system, so you can submit feature requests and bug reports as well.

The software goes through a theme change depending on the time of day, there are 4 stages. If the current time is + or - 2 hrs from sunrise or sunset then you will get the sunrise and sunset themes, respectively (right now just a different background, I will probably do different font/border colors in the future). Likewise outside those ranges gives the day or night theme.

<p>Great Instructable, I'm trying to build this weather station, but having a few issues with moving the files to correct locations, where to put API key, GPS ( had it working on pi, now i get connection refused) and an empty website, I can get it to display any data.</p><p>Has anyone managed to get this working on Raspbian Jessie and a pi3?</p>
<p>I am having a really hard time getting any of the software to work. I can use the getAPIData module to print out the data on the screen, but it won't update the database; the raspberrypiweatherstation.py program does the same, and the web page just comes up empty. Everything in the database shows up as &quot;NaN&quot;.</p><p>I tried using &quot;updatev&quot; to get more info on the update problem and I get 19 error messages, complaining about RRA AVERAGE, MIN, and MAX not found for every variable.</p><p>I've been reading the PHP and RRD documentation but still can't get anything to work. (I am a programmer, familiar with C, VB, mySQL, and ODBC on various platforms).</p><p>Can anyone provide comprehensive instructions on the software setup. the install notes are just too vague for me to follow.</p><p>Thanks,</p><p>Walt</p>
<p>Hello. I've design some parts for the weather station. Can be downloaded from here:</p><p>https://www.thingiverse.com/thing:1420582</p>
<p>hola soy novato en esto me podrias ayudar de urgencia nose ya instale todos los updates del el archivo notes-install.txt pero no se como hacer que se me visualize en esa pagina con la lunas osea todo creoq es una pagina web me podrias ayudar xfa muchas gracias</p>
<p>Hi there, chief. Started to get all parts/materials to build the station with my RPi2; I went through all files from zip archive (from Github) but would be really-really helpful for many interested in this beautiful project if some wiring/schematics would be posted. Any suggestions? Much appreciated, thx.</p>
Use an Arduino nano to get the analog data, then dump it as serial data to the pi. Would be the easiest way.
I just put the data from the Internet and then push the weather data to an LCD screen using i2c.
<p>hey man,</p><p>I've seen you had a tentative of dropping some schematics. great. can't wait for them as I'm in the middle of building it. I HOPE we'll have them soon. Thx.</p><p>on the other hand, this is what's on your notes regarding the BMP180/183 sensor:</p><p>&lt;&lt;&lt;&lt;&lt;</p><p>&quot;BMP138:</p><p>wiring pins 8,10,12,16:</p><p>self.SCK = 8 # GPIO for SCK, other name SCLK</p><p>self.SDO = 10 # GPIO for SDO, other name MISO</p><p>self.SDI = 12 # GPIO for SDI, other name MOSI</p><p>self.CS = 16 # GPIO for CS, other name CE</p><p>bmp works staright up with ./measure.py</p><p>&gt;&gt;&gt;&gt;&gt;</p><p>the problem I have is that on RPI2's GPIO pin8 is SPI_CE0; pin10 is SPI MOSI (not MISO which is GPIO pin9). Which ones are the correct ones to connect the sensor with RPI2 ? thx again</p>
<p>Very nice work dude. Thank you for sharing with use. </p>
<p>Excellant project! Thank you for sharing. Could you please provide a schematic or drawing of the wiring connections?</p><p>Thank you.</p>
<p>Thanks! I don't have one, but you're right, it would be helpful to see how all the connections are made. I'll try to get one done and posted, thanks for the feedback.</p>
<p>Very good project! Please send me the wiring diagram too (if you have it). Thank you!</p>
<p>Thanks. If I can help by taking your hand drawings and creating a cad schematic please let me know.</p>
<p>hi, I cant understand how to build wind anemometer. Can you briefly explain? thanks</p>
<p>Bulid in magnetic sensor, every rotation 'put' signal, rpi read signal and calculate (how many signals/min), worst part is calibrating </p>
<p>I would like to buy a kit from you please, do you have anymore left?</p>
<p>Pricing the parts from Amazon is around $125 w/o the Pi and camera.</p><p>Little steep for my taste. Guess I'll have to buy pieces over a few months.</p><p>Looks like a really good build and I intend on making this though.</p>
<p>Good Day! can i ask you sir how the data transfer in to a website? because that weather forecast is my thesis project. thank you hoping that you reply. </p>
<p>i have a question, can anyone tell me how could i trasmit the data over radio?</p><p>thanks</p>
<p>Nice project. I have one question - why did you connect the wind direction reed switches to resistors as in the original Maplin design, when there is enough GPIO on the R Pi to do this completely digitally? Since your other sensors are digital, you could have saved the need for an ADC.</p>
<p>Awesome instructable, thank you! Your style to present all the data is especially nice.</p><p>I just saw these on Adafruit.com today -- would make a super easy accurate rain guage I bet. That plus a tube and a Pi-controlled valve to dump the tube once per day or something like that.</p>
<p>Oops, URL! http://www.adafruit.com/products/463</p>
<p>very nice weather station dude, super pimp. I am also interested in the $25 Kits i will email you too. </p>
<p>Thank you sir! I am a little late in finding this one but I have been looking all over the place for some Weather Underground API setups. I have a weather station (Davis Instruments Vantage Vue) which pushes data to Weather Underground, CWOP, and WeatherBug - it runs through weewx on a Raspberry Pi. I wanted to have a living room display of my weather stations information, extracted from Weather Underground, rather than generating it at home and your code fits a lot of the bill. More info at http://rpiexperimenter.blogspot.com/search/label/Weather%20Station on what I am doing. Thanks for the instructable!</p>
<p>I may just be missing it but can you post the Gethub address?</p>
<p>Really great idea! Excellent detail on the mechanicals and software. <br>Thank you. However not sure how anyone can use this instructable to <br>build anything without a wiring diagram or schematic. Is it possible you can share? Could try to backward engineer this but a schematic or simple wiring diagram would be very useful and appreciated.</p>
<p>I Like It! Been Looking for a good way to make a weather station for months. this is the best i have found and.reading the comments here, I think other think the same as me. Once you have to drawings I am super interested. Also could you delve into the anemometer a little more with the bearing set up?</p>
How much did all of this cost roughly?
<p>I had a lot of the parts already, but I probably spent about $100 (some pieces took a couple builds as well before I found a good design so I wasted some materials) the most expensive pieces are the Pi, GPS, Camera. Everything else is like $5 here, $10 there, but it does add up. Sensors were relatively cheap between $2 (Reed Switch) to $10 (the BMP183). To start from scratch I guess it would cost somewhere in the $100 to $150 range (Just a PI, Camera and GPS puts you easily at the $100 mark though).</p>
<p>you have chosen quite sturdy and thus relatively expensive reed switches. Glass switches are a lot cheaper and once they are mounted they are protected enough I think, so yeah it is possible to cut down here and there.<br>For those who will just build it for their own place... indeed GPS could be omitted (and get a cheap RTC (DS3231) (but that would mean rewriting the code) <br>Anyway, really impressive</p>
<p>Great instructable.</p>
<p>Thanks!</p>
<p>Looks great! I would like to know how much time did it take you to build it? I've never worked with the rasp before, do you think it would be achievable for me?</p>
<p>Thanks! It took me a while, on the scale of weeks, it was my first dive into the Raspberry Pi and I had never worked with some of the sensors before, though I had decent experience with the Arduino. Though that's entirely why I did the project: it was a good dive in to the Pi as well as sensors with a clear end goal in mind, rather than just tinkering and learning. I think it's achievable for everyone, I don't think I did anything crazy or very advanced in the project, it was a lot of combining a bunch of little pieces and concepts into an end result. </p>
<p>Very nice project. I am doing something similar for my boat, and will be using many of the same sensors.</p><p>Why do you need a GPS? You wrote for accurate time and your location. But your location is fixed, so get it once and set it. And accurate time is available to you over the network via NTP.</p>
<p>Thanks! You are correct, in all reality you don't need the GPS, it's easily to get GPS coordinates off of Google Maps the one time you need them and as you said you can get time from NTP off the network. I like using the GPS because it makes the whole project self contained, it then doesn't depend on any outside resources/services, that's all.</p>
<p>Which GPS chip did you use? You link to SParkFun is for an FTDI cable, which I already have, BTW. I really want to try this one!</p>
<p>I have this one, I started out with it for testing and figuring it all out, which is the EM406: <a href="https://www.sparkfun.com/products/retired/10709" rel="nofollow">https://www.sparkfun.com/products/retired/10709</a></p><p>But for the project, I used just the chip off an old Pharos i360 GPS (which was a Bluetooth GPS I used with my Dell Axim (like a palmpilot) for navigation in the days before iPhones. It works fine, just less channels so it seems to take longer to acquire and can get a less accurate fix.</p>
Great project, I love weather stations, voted times by two! Ps. I've built a soil temperature probe for my weather station, which proved to be very useful.
<p>Thanks! I had heard about a soil temperature probe but dismissed it, I'll have to go check it out now. Thanks for the tip!</p>
Thanks!
<p>Cool! Really useful if you are growing vegetables like potatoes and carrots. I track the soil temperature from day to day with a graph to assess when planting is ok.</p>
<p>Do you have an Instructable for this? I am a weather geek, so I plan on making my own equipment</p>
Yes, Matt, here it is, it works very well:<br> <a href="http://www.instructables.com/id/Weather-station-aux-sensor-improvement-for-use-in-/" rel="nofollow">http://www.instructables.com/id/Weather-station-aux-sensor-improvement-for-use-in-/</a><br>
<p>Whilst you are to be commended for uploading all this information,</p><p>there are so many abbreviations, that, to be honest, I haven't a clue what you mean.</p>
<p>I really like the use of the plastic ornament shells! Thanks for posting this -- my students keep &quot;Oooh&quot;-ing at the project!</p>
<p>Using the ornaments actually came from another instructable, it really was a great idea, I originally used pingpong balls which didn't cut it! Glad your students are enjoying it, since you're a teacher, and if you're eligible you should try and get on the list to be one of the test schools for the official project, it sounds really great. Here's a link with details and their application: https://www.raspberrypi.org/education/weather-station/</p>
<p>Awesome! I'll try to make this one!</p>
To turn off the pi camera led you can disable it through raspi-config.

About This Instructable

202,978views

1,254favorites

License:

More by kkingsbury:Scrappy Science Caddy NOAA Satellite Signals with a PVC QFH Antenna and Laptop  Folding Project Table 
Add instructable to: