# Anemometer only showing up to 36 kph

Hi,

I am puzzled with a problem and would like to ask for some advice on this.
I’ve got an anemometer FST-200 and this should give a wind speed value from anything from 0 kph all the way up to 180 kph.
I have connected the input to an analog pin A15 on a MEGA2560.
This device works great all the way up to 36 kph. This is the absolute maximum I’ve ever recorded.

Here’s my code:

The variables:

``````//Anemometer FST200
float windSpeed;                //Current wind speed
``````

The function

``````void windSpeedFunction() {
windSpeed = map(readWindSpeed, 0, 5, 0, 180)/1000;
}
``````

So basically I’m monitoring the voltage on A15 (0 to 5 Volts) and then scale it to a value between 0 to 180 kph.
Why does it hang up at a maximum of 36 kph?

Your opinion will be appreciated! Thanks.
Cheers,

Luc

Your comment says that readWindSpeed could have a value from 0 to 1023, and then you map 0 to 5 VOLTS when you should map 0 to 1023. Furthermore, the result of the map function is long, so the division by 1000 will be an integer division (e.g. 999/1000 is ZERO!).

Fix those problems and then get back to us… and show the ENTIRE program next time.

Problem solved!

The problem was caused by another sensor (Rotronic humidity sensor). The latter needs an analog voltage between 0 and 1V. So, at the start of the humidity function I had included:

analogReference(INTERNAL1V1);

So, this limits the analog voltage to 1V. The anemometer hung up at 36 kph, which is exactly the value of 1V (36 kph x 5 = 180 kph). So at the start of the anemometer function I had to include following line:

analogReference(DEFAULT);

My apologies for wasting anybody else's time.

The code is for my weather station. So far I've got about 800 lines of code. That was the reason why I didn't send the whole sketch.

Cheers,

Luc

Uh, NO. There is a good chance that someone, possibly me, could have picked out the real problem if we could have seen ALL of the code.

could have picked out the real problem

The problems you did discover are real problems.