To determine wind direction, I had been thinking of using some kind of potentiometer for some time, but none of them that I had seen could do a continuous 360 degree rotation. Then I found a post on Instructables from msuzuki777 where he made a weather station using an Arduino (check it out
here). In the instructions, he mentions the continuous-turn potentiometer that he used for wind direction. From this I ended up buying two different potentiometers from Digikey, but only one of them was accurate enough for wind measurement (the other, cheaper one had a huge deadband).
This turned out to be the Bourns 6639S-1-103
. It ended up having very little deadband and was fairly consistent on its measurements. The only issue is that the Raspberry Pi is a digital-only device and has no way to directly measure an analog input. This is very easy to do on an Arduino, but you must use an analog-to-digital converter (ADC) on a Raspberry Pi.
Bournes Continuous-Rotation Potentiometer from Digikey
For the converter, I used the MCP3008 from Adafruit which was only a few dollars. It is an 8-bit converter, meaning that it separates the analog voltage into 1024 steps which is plenty for a wind vane. The ADC connects to the Raspberry Pi via SPI which is slightly more difficult to use than I2C, but Adafruit had great code written for the converter already.
MCP3008 ADC from Adafruit
The only thing left to do here is to get the whole setup attached to a wind vane. I will have to ensure that the wind vane is large enough to provide enough torque to turn the potentiometer at relatively low wind speeds.