user26717: My little weather station is run on a Nano and has the anemometer and the temp/humidity sensor.  A smoke detector is on the way because I live where wildfire is a big concern.  
I would like to build a simple weather vane without spending a lot to buy the commercial solutions.  Rotary potentiometers have dead spots and using a bunch of hall effect sensors would use up too many digital inputs to be useful, afaik.  
Question:  How can I build a simple direction sensor?

user4143: Another option (similar to reed switches) is to do it optically.
The vane is on an axle. The axle has a disc attached to it. The disc has a small notch out of the edge.
Positioned around the edge are a whole series of photo-interrupters. The disc spins between the infra-red beams and the notch allows only one of them to pass light at a time.
Make the notch the right size so that as one interrupter turns off the next one turns on - you need one on all the time. You could over-compensate slightly so that on occasion two adjacent interrupters are on at once, in which case you can say it's between the two.
A similar system is to use a disc with a series of special slots cut in it (see Gray Code) which allow light to pass through onto a line of photodiodes. In different rotations different combinations of photodiodes are on, and that gives you your direction.

user26717: I decided to go with 4 reed sensors.  With experimentation I found I can successfully detect 8 distinct directions using 4 reed switches since the rare-earth magnet will switch two on at once when it is in between.  
Thank you all for your answers.  Upvotes for everyone for the discussion.

user10394: Its a long time since I looked at this and the details are a bit misty, so sorry for the inaccuracies, but I'm sure people will correct them for me :)
I originally brought one of these http://www.maplin.co.uk/p/maplin-replacement-wind-direction-sensor-for-n96fyn96gy-n81nf and then decided to take it to bits, like you do.
The vane spins a magnet around and this triggers 1 of 8 reed switches as it passes around.  The read switch is connected to VCC and a resistor and the resistors feed into a common wire back to the microprocessor.  The 8 resistors all have different values, so the result is a differing output voltage depending on which reed switch has been triggered.
So what you need is:

A magnet 
A number of read switches positioned far enough apart so only one is triggered at a time
A number of different resistors

Supply 5V from you Nano and read the result on an analogue pin, then come up with a calibration table to work out the direction.
I hope that makes sense.
(Sorry I can't draw you a circuit diagram)

26717: <p>My little weather station is run on a Nano and has the anemometer and the temp/humidity sensor.  A smoke detector is on the way because I live where wildfire is a big concern.  </p>

<p>I would like to build a simple weather vane without spending a lot to buy the commercial solutions.  Rotary potentiometers have dead spots and using a bunch of hall effect sensors would use up too many digital inputs to be useful, afaik.  </p>

<p>Question:  How can I build a simple direction sensor?</p>
 4143: <p>Another option (similar to reed switches) is to do it optically.</p>

<p>The vane is on an axle. The axle has a disc attached to it. The disc has a small notch out of the edge.</p>

<p>Positioned around the edge are a whole series of photo-interrupters. The disc spins between the infra-red beams and the notch allows only one of them to pass light at a time.</p>

<p>Make the notch the right size so that as one interrupter turns off the next one turns on - you need one on all the time. You could over-compensate slightly so that on occasion two adjacent interrupters are on at once, in which case you can say it's between the two.</p>

<p>A similar system is to use a disc with a series of special slots cut in it (see <a href="https://en.wikipedia.org/wiki/Gray_code" rel="nofollow">Gray Code</a>) which allow light to pass through onto a line of photodiodes. In different rotations different combinations of photodiodes are on, and that gives you your direction.</p>
 26717: <p>I decided to go with 4 reed sensors.  With experimentation I found I can successfully detect 8 distinct directions using 4 reed switches since the rare-earth magnet will switch two on at once when it is in between.  </p>

<p>Thank you all for your answers.  Upvotes for everyone for the discussion.</p>
 10394: <p>Its a long time since I looked at this and the details are a bit misty, so sorry for the inaccuracies, but I'm sure people will correct them for me :)</p>

<p>I originally brought one of these <a href="http://www.maplin.co.uk/p/maplin-replacement-wind-direction-sensor-for-n96fyn96gy-n81nf" rel="nofollow">http://www.maplin.co.uk/p/maplin-replacement-wind-direction-sensor-for-n96fyn96gy-n81nf</a> and then decided to take it to bits, like you do.</p>

<p>The vane spins a magnet around and this triggers 1 of 8 reed switches as it passes around.  The read switch is connected to VCC and a resistor and the resistors feed into a common wire back to the microprocessor.  The 8 resistors all have different values, so the result is a differing output voltage depending on which reed switch has been triggered.</p>

<p>So what you need is:</p>

<ul>
<li>A magnet </li>
<li>A number of read switches positioned far enough apart so only one is triggered at a time</li>
<li>A number of different resistors</li>
</ul>

<p>Supply 5V from you Nano and read the result on an analogue pin, then come up with a calibration table to work out the direction.</p>

<p>I hope that makes sense.
(Sorry I can't draw you a circuit diagram)</p>
