Close

Wind Vane ( Wind Direction Sensor)

A project log for Solar Powered WiFi Weather Station V3.0

ESP32 based Open Source Weather Station

Debasish DuttaDebasish Dutta 10/07/2021 at 14:230 Comments

The wind vane indicates the direction that the wind is blowing. It is the most complex of the sensors in the Sparkfun Weather Sensor Kit. It has eight reed switches, each connected to a different resistor. As the wind vane rotates, a magnet closes the reed switches and may close two at a time due to their proximity to each other, allowing up to 16 different positions to be indicated. However, in testing the unit, I never could make the device close two switches at once, so although it might be possible theoretically to measure 16 directions, I only get eight. The software takes 16 directions into account, just in case.

An external resistor can be used to form a voltage divider, producing a voltage output that can be measured with an analog to digital converter, on your the microcontroller allows you to determine the direction of the wind vane pointer.

To measure voltage output, I have used a 10kohm external resistor to form a voltage divider with the wind vane resistor ( Rvane). The 10K resistor is connected to 3.3V as shown in the above figure. Then, I connect the middle of the divider to the ESP32 ADC pin (GPIO 35), measure the voltage, and by referring to the table shown above, convert to the wind direction.

The reed switches and resistors arrangement are shown in the above picture. Resistance values for all 16 possible positions are given in the table.

When the wind vane pointer falls in between two switches, the resistance value is considered as the equivalent resistance between the two adjacent resistances. In this situation, the vane’s magnet activates two switches simultaneously, as result they are connected in parallel.

Example:

When the wind vane pointer falls in between the Switches S1 and S2, the equivalent resistance is determined by the following formula:

Rvane = R1x R2 / ( R1+R2 ) = 33 x 8.2 / ( 33 +8.2 ) = 6.57K

Since the values outputted by the wind vane are based on degrees, you can, in theory, have any value represent any direction. However, it is recommended to have the value at degree 0 represent North for ease of use.

Discussions