Connection
The anemometer uses an infrared (IR) sensor with four pins: VCC (power), GND (ground), D0 (digital output) and A0 (analog output). Output D0 is used for speed measurement, which, together with the power supply, is connected to pin P0 on the expansion board with three Dupont wires - D0 to the yellow signal rail, VCC to the white power rail and GND to the black ground rail.
Expansion board MB2
Expansion board MB3
Recommendation
When you first start the anemometer, you need to set the sensitivity of the IR sensor. Start by inserting a Phillips screwdriver into the blue square on the sensor. By turning the screwdriver, you are able to set the switch point. This allows you to determine when you want the sensor to turn on.
Programme
Wind speed
The program starts by setting up variables to store information about wind speed in various units. It then repeats the section of code that tracks the signal from the wind wheel. When the sensor detects a rotation of the wheel, the number of revolutions is counted. The program then measures time and performs calculations every second: it calculates how fast the wheel is rotating per second, then determines how fast the entire wheel is rotating and converts this to wind speed in various units. Finally, the resulting wind speed is displayed on the display.




