Use pulse counter to calculate rps for anemometer

Hello,

I have the Eltako WS anemometer connected to my esphome to measure the outside wind speed. I’m using the formula on this website to calculate the wind speed:
v [km/h] = 1.761 / (1 + rps) + 3.013 * rps

What I’m not sure is if I’m calculating correctly the RPS from the pulse counter. The wind sensor returns 4 pulse for a full spin and I want to get “a live” measure so I can control my awnings when the wind is too strong. I’m converting the pulses per minute to rps like this:
pulses / 4* 0.016666666 is this correct?

The full config:

sensor:
  - platform: pulse_counter
    name: Wind Sensor
    id: windsensor
    pin:
      number: 2
    update_interval: 1s
    filters:
      - lambda: if (x < 0.001) return x; else return 1.761 / (1 + (x / 4 * 0.016666666) ) + 3.013 * (x / 4 * 0.016666666);
    unit_of_measurement: 'Km/h'

Thank you!

Anyone can help? :slightly_smiling_face:

One rotation = 4 pulses right? So divide by 4 to get rpm. Then divide by 60 to get rps. So
rps = x/(4*60)
or
rps = (x/4)*0.1666

Depends on the c++ order of precedence. But you can make sure with an extra set of ( )

Thank you @nickrout I’ve update it to ((pulses / 4)* 0.016666666) just to make sure.

@marcomartins marcomartins

Finally whats it’s the correct formula?, I have the Eltako anemometer, but with the above formula the values are too low if I compare with online data…, please can you write the final entire formula?

Thanks,

This is what I’m using but I’ve never confirmed the values with other readings since I do not have anything else to compare it with:

  - platform: pulse_counter
    name: Wind Sensor
    id: windsensor
    pin:
      number: 2
    update_interval: 1s
    filters:
      - lambda: if (x < 0.001) return x; else return 1.761 / (1 + ((x / 4) * 0.01666666667)) + 3.013 * ((x / 4) * 0.01666666667);
    unit_of_measurement: 'Km/h'

hey, sorry for the noobish question. Would you be so nice to share how you connected the Wind Sensor to your esp32? Thank you :slight_smile:

You just connect it to one pin that is not ground or 5v/bat/3v - I’ve used the pin nr 2 and the other to the ground pin. There isn’t any specific cable for each.