Measuring the Speed of Wind With a Generator and an Arduino

by Instructosaurus in Circuits > Arduino

477 Views, 2 Favorites, 0 Comments

Measuring the Speed of Wind With a Generator and an Arduino

243153069_583368382855399_4407429101553097025_n.jpg

A few months ago I started building an Arduino based weather station for my greenhouse. While building it I particularly enjoyed making a wind speed measuring contraption, so I decided to write a short article for people who might find it informative or are perhaps on the lookout for instructions to building something similar for themselves.

Some elementary knowledge of physics, electronics and mathematics is recommended for better understanding of this article.

Supplies

1x Arduino (Uno) board

1x BLDC computer fan

1x 1k resistor

1x 1M resistor

1x diode

1x Zener diode (5.1V)

1x 0.1 nF ceramic capacitor

wires

1x ball bearing

1x round wooden pole, about 15 cm in length

some wooden planks

wood glue, hot glue

Note: most of the supplies are, as explained bellow, either unnecessary or replaceable with whatever you might have at home. This is just an outline of what worked for me.

Thinking of an Interesting Idea

242671532_357323076134553_4597925672571617831_n.jpg

While thinking of ways to measure the speed of wind I couldn’t look past the idea of using a propeller to spin the rotor of a generator, thus inducing a voltage which I could measure with an Arduino. I would, however, like to refer you to Explaining Computers’ video on the same subject which uses a simpler and very elegant method of measuring the speed of wind.

Given my initial idea I started browsing the internet and my room for relevant parts and knowledge. At this point I had no fixed idea of what kind of generator I would use, weather it would produce AC or DC current and how big of a signal it would be able to generate. I remembered I’d seen a video where someone had turned a BLDC PC fan into a simple generator. This seemed like a good starting point.

Creating the Hardware and Circuitry

circuit.png

I picked a similar kind of PC fan that I got from a junkyard computer and followed the steps from the video. The fan is rated for 5 V. Note that removing the circuit is absolutely necessary. The various components won’t allow current to flow out of the winding. Speaking of the circuit, I highly recommend you try figuring out the way it works (or, you could just watch this video of a great explanation instead)! After removing the circuit and reassembling the fan I could blow very hard at the fan and measure a couple of volts of AC current with a voltmeter. This seemed very promising, so I continued. I built a very simple rectifier circuit to change the induced AC voltage into DC. The circuit I went for is shown in figure 1.

As you can see, it’s a very basic half-wave rectifier. R1 is the resistor over which the voltage is measured. Since I hadn’t done any measurements yet I decided to go for a current limiting resistor (R2) and an over-voltage protection with a Zener diode (ZD1) with the Zener voltage equal to 5.1 V. The capacitor C1 smooths out the rectified voltage. The circuit would work fine without a capacitor, however I believe it’s good practice to use it. It’s also a good learning experience trying out different values of the capacitor. I ultimately ended up with a ceramic capacitor with a value of 0.1 nF.

I prefer this setup as opposed to a full-wave rectifier because it’s very simple both to understand and to build. Since I’m not after the generated power but rather the amplitude of the signal, a half-wave rectifier is just as useful as a full-wave rectifier would have been with less parts and potential problems.

Initial Measurements

Finally it was time to make some measurements! I hooked the ground point of the circuit to an Arduino Uno ground pin and the other one to an analog pin. I used the analogRead(A0) function with a delay(100) to measure the voltage repeatedly. By blowing into the fan really hard I could get readings of up to 500. Keep in mind that the measurements come periodically: for the positive half-period of the sine wave there were readings, while for the negative half-period of the sine wave there weren’t any due to the half-wave rectifier! This seemed to be going according to my wishes so I decided to build an enclosure and a proper propeller.

Building the Propeller and Enclosure

242392888_829708771029106_2195269104389516863_n.jpg
242493539_4297571963660487_4713268819123879448_n.jpg
242610279_395387595319180_1324146960515720868_n.jpg
242514680_376289380835124_1890393140175555663_n.jpg
242537024_909381103336183_5337006868170390354_n.jpg
242449272_4351512734924848_5060945520690797705_n.jpg
242669543_1091227831284261_5585739479592044668_n.jpg

I took a page out of the Explaining Computers’ design I linked to earlier in this article. I decided to make it out of some scrap wood, ping pong balls and hardware I had lying around the workshop. I decided to plug the shaft through a ball bearing in the roof of the enclosure. For the testing phase I left one side open. All the described parts are visible in the pictures above.

Measurements, Calculations and Predictions

242768420_908231756717887_6452299804416069652_n.jpg
table1.png
graph_measurements.png
prediction_graph.png

After the woodworking was over I hooked the wires up to my circuitry and spun the propeller by hand. I wrote a function that finds the peak value read by an analog pin in a given time period (the same function is in the final program, it’s called wind_speed). The readings were quite lacklustre. As opposed to the previous reading of several hundred I had a hard time going over 40. After trying out different diodes I could bump the maximum measurement achievable by hand to around 100. This left a bitter taste so I did some research and found this interesting article. It appears that a person doing their best to blow air out of their mouth will produce “wind” with speed of up to 200 km/h. This means that my blowing into the fan was way more effective than spinning the awkward propeller by hand. This means that a stronger wind would produce even higher measurements which gave me a good feeling about the signal amplitude so I decided not to use any signal amplification.

The next step was finding a correlation between the speed of wind and the analog reading of the microcontroller. I presume that the speed of the wind more or less coincides with the tangential speed of the propeller. The tangential speed v_t correlates nicely with the frequency of the spinning propeller:

ω = 2πν = v_t / r (1)

where ω is the angular speed, ν is the frequency, v_t is the tangential speed and r is the distance from the shaft to the end of the propeller. With a little rearrangement of equation 1 we get:

v_t = 2πνr (2)

Equation 2 represents how the tangential speed (which, I presume, roughly equals the speed of the wind) depends upon the frequency. We can now spin the propeller by hand with different frequencies and measure the induced voltage. By applying equation 2 we then have a direct correlation between the speed of wind and the measured voltage. I spun the propeller with frequencies of 1 Hz, 2 Hz, 3 Hz and 4 Hz taking advantage of a metronome to keep my rhythm on point. I found that higher frequencies were too difficult to accurately produce by hand so I stopped here. I did 5 measurements for each frequency and chose the mode value from among the five. The measurements and calculations including the frequencies, speeds of air, analog readings and corresponding voltages are collected in table 1. The speed of wind is calculated in meters per second from equation 2. Afterwards, I changed those values to kilometers per hour since that's the unit of wind speed that we're used to.

Furthermore, I drew the graph pictured on figure 2 to better visualise the correlation between the speed of the wind and the analog readings of the Arduino. It appears to be remarkably linear so I fitted a linear curve on the obtained data and printed out the lines’ equation.

Finally it’s time to write a program that reads the analog value and spits out the speed of the wind in km/h. For this we will need the inverse function of the function equation 2:

g(x) = f⁻¹(x) = (10x+55) / 59 (3)

The final program, available on my github and in the download section of this article takes advantage of function (3) to calculate the speed of the wind and write it out every few seconds.

I also went ahead and plotted the function from equation 3 (figure 3). I plotted the function in the range from 0 to 1023, which is the range in which the 10-bit DAC of the Arduino boards operates. It seems that the maximum wind speed that can be measured is around 170 km/h. The maximum wind speed in my parts is around 120 km/h which only occurs once or twice per year. This means that I should be able to measure the wind speed under any conditions successfully. It also means that the Zener diode over-voltage protection is likely unnecessary but I’ll leave it just in case something unexpected happens.

My github repository also stores the wxMaxima file and LibreOffice Calc file with the above tables and graphs.

Downloads

Finishing Up and Final Thoughts

243146130_644732796510207_7362256148441338227_n.jpg
FX87UB9KU18KA87.jpeg

Finally, I created the circuit on a piece of perfboard, drilled a hole in the bottom of the enclosure to drive out the cables, closed up the wooden enclosure and painted it with an outdoor wooden paint to make it last long under changing weather conditions. I also lightly greased the ball bearing to help it spin more smoothly and give it some protection against corrosion.

I’ve yet to test this setup under stronger wind. I do believe the electronics are capable of reading it, however, I’m hoping the construction is sturdy enough to withstand strong wind.

If I ever redo this project I’ll look into a better propeller, this one seems a bit too improvised for my taste. The same goes for the enclosure which does look a bit too dull. I would also like to test out different kinds of generators. I do however enjoy the fact that almost everything was made from scrap electronics, wood and hardware parts.

I’d also like to be able to tell the direction of the wind. I’ve already got some ideas for that so stay tuned for further articles!

I had a lot of fun with this project and writing my first Instructable! I hope you’ve learned something new and perhaps got any good ideas for your own projects. If you have any questions or comments I’d gladly hear them!

Acknowledgements and References

Any basic undergraduate physics and electronics textbook (or Wikipedia) covers all of the required knowledge for the above article. I've learnt a lot of my physics from Fundamental of Physics. I'd also like to acknowledge Christopher Barnatt from Explaining Computers for some ideas about the anemometer, GreatScott! from youtube for a lot of informative videos on all electronics topics and Thomas Kim for the PC fan generator tutorial.

Everything was made using free software: Arduino IDE, LibreOffice Calc, wxMaxima and easyEDA.


List of references:

Christopher Barnatt. Raspberry Pi Anemometer: Measuring Wind Speed!

D. Halliday, R. Resnick, and J. Walker, Fundamentals of Physics.

Geoghegan, Patrick & Laffra, A.M. & Hoogendorp, N.K. & Taylor, M.C. & Jermy, Mark. (2017). Experimental measurement of breath exit velocity and expirated bloodstain patterns produced under different exhalation mechanisms. International Journal of Legal Medicine. 131. 10.1007/s00414-017-1545-2.

GreatScott!. Electronic Basics #18: DC & Brushless DC Motor + ESC. Aquired in september 2021 from https://www.youtube.com/watch?v=UteZJ_7C4Mg

Thomas Kim. How to make a CPU FAN Generator. Aquired in september 2021 from https://www.youtube.com/watch?v=N0Wn34VLECE