Measuring wind speed

Hey @IanC
thanks for coming back here and share your knowledge.
Indeed I’m still having problems with random data-spikes, although I optimized my configuration to get at least a little “cleaner” data know.

Just one question: You wrote, that the decoupling capacitor has to be placed between the pin being used for data and ground.
I searched a bit for decoupling capacitors and learned that such a capacitor has to placed between the power-source and ground. So, in my case (ESP32-DevKit-V1) between the 3.3V pin and ground.
Did you meant that in your post or did I misunderstood something?

Hi chm3r,

Sorry for the late reply as I’ve been away on holiday for the xmas period.

The capacitor needs to be directly connected between the GPIO pin you are using and ground. I’ll attach a photo which shows the capacitor attached to a D1 Mini. Hope that helps you.

1 Like

Hello,
please can you tell me if I am doing the correct conversion for the sensor to kmh ?

  • Pulses Per Rotation: 20 pulses per rotation
  • Wind speed: 1.75m/s = 20 pulses per second

1.75 m/s = 6.2995 km/h.

So my multiply to get km/h should be :

  • multiply: 0.005245 # 6.2995 km/h per rotation/s = ((1 / 60) / 20) * 6.2995

0.005245 is number I get

However, 20 pulses per rotation is very odd … most anemometers have a reed switch / relay which is triggered by one rotation

1 Like

Hey IanC,

indeed, that was the trick. Thank you very very much for the tip.
Since I soldered the Capacitor in, the random spikes are gone and now I have clean and plausible data. Nice!

Now I‘m in the details: although you all (or most of you) use the calibration divided by two (because of two ticks per rotation), i‘m using the original calibration from the datasheet (2.4km/h per 1 Rotation per second) and it seems to be quite accurate in comparision to my local weather data provider. I‘m wondering if there are different versions of the Spakfun like anemometers on the market. Some using the 2.4-calibration, others the 1.2. Maybe the datasheet we all use is just for one specific version of the sensor.

And last but not least for everyone whos interested: to avoid the situation, that the Wind sensor gets stuck at a value > 0 km/h when using the sliding window moving average in esphome and no new wind data comes in from the sensor: I just configured a little automation inside HA, which tests every few seconds if the value of the windspeed-meter has not changed for more than 10 seconds. If that condition turns true, i simply set the value of the sensor to zero via a little script inside of HA.
Its not perfect but better than nothing :slight_smile:

Happy Weekend everyone!

2 Likes

Here’s how I dealt with the wind calculations. I do not rely on counting pulses per rotation, I measure the duration between pulses instead. It also shows how I dealt with calculating gusts according to the standards by the world meteorogical organization.

It works perfectly to this day.

2 Likes

Hi, why do you calibrate with this value on multiply?

Hi, this code is under pulse_counter/total and converts total number of pulses (1pulse per sec =1.492mile/hour) into km:
1.492mph=0.66698368m/s /1000m (km) gives multiplier value.

1 Like

what u think about this anemometer ? should the formula be 1/60 * 1.75 * 3.6 ( for km /h )

‘you can use pulse_counter too since 20 pulses in one second means 1,75 m/s’

I am recycling an old Somfy EOLIS / SOLIRIS wind sensor for my DiY-project; this wind sensor still runs smoothly but off course I am still clueless what the wind speed is of one rotation (equal to two pulses). Does anyone knows this value by any change?

nice specs but what is the link?

I’ve read this thread over and over and gained a lot of insight from it - thanks everyone who contributed.

I also have the same issue with a lot of generated noise leading the very high readings (apparently we peaked at 1500mph one day. I must say I’m surprised I didn’t notice the wind being that strong!)

I’ve tried the 1uf trick too, but it didn’t work. (Didn’t make things worse, just not better)

In my case, I think I’ve finally figured out the reason.

First, an example of spurious readings.
image
t

My (generic 4-pulse-per-rotation anenometer from aliexpress) is connected to a nodemcu board and esp8366 that is mounted in a garage. The esp also runs a 12v PIR, rain-tip gauge and three door sensors via esphome. They’ve worked great for years.

My specific issue is in the timings of that graph. Yesterday I was working in the garage, thus triggering the PIR and door sensors a lot, but I don’t think they’re the problem. What I do think affects it is that I had the garage lights on - four cheap LED battens. I also had drills/grinders and saws going. Looking back, I can see I get high readings only when I myself am active in that area.

My belief is that electrical interference is playing merry hell with these readings. Something about pulse_meter, the high number of reads this generates or the wiring is my problem. (it’s only 2m of solid copper bell wire)

So I’m going to move the reading to a different esp8266, in a different outbuilding and see if that helps!

@digdilem How is your wind vane required to be wired? ADC or binary? If binary do you have a pull up resistor?

No idea - I just measured it with an ohmeter and I can see it closes 4 times a revolution.

I am using INPUT_PULLUP in my code, because I copied a chunk from earlier in this thread. It IS working perfectly now, however - we’re in the middle of a storm and it’s producing lots of sensible data.

1 Like

A follow up to this: I set up a new nodemcu and copied the same code block to it for the anenometer. I then moved it to a different shed and set it going.

For the first time ever, I’ve had over 48h without any massive spikes of hundreds of a mile an hour and can now actually read the chart in HA without those spikes throwing the scale out so much.

So for me at least, I think my problem was electrical interference, even with a relatively short 2m wire run.

image

Can you share your code in 1 file, hard to copy from the forums.

I’m surprised and flattered to see this thread continuing, however I just wanted to say somehow I am only just seeing your post, and I will be implementing this fix on my weather station as soon as possible. As fate would have it, I ordered a bag of 0.1µF capacitors off AliExpress just yesterday!

Thank you for sharing this research!

hi, I also use a wh-sp-w01 anemometer (aliexpress) and the datasheet says:
1 turn = 2 pulses (2hz)
m/s=wind speed hz * 0.34

How should I write the code to get the speed in km/h?
Thank you

p.s.: can the condenser also be useful for the rain gauge?

@acuplush

If you read the thread, the code is all located within the first several posts, as well as in my linked GitHub. Nik71git posted the following formula for km/h:

So the code would be:

  - platform: pulse_meter
    pin: 
      number: GPIO14
      mode: INPUT_PULLUP
    name: '${loc} Windspeed Meter'
    icon: 'mdi:weather-windy'
    id: wind_meter
    unit_of_measurement: 'mph'
    accuracy_decimals: 1
    timeout: 5s
    filters:
      - multiply: 0.02 #2.4km/h per rotation so 1 / 60 / 2 * 2.4
      - sliding_window_moving_average: # Helps prevent too many datapoints
          window_size: 15
          send_every: 15
1 Like