Davis 1640 Wind Gauge calculations

Hello all,

I see a number of DYI projects involving a Davis 1640 Wind Gauge and ESP8266 D1 Mini. All work with following formula:

#mps = 1.18*0.5652/2/60 =0,0055578

And I have a couple of questions about this:

  • “mps” I am assuming this is “meters per second”?
  • 1.18 seems to compensate for friction and general loss, so that is fine
  • 0.5652 comes from “#circ_m=0.0923.14 = 0.5652” And I think I get that, so also fine
  • 2 is from “2 pulses per rotation” and this is where my first issue starts really.
    When I check with a multimeter there is one “open” and one “close” per rotation, and “rising edge” is disabled.
    So in the formula, should the “/2” really be in there?

Among others @mkuoppa and @bassicrob are using this method, so any feedback would be very much appreciated.
@mkuoppa, on your publication of the esphome yaml there is also a “template sensor” that does a multiply by 16.764. And I have no clue where that is used for. Would you be willing to shed a bit of light on that as well please.

All help is greatly appreciated, because with all the “inspiration” out there I got the “direction” part completely figured out.

Many thanks,


@Wim you are correct regarding your assumptions on the wind speed calculation. To check the number of pulses per revolution I did a simple rotation test on my wind gauge.
The template sensor with factor 16.764 is probably som left over code I forgot to remove after testing stuff for the rain gauge. Will have to clean it up eventually :wink:

Thanks @mkuoppa for the fast reply, much appreciated.
So I was probably over-complicating things for myself then. Also, after re-reading some of the posts it was very clearly stated "change calculations based on your situation. So that is what I did.
1 pulse per rotation, and an “R” of 7.5 cm (for the Davis 1640 that I have) and not 9 cm from the example.

Now I need to mount it outside and hope for some wind :wink:

Thanks again,

The answer my friend is blowing in the wind…

I am on this exact math problem from your code my friend. I have a spark fun style weather station kit, it says in the calibration code of the example that 2.4 kph per switch close. SO what math do I use if any?
I am strong at hardware not software, so this is all still a bit new to me.


Perhaps you or someone can post their working yaml? Because I am fighting with this and hitting a wall. This is what I have and it is outputting numbers that don’t make a lot of sense. Things are commented out, and I am curious what changes I need to make.

- platform: pulse_counter
      number: 36
    unit_of_measurement: 'MPH'
    name: 'Wind Speed'
    icon: 'mdi:weather-windy'
    id: my_wind
      rising_edge: DISABLE
      falling_edge: INCREMENT
    internal_filter: 13us
    update_interval: 30s
        - sensor.template.publish:
            id: template_sens
            state: !lambda "return x;"
    #rotations_per_sec = 1
    #circ_m=0.09*2*3.14 = 0.5652
    #mps = 1.18*circ_m*rotations_per_sec  
    #mps = 1.18*0.5652/2/60 =0,0055578
    accuracy_decimals: 2
      - multiply: 0.0055578
      - sliding_window_moving_average:
          window_size: 2
          send_every: 1
          #send_first_at: 60 # can be used to prevent an unrealistic high value at startup (cannot be larger than send_every)

  - platform: template
    name: "Template Sensor"
    id: template_sens
#      - multiply: 0.2794
#      - multiply: 60 (to get mm/h)
#      - multiply: 16.764
      - sliding_window_moving_average:
          window_size: 60
          send_every: 1

Basically you can calculate the distance that is travelled for one rotation (circumference). Then by also measuring the number of rotations per seconds/minutes/hours you can calculate the speed in kph, mph, mps or whatever unit you desire.
Then there is drag that slows down the rotation and that number is why you need to estimate or measure against a reference and calibrate your equipment. This is give by some manufacturers (don’t know how accurate it is) and for some you need to do it yourself.
So probably if the manufacturer says it is 2.4kph / pulse then you just multiply the pulses by 2.4 to get the speed in kph.
However you must consider the update_interval: 60s which specifies over how long time the pulses are counted. This is not mentioned by you.
So is the factor 2.4 kph relative to number of pulses/minute, pulses/hours, pulses/seconds?

You can find my working code here https://github.com/mkuoppa/esphomeweatherstation