I have to configure my station to calculate the wind speed.
Some years ago, I bought this anenometer
They wrote the following
0.4V (0 m/s wind) up to 2.0V (for 32.4m/s wind speed)
My board is Cotex MO as the Arduino Zero
- ATSAMD21G18 ARM Cortex M0 processor,
- clocked at 48 MHz
- and at 3.3V logic
I connected the anenometer signal to A0.
Then when I read my analog pin
int windValue = analogRead(A0);
I supposed when it retuen 0, there is NO wind
and when it return 1023, the anenometer measure 32.4 m/s wind speed
when the anenometer return 0.4V, I should read 0 at the analog red pin, and
when the anenometer return 2V, I should read 1023 at the analog pin
Are you agree?
Keeping in mind that 0.4V is no wind and 2V is wind speed of 32.4V, which will be the best wayy to measure the wind speed?
I suppose, I should convert the analog read to voltage and I am not sure about my proposal
float windValue = analogRead(A0); //Get a value between 0 and 1023 from the analog pin connected to the anemometer windValue *= 3.3; // Multiply by 3.3V, our reference voltage windValue /= 1023; // convert to voltage
Let say, there is a tornado, the anenometer (if it still there ) should return 2V at I should read 1023 at A0. If I want to convert 1023 in volatage, as my reference voltage is 3.3V, I would calculate
1023*3.3/1023=3.3V, but the result should be 2V.
Then I wonder I would better use map
wind_volt = map(vaéue, 0,1023,0.4,2);
and use again map to know the speed
wind_speed = map(wind_volt,0.4,2,0,32,4);
I am realy not convainced about using twice the map fonction
What would be your recommandation?