There is a previous thread in which a person goes through the perils of trying to get a commercial wind direction sensor working, and running into all sorts of issues with false or incorrect readings. The sensor is based on someone’s design based on magnets, reed switches and resistors.
It seems to me that this design suffers from:
(A) a lack of precision. Only 16 different directions are allowed.
(B) you can’t just plug it in, align it and know it’s right. It has to be carefully calibrated and sketch code adjusted each time it is used.
It seems to me an all digital approach would be simpler and more reliable.
A printed screen that has (say) 8 concentric circles made of dashed lines. The disk is mounted on the shaft of the wind direction vane.
Above the disk is mounted a light source.
Below the disk is mounted a row of photo transistors.
Each transistor is turned on or off depending on the rotational position of the disk.
Readout is a binary 8 bit number.
This should give a precision of 256 different directions.
Accurate positioning of the transistors and printing of the disk will ensure accurate and repeatable readings.
Add more circles and transistors to get even greater accuracy.
Installation involves determination of the local north relative to the disk position and put that number into your code. Determination of direction is a simple maths problem, not requiring a lookup table.
Add a shift register to serialise the data and feed it into one Arduino I/o pin. Power the transistors from another pin and you have an on/off function.
The question is, does anyone know where I can buy one of these ready made ?