Arduino Weather Station Part2




About: Lazy Old Geek

So my last project was a Arduino wind chill machine.

Naturally, this Lazy Old Geek wanted to add a weather vane (wind direction) to my weather station. Who cares, you may ask? Well, I am a Geek. Actually, wind direction has some importance. Here in the high desert, the winds are usually from the west. But sometimes we get some wrap around and the wind comes from the North or East which usually means it’s coming off the mountains and is probably colder. Also sometimes we actually get smoke blowing in from wildfires in Utah, Nevada and even California.

Example: Outdoor burning by permit is allowed in my county. Just the other day, there was some burning nearby and I could tell by my weather station that it was not going to be blowing in my direction so I could keep my window open.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts List

USB Freeduino (Arduino-clone) $ 22.50
Adafruit Data logging shield        $19.50

SD Card                                           $ 6

Aluminum NoTrespassing Sign      $ 2
Potentiometer 6639S-1-103-ND   $12 (Digikey)
2 2”x 1/2” Mending plates              $ 1
100ft Ethernet Cat5 cable              $ 8 (Amazon)
2 Ethernet Couplers                       $1.40 (

Prices US dollars March 2011

Any USB Arduino should work but it is easier to wire it up to an Arduino shield so the clone would have to be shield compatible. There are some good deals on ebay for Arduino Duemilanove 2009 for about $18.

So why did I add the Adafruit Data Logging Shield, you may ask? Well, if I want to collect long term weather data say overnight, then I have to leave my computer on. With the data logger, I can record the data to an SD card and don’t have to keep the computer on all night.

The potentiometer is special in that it’s called continuous turn. Most potentiometers rotate about 350 degrees and stop. Those wouldn’t work for a weather vane. This one will keep rotating no matter what direction the wind comes from.

Step 2: Weather Vane Design

Problem: How to design a weather vane.
Solution: So I did some research on weather vanes. How they work is that the weight is distributed evenly so that the ½ is on one side and ½ is on the other side but that it is also balanced like a teeter-totter, for those older people who remember those. For wind motion the surface area of the ‘tail’ has to be much greater than the head.
So I had a pretty clever design for an Old Geek. I took an aluminum ‘NoTrespassing’ sign. The piece I had was 10” x 7.5”. I cut it in half on the diagonal with a pair of scissors. From one side, I cut two triangles out of it as per the drawing. Now these two triangles match up to the point of the big triangle. Using some spray adhesive, I glued the smaller triangles one on each side of the big triangle.
Using some trigonometry, that means that the weight of each ½ of vane is equal.

Problem: However, the weight is not distributed equal. The tail piece has more weight farther out and the point has more weight in the center.
Solution: So I took a pencil and stuck it under the weather vane perpendicular to the triangle and shifted it until it was balanced. It was about 5.5” from the point. This isn’t really too critical. At this point, I cut a 3/8” slot about 1/2” to clear the potentiometer. Center one of the mending plates over the slot and drill holes for 8-32 mounting hardware.


Step 3: Potentiometer Modification and Installation

Problem: The potentiometer had a cylindrical shaft (see picture). It would be difficult to attach the weather vane securely to this.
Solution: I decided to flatten part of the shaft so that it would be easier to attach.
I used the mending plates and built a clamp to hold the potentiometer (see picture). Then I clamped the assembly in a vise and used a cut off wheel in my drill press to flatten a spot on the shaft (see picture). I apologize, I didn’t take a picture of the results but it was about 1/8 of an inch ground off.

Problem: I decided to mount the weather vane potentiometer on the bottom of the same ½” PVC T used for the anemometer (See Arduino wind chill machine). Unfortunately, the width of the potentiometer is 0.875” and the inside diameter of the T is about 0.84”.
Solution: I would not recommend this method but this is what I did. First I disassembled the wind chill assembly except for the bearing. Then I clamped the T in a vise. All I had was a 7/8” spade bit. I would recommend you use what’s called a 7/8” Deming bit but I didn’t have one and didn’t want to spend the money for a one time usage. So I put the spade bit in my drill press and ‘centered’ the spade bit so that it was in the middle of the T opening. Then I clamped the vise so it couldn’t move and carefully drilled out the opening to a depth of about 0.45”. The hole wasn’t very neat but it did accept the potentiometer.

Step 4: Wiring and Assembly

Next I built a little bracket for the potentiometer (see picture). I used part of the left over piece of the aluminum sign doubled up. I cut a strip about 7/8” x 3.5”. In the middle, I drilled a 3/8” hole for the potentiometer. Then I attached the potentiometer using the nut. To make it a little easier to calibrate, I adjusted the potentiometer to 0 ohms between pins 1 and 2 then rotated the potentiometer so the flat part of the shaft was along the length of the bracket, then tightened the nut. (This isn’t necessary to do at this point but it makes it easier later) Using the PVC T as a guide I bent the sides of the bracket up and drilled holes in the bracket and through the PVC T for 8-32 hardware. Make sure the holes clear the lugs on the potentiometer.

Blow out any plastic particles that may have dropped into the T around the bearing. Reinstall the bolt for the anemometer through the bearing.

See schematic. I attached a 6.8K resistor to pin 1 of the potentiometer. I also drilled another hole in the T for the wires coming from the potentiometer. I used telephone cable to connect up to the potentiometer and potted it with hot glue. Because I needed more wires than before, I had to rewire the anemometer and thermal sensor changing it to eight wire Ethernet cable. Needless to say I did an ugly job of wiring everything up (see picture). But everything was connected and the wiring was isolated and supported with hot glue. I would recommend you use a DMM ohmmeter to make sure everything is wired correctly.

Slide potentiometer into the T and attach with 8-32 hardware. I let the excess wire stick out the T.

Now put one of the mending plates on each side of the weather vane and loosely attach with 8-32 hardware. I think I had one washer on each side. Then slide the vane assembly over the potentiometer shaft and tighten.

Reattach the anemometer assembly.


Step 5: Adjustment and Calibration

Now the weather vane needs to be oriented so the potentiometer will know which way is North.
½” PVC is fairly flexible with 5ft length. I happened to have some larger PVC, I think it must be ¾” SDR21. Anyway the ½” PVC fits inside it and gives it some strength. I put a T near the bottom with an extension in my fence. I just have an end cap on the ground instead of driving it into the ground. I bolted the ¾” and ½” PVC together so the assembly won’t rotate. I attached the ¾”  pipe to a T pole in my fence with some heavy wire. All of the PVC connections should be cemented but I haven’t done that yet. I oriented the arm so that it is pointing North. For the perfectionists, remember that there is a difference between magnetic North and true north called magnetic declination. Here is a website to find yours. Interestingly, it changes with the time of year, but for my location, it’s about 10 degrees which is not enough to matter for me.

I connected the Ethernet cable from the weather assembly to a 100 foot Ethernet cable with one of the Ethernet couplers. I fed the other end of the cable into my house and attached the other end to my Arduino shield with another coupler.

Calibration: Using a piece of tape, lock the weather vane so it’s pointing North and measure the voltage from the potentiometer. By the way, I added the 6.8K resistor so that the output will never go over 3Vdc which is what I have the Aref set to. Anyway, I was expecting it to read 0Vdc at North but it was actually 1.5V as I had the potentiometer mounted 180 degrees off from my original. Now you can correct this by loosening the nut holding the potentiometer to the bracket and carefully rotating the potentiometer but for me it’s easier to just adjust it in the Arduino software.

Step 6: Arduino Software

Arduino software is attached

Most of the software is taken from the Arduino Wind Chill meter. I added the code for the SD card and real time clock.
I am not going to go into detail of the weather vane stuff as most of you don’t care. Basically, I divided the directions into sixteen different ones. By measuring the voltage coming from the potentiometer, you can determine the direction of the wind.
Here is an example of what the Arduino will output to a serial terminal when attached to a computer. Every 10 seconds, it displays the Temperature in Fahrenheit, Wind MPH, Twc(Temperature wind chill F), wind direction. The DirInt is a numeric representation of direction. The reason I output a ‘$’ is so that my computer program can synch to the Arduino serial data easier. That’s also why I use the DirInt. Computers can deal with numbers easier than letters.

Now the Arduino writes to a CSV (comma-separated-value) file on the SD card. It has the same information but also includes the date and time.
3/19/2011   12:41:47   60.4   7.1   60.4   WSW   11

This can be read into Excel, Open Office or Google Docs as a spreadsheet.

Step 7: VB Express Software

The previous software may be adequate for some people. But I wanted a little bit more visual display of the data so I wrote a VB Express program.
I’ve included the software in a zip file. Here is a screenshot.

The program was written for M.S. Vista and requires a directory under documents called WeatherData. It may not work on other operating systems.

To install, copy the zip file to a directory. Make sure you have internet access, run setup.exe.
To run the program, the main thing you have to do is determine which serial port your Arduino is connected to and type it into the Arduino Com Port textbox. Then it should run automatically. In the blue panel is maxs and mins for the day. (If Min Temp is zero, click on Reset button). The data is updated from the Arduino. I made a little graphic display to show wind direction. As speed increases the arrow gets longer.

The program also automatically writes data to a CSV file under documents, WeatherData, MonDay.csv. The data is averaged over a one minute sample.

Conclusions: While I don’t expect any/many readers to duplicate this project, I hope it provides readers with ideas on interfacing with the Arduino and some of it’s capabilities. My next addition will be a rain gauge.

MakerBot Challenge

Participated in the
MakerBot Challenge

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    21 Discussions


    3 years ago

    I built this anemometer and have had good results with it. One suggestion is about the code you wrote for the Arduino. You are polling the sensor for spins of the anemometer. A better approach, which I'm using, is to use interrupts on the Arduino. More reliable and accurate.

    2 replies

    Reply 3 years ago

    hi weswitt can you tell me how to built the anemometer


    4 years ago on Introduction

    hello mr. msuzuki. i have some problem wit my project. i've made an anemometer using optical absolute encoder. can i use your code to get calibration for my anemometer ? cmiiw

    sir good project you have.. i will also do this one but i'm facing a bit of a problem in codings in arduino, i'm also a beginner in using arduino.. sir can i use/see your codes as a tutorial/backup so i can easily understand the project.. tnx sir..

    1 reply

    Yes, feel free to use the Arduino code. It is in the zip file in step 6. I made another version with a rain gauge.
    with some more Arduino code.
    Hope this helps.



    5 years ago on Introduction


    How much turning resistance is there with the 360degree POT you used?

    I notice that your wind vane is very large. I would like to build one much smaller. Will your choice of POT allow a smaller vane in light wind?



    1 reply

    Reply 5 years ago on Introduction

    I had no way of calculating the size of the weather vane size. Turning resistance is definitely a factor plus wind speed. But hardest to calculate would be the aerodynamics of the vane. I just kind of guessed on the size I needed.

    TIP: One way to eliminate turning resistance of a pot is to use some kind of no-contact sensing. In one of my early designs I used a magnet and eight reed switches. Similarly, you could also use a set of hall effects switches.

    But I don't think the turning resistance is a significant factor. My guess is that a better wind vane design(balance and shape) would yield a much smaller physical package.

    Unless you are or know a good physicist, it's probably a lot of trial and error.



    7 years ago on Step 7

    Great project, have you considered interfacing it with wview opensource weather station software?

    1 reply

    Reply 7 years ago on Step 7

    I hadn't heard of wview so looked it up. It looks like some nice software but seems to be Linux-based only. I don't have a Linux machine and haven't programmed in Linux/Unix for years so probably not.


    By the way, I'm still using my weather machine almost daily and did add the rain gauge.


    8 years ago on Introduction

    Suzuki-san, Yesterday someone gave me an anemometer, but without a weather vane, that's only 1/2 the goal. Now you gave me the other 1/2 with your "ible" so thanks, truly! I will adapt it to a XBee radio, but your mechanical design is just what I'm looking for. I eagerly await your rain gauge!!

    7 replies

    Reply 8 years ago on Introduction

    I just published my rain gauge.

    How's your project going?



    Reply 8 years ago on Introduction

    Right now it's sitting on the self because I'm painting my house, certainly not an instructable! However I was talking with a physicist friend who is urging me to consider an angular magnetic sensor, similar to:

    But I'm also getting ready to celebrate my mother-in-law's 88th birthday, so sadly, the weather station has just been relegated to a lower status for now. I look forward to reading your latest installment: the rain gauge. Thanks for thinking of me.


    Reply 8 years ago on Introduction


    My weather station is pretty low priority but fortunately, I don't have a lot else going on. Except I'm trying to help one cousin with a computer problem, another with a car problem and some plumbing problems of my own.

    I am also trying to make a cheap USB-BUB.

    That magnetic sensor site looks pretty interesting. I've been trying to find information that explains these sensors on a level I can understand. This does a pretty good job for those specific sensors. You're pretty lucky to have a physicist friend.

    I was a little disappointed that my GPS couldn't give compass direction unless it was in motion. But now that I understand basically how GPS works, it makes sense. I would like to build a cheap digital compass.



    Reply 8 years ago on Introduction


    This is actually the second one I made. Many years ago I built one with a magnet and I think eight reed switches. The problems I remember were building some custom PCBs to mount the reed switches plus having to run nine wires back to the electronics. I like this design better.

    I assume you're going to use the XBee to make it wireless? I'm curious as to how you do that as I've never used XBee.

    I've started the rain gauge. It's based on the tipping bucket method but I have a way to go.


    Reply 8 years ago on Introduction

    Well, I've never used the XBee either, and that's exactly why I'm going to jump in!

    I looked at the datasheet for the continuous turn potentiometer and it said that the pot has an electrical angle of 340 degrees. Does this mean that there's a 20 degree dead spot in reading wind direction? Right now I'm tossed between a pot and a rotary encoder and all of the continuous turn pots I see seem to have that 340 degree electrical angle. I looked at pots on wikipedia, but haven't found an answer yet.


    Reply 8 years ago on Introduction

    You are correct, there is a dead spot. It didn't seem like it was 20 degrees to me but it could be.

    For my purposes, I won't even notice a 6% error which 20degrees would be and I already limited my output to 16 distinct values which is 22.5 degrees each. I don't believe the Arduino will have trouble with the dead spot either as I think the Analog inputs have a built in pullup which would just dump the dead spot into the >2812 reading which in my case is South. I'm not going to know the difference between wind from the South or SSW anyway.

    But you are correct, a rotary encoder would be better. I would be concerned about price, resolution, wiring requirements and decoding . Some of the cheaper ones seem to have 12 divisions per revolution which is 30 degrees.

    If you find something you like, let me know.

    Good luck with the XBee. I recently read an article where someone built a wireless rain gauge with a cheap wireless doorbell. I thought that was pretty innovative.



    Reply 8 years ago on Introduction

    Well, good news, some bad news, and then more good news: I found Vishay pots with electrical angles of 352 degrees, but sadly they start at about 40 bucks! However I discovered that where I live, Albuquerque, essentially no wind arrives from approximately NNE to ENE with a "null" at about NE. So, if I center the 20 degree dead spot at NE and massage the code slightly, I can pretty much cover all our local winds with the reasonably priced pot that you used. Time to start building...


    8 years ago on Introduction

    One option is to attach a magnet to the vane, and use a 2D magnetometer to read the angle, High precision, won't wear out, and you can weather seal the electronics without an axle going through the case.

    If you do this. make sure you get a magnetometer that's not limited to the earth's magnetic field strength (I made that mistake first)

    1 reply

    Reply 8 years ago on Introduction

    Sounds like a good idea. I've never worked with magnetometers and don't know much about them. Where do you get them and about how much are they?