A DIY Wind Gauge (Anemometer) based on ESP32

Today, I want to share a cool project I’ve been working on: building my own anemometer, or as I like to call it, a wind gauge.

But here’s the twist—it’s not your run-of-the-mill wind gauge. In fact, it doesn’t even look like one! It measures wind speed and direction really well, and the best part? It does all this without any moving parts. That should help it last a whole lot longer.

Video version

If you prefer watching over reading, I’ve got you covered. Check out the video where I walk through the whole process.

Source files

The project is totally open-source, which means you can grab it and tweak it however you please. You can snag my design, the PCB layout, the 3D model, the bill of materials, and firmware – and make it exactly as is. Or, you can use it as a jumping-off point, make changes, and whip up something totally fresh.

If you want to receive all of them put the email below – I’ll send a link to you straight away.

Where can I buy it?

If you’d prefer to skip the PCB fabrication process, you can buy the PCB directly from my shop. It’ll save you some time and get you building faster.

JLCPCB

The sponsor of this project is JLCPCB. They made that beautiful board for this project. For a few bucks, and in a matter of days, you can have a professional PCB on your deck, ready to solder 🙂 Now, for new users, they provide up to $80 sign-up coupons.
And if you don’t feel up to it, they can solder all SMD components for you as well.

The Hunt for a Better Wind Gauge

So, what’s the deal with wind gauges? Basically, they tell us how fast the wind is blowing and from which direction. Most people use devices like this old contraption I pulled off my roof after it braved the elements for five years.

On one side, it’s got a little cups that spin with the wind, and on the other, a vane that points to where the wind’s coming from. They’re simple and get the job done by measuring rotation speed and direction.

But they aren’t perfect:

  • Mechanical Wear and Tear: Moving parts mean more things that can break over time.
  • Limited Precision: Especially when it comes to detecting wind direction.
  • Environmental Sensitivity: Dust, ice, or even spider webs can mess with their functionality.

Then you’ve got the ultrasonic wind gauges. These are high-tech devices that avoid moving parts by measuring how fast ultrasonic waves travel between sensors, affected by wind. They’re super accurate and responsive, but the price tag is through the roof.

Seriously, you’d think they were made of gold!

My Wind Gauge: A Different Approach

My wind gauge works on a completely different principle. It’s resistant to contaminants and just as fast and precise as the ultrasonic ones. Plus, it’s way cheaper to build.

There’s nothing like this commercially available right now (at least I haven’t found one), so I can’t compare prices. But if you’ve got access to a 3D printer and aren’t afraid of some basic soldering, you can build it yourself for peanuts.

How Does It Work?

The magic happens thanks to strain gauges. These are sensors that change resistance when stretched or compressed, letting us measure mechanical stress.

When wind pushes against a vertical post attached to a flexible base, it causes the post to bend. The stronger the wind, the more it bends.

By measuring this bending in two directions—north-south and east-west—we can figure out both the wind’s speed and direction. To figure this out, you’ll need a bit of math, but don’t worry—it’s nothing complicated.

Let’s break down the calculations into two steps: first, determining the wind direction and strength without using specific units, and then converting the calculated speed into practical units, such as km/h or ft/s.

The first step is easy. Let’s start by drawing a coordinate system, because from a mathematical standpoint, the speed is the length of a vector starting at the point (0, 0), and the angle at which it’s tilted represents the wind direction.

Speed

To calculate the wind speed, we’ll need some good old Pythagorean theorem:

WE^2+NS^2=x^2
\sqrt{WE^2+NS^2}=x

Direction

To calculate the direction, though, we’ll need a bit of trigonometry:

\tg{\alpha}=\frac{NS}{WE}
\alpha_{rad}=\arctg{\frac{NS}{WE}}
\alpha_{dec}=\arctg{\frac{NS}{WE}}*\frac{180}{\Pi}

Calibration

Calibration is a bit trickier. The basic concept is to compare the wind speed measured by our anemometer with the value from a commercial device, assuming it’s already properly calibrated. The more measurements we take, the more accurate the result will be. I took 10 measurements.

Based on these, we calculate a power function that allows us to convert the result from our initial calculation into a more useful unit. Since I live in Poland, I was used “km/h.”

To apply linear regression, we transform the power function by taking logarithms. Then we calculate the natural logarithms of both variables for each data point. After that, we compute the linear regression parameters… but let’s be real: we don’t have to do this by hand anymore. I didn’t calculate it manually either—I just used ChatGPT.

The result is that the calculated power function looks like this:

V=3916.57*S^{0.688}

where:
V – speed in km/h
S – the value calculated using the Pythagorean theorem

Handling Temperature Changes

But wait, there’s a catch. Temperature can affect our measurements because materials expand or contract with temperature changes. So, how do we make sure we’re measuring wind effects and not temperature fluctuations?

Simple solution: use four strain gauges instead of two.

  • By placing them on opposite sides, as one gauge stretches, the other compresses.
  • This setup cancels out the effects of temperature changes and doubles our sensitivity.

The Final Design

The Sail

The most eye-catching part is the omnidirectional “sail.” Its size and shape determine how it reacts to the wind. Bigger sails are more sensitive but can be slower to respond due to increased inertia.
After many trials, I settled on a design that offered the best balance between sensitivity and responsiveness.

The Post

The sail is mounted on an aluminum tube for stiffness without adding much weight. This ensures that the flexible crossbeam, not the post, does most of the bending—which is exactly what we want.

The Crossbeam

  • Critical for accuracy and sensitivity.
  • This is where the strain gauges are attached.
  • Gluing the strain gauges required patience, but with some care, it’s totally doable.

For the crossbeam material, I chose something similar to what’s used in standard PCBs—strong yet flexible and thin.

This is where we attach the strain gauges. I’m not going to pretend to be an expert on this, but after watching a few tutorials, I managed to get it done. I recommend this video, for example: LINK

Just keep in mind that this is an absolutely critical step in building the anemometer. How precisely you do this will directly impact the accuracy and consistency of your results.

It’s essential that all four strain gauges are attached in exactly the same way. For instance, if you don’t properly degrease one of them, or if you use too little or too much glue, it’ll respond differently from the others. This could make your device sensitive to temperature changes.

The Base

The base holds everything together and ensures stability.

  • Houses the PCB and attaches the crossbeam.
  • Mounts to your chosen surface to keep the wind gauge secure.
  • Includes a small spirit level and adjustable legs for proper leveling.

Electronics

The electronics are pretty straightforward.

  • ESP32: The brain of the operation.
  • Four-Channel ADC Chip: Communicates with the ESP32 via I2C, measuring differential values from each strain gauge.
  • LED Indicator: Signals various statuses—customizable to your needs.

Software

Since I personally use Home Assistant, I decided to go with ESPHome as the middleman. I think it’s the easiest option. It supports the ADC chip I chose out of the box, which is one of the main reasons I went with it.

Setting up the ESP32 chip in ESPHome is super easy. So easy, in fact, that there’s no point in breaking down the configuration file line by line here. Once you open the file, you’ll understand what each part is for.
I’ll just give a quick overview of how it’s supposed to work.

First, we configure the ADS1115 sensor so that the channels operate in differential mode and set the gain to the minimum value of 0.256V. This makes the sensor as sensitive as possible.

Next, we create two sensors using the “template” platform, which, based on the formulas and functions we discussed earlier, will calculate the wind speed and direction readings.

We also need a mechanism to zero the anemometer. The strain gauge readings will never be exactly the same, no matter how well you attach them. Plus, the device might not be mounted perfectly level, or even tightening the crossbeam could create some stress in the material, which would be picked up as an initial offset.
That’s why I added a button that subtracts the current value from the readings to zero them out. You should perform this zeroing after mounting the device in its final location, making sure that no forces are acting on the vane at the moment of zeroing.

Displaying the Data

To visualize the wind data on my Home Assistant dashboard, I used a feature-rich card that shows current wind speed and direction, averages over time, and even lets you set a background image of your house to see where the wind is coming from.

You can find the full documentation for this board here: LINK

Conclusion

This wind gauge, along with the rain gauge I built earlier, is bringing me closer to a full-fledged DIY weather station.
Because let’s be honest, who doesn’t want their own weather station? 😉

Thanks for sticking around, and happy building!

Related Articles

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close