Hello Guys
I was searching a wind speed code for an anemometer using a hall sensor and I found this...
Can anyone explain me why there is a "4 * pi" in the code to calculate wind speed in m/s?

//Calculate revolutions per minute (RPM)
void RPMcalc()
{
RPM = ((counter) * 60) / (period / 1000);
}
//Calculates wind speed in m/s
void WindSpeed()
{
windspeed = ((4 * pi * radius * RPM) / 60) / 1000;
} //end WindSpeed
//Calculates wind speed in km/h
void SpeedWind()
{
speedwind = (((4 * pi * radius * RPM) / 60) / 1000) * 3.6;
} //end SpeedWind

The velocity of a point on the edge of a spinning disk is 2PIR*(rotations/sec).

For a spinning cup anemometer, one might assume that the wind velocity is the same as the velocity of the cup outer tips (as true for a vehicle tire in contact with the road), which would explain part of the above formula.

To go further depends on the rest of the code, and the details of the anemometer, which you forgot to post.

And of course, there is no reason to believe that the formula is correct. It is easy to calibrate an anemometer by mounting it on an automobile, and driving at various speeds on a wind-free day.

You'd definitely need to calibrate something like this by measurements in a windtunnel (in
other words use the manufacturer's datasheet formula which was derived from such measurements).

I suspect the logic behind that "ideal" formula is that wind hits the cup, gets turned round by the cup and
stagnates. To stagnate the air this way the cup would need to move at 1/2 the wind velocity, so that
the wind velocity is thus twice the cup velocity.

Which is all complete rot of course as there's no reason to suppose the air will stagnate coming out
of the cups, its most likely to stagnate in the cups. Its a balance between the aerodynamic drag of
the returning cups at Vw+Vc versus the aerodynamic drag of the cups facing the wind at Vw-Vc, and
complicated by the wing action of the cups that are side-on to the wind...