Wind speed measurement via pulse counter

Hello,

I would like to measure the wind speed with an anemometer, which outputs one pulse per revolution with the pulse counter.

If the anemometer delivers one pulse per second, the wind speed is 2.4km/h.

From this you can calculate the radius, which is 0.106133 mm.

Therefore I thought that I am correct with the following code:

sensor:
  - platform: pulse_counter
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
    unit_of_measurement: 'km/h'
    name: "${friendly_name} Windgeschwindigkeit"
    icon: 'mdi:weather-windy'
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    internal_filter: 13us
    update_interval: 60s
    filters:
    - lambda: >-
         return 2 * 3.14 * 0.106133 * x / 60 *3.6;

I had actually expected the wind speed in km/h. However, this results in the following:

[D][pulse_counter:160]: 'Wetterstation Windgeschwindigkeit': Retrieved counter: 358.00 pulses/mine
[D][sensor:113]: 'Wetterstation Windgeschwindigkeit': Sending state 3.58145 km/h with 2 decimals of accuracye

The correct result would have been 15.4 km/h.
Can someone help me out and tell me what I’m doing wrong?

Thanks in advance
Thomas

I get 14.3 km/h - but read this link:

You should start by making sure all your values are interpreted as floating point, otherwise you will get rounding errors when the results are converted internally to integers. i.e.:

    - lambda: >-
         return ( x * 2.0 * 3.14 * 0.106133 ) / 60.0 * 3.6;

But other than that I can’t see any error (that’s obvious to me at least :slight_smile: )

2 Likes

This should be a radius of 6.366 mm
See:

So your lambda should be:

- lambda: >-
         return ( x * 2.0 * 3.14 * 6.366 ) / ( 60.0 * 3.6 );

Or better, to reduce the overhead (why would you do all these calculations every time):

- lambda: >-
         return x * 0.1852;
1 Like

Thank you very much for your answers.

but i think something is wrong. Now I get the following result:

[D][pulse_counter:160]:  'Wetterstation Windgeschwindigkeit': Retrieved counter: 124.00 pulses/mine
[D][sensor:113]: 'Wetterstation Windgeschwindigkeit': Sending state 1.24050 km/h with 2 decimals of accuracy

and this again not correct.

Guys, I found the problem. After a reflash via USB the calculation works. Really strange. Thanks a lot for your support!

Many greetings
Thomas

Just to be sure: I originally missed this, but the retrieved counter is shown as “pulses/mine” in your results. So do I understand it correctly that the input is pulses per minute?
At first I understood it to be pulses per second, so with one pulse per rotation this would be revolutions per second.
But for an input of pulses per minute with one pulse per rotation and calculating the wind speed in km/h I now think the formula is:

Anemometer2

So in that case the lambda should be:

- lambda: >-
         return x * 0.003086;

Or even more simple (you don’t need a lambda with only one multiplication):

    filters:
      - multiply: 0.003086

Does this give a realistic result?

Thanks for your support!
Maybe I should stop programming my stuff at 3 in the morning. I think I was not quite up to speed.
In the manual of the anemometer was actually the solution.
It said:

“The cup-type anemometer measures wind speed by closing a contact as a magnet moves past a switch. A wind speed of 1.492 MPH (2.4 km/h) causes the switch to close once per second.”

What finally means, if the pulse counter counts for 60s, you only need to divide the 2.4km/h / 60s and get 0.04 as multiplier for the number of pulses.
With this it should fit in my opinion.

Somit ist die Lösung die ich jetzt umgesetzt habe:

filters:
   - multiply: 0.04

Greetings & Thanks
Thomas

2 Likes

My WindSensor is crazy detecting WIND around 500 km/h

Anyone knows what could happened?

:open_mouth:

Similar problem here, data are constantly going up and down without any reason

What is your yaml? ESP 32? Meter or counter? How often update? What are your filters? What anemometer? Pull-up? Capacitor? My mission is to improve my readings; next on my list of to dos.

Sorry to bring this up, but this is the best discussion about wind speed measuring I have found so far.
Anyway, what I struggle to understand, is what size anemometers are you talking about, if one radius mentioned is 0.1mm (!), and then another dimension mentioned is 6mm (!). So, one anemometer is visible only under microscope, another one is in the size of human finger?
Please, can anyone clarify this?
Anemometer I am trying to use, radius is 102mm.

I am really having problems using the formulas above to calculate the correct wind speed for my use case.
My Anemometer has two magnets which pass one hall sensor in one revelation.
The cups travel a distance of 50 cm on one revelation, therefore a wind speed of 1 m/s should result in 4 pulses.
My desired output of the sensor is in m/s as well.
How do i calculate the correct multiplication factor?

So far this is what I calculated but gave me ridiculously low readings:

sensor:
  - platform: pulse_meter
    pin:
      # PULLUP-Widerstand 10kOhm
      number: GPIO5
      mode: INPUT_PULLUP
    id: wind_speed
    unit_of_measurement: 'm/s'
    name: "Aktuelle Windgeschwindigkeit (m/s)"
    icon: 'mdi:weather-windy'
    #internal_filter: 13us

    filters:
      - sliding_window_moving_average:
          window_size: 5
          send_every: 5
      - timeout:
          timeout: 10s
          value: 0
      - multiply: 0.0020833333333333

……or 1 pulse equals 0.25m/s. Therefore you multiply by 0.25.