IOT

How to Measure Wind Speed using Anemometer & Arduino

When some NEWS networks broadcast weather forecast updates, you’ll notice that they show a gadget with semi-spherical cups that rotate according to wind speed, called an anemometer, and an arrow on top that moves according to wind direction called a wind vane. In this blog, We’ll learn how to measure wind speed with an Adafruit Anemometer Sensor and an Arduino. An anemometer is a wind speed and direction measurement instrument. It’s also a common device in weather stations.

We require precise wind speed information for decision-making in all studies that entail wind speed measurements, such as meteorology, wind turbines, and agriculture. Cups, hot wires, and pitot tubes are examples of anemometers with medium and high costs. The cup-type anemometer was employed in this experiment.

Wind Speed Arduino

The Adafruit anemometer is the anemometer sensor we’re using here. The Adafruit anemometer can detect wind speeds of up to 70 m/s (156 mph), which should be sufficient for our location. The Adafruit Anemometer Sensor may be connected to an Arduino and an OLED Display. The sensor will measure wind speed in m/s and display the result on an OLED display. The wind speed can be converted from m/s to miles per hour or kilometers per hour.

Hardware Required

  • Arduino Nano
  • Anemometer Senso
  • OLED Display
  • MT3608Boost Converter Module
  • 3.7V Lithium-Ion Battery

What is Anemometer?

An anemometer is a wind speed and direction measurement instrument. It’s commonly used in wind tunnels and other gas-flow applications to measure the speed of airflow in the atmosphere. The phrase comes from the Greek word anemos, which means “wind,” and it refers to any wind speed instrument used in meteorology.

The revolving-cup electric anemometer is the most often used anemometer for wind-speed measurements. An electric generator is powered by rotating cups. The generator’s output powers an electric meter that is calibrated for wind speed. For wind resource assessment studies and practice, three-cup anemometers are currently the industry standard.

Three or four hemispherical cups are mounted on horizontal arms that are mounted on a vertical shaft in a cup-type anemometer. The shaft was rotated at a rate that was nearly proportionate to the wind speed as air flowed past the cups in any horizontal direction. For a wide variety of wind speeds, counting the rotations of the shaft over a predetermined time interval provided a value proportional to the average wind speed.

Adafruit Anemometer

The Adafruit Anemometer Sensor is a three-cup type anemometer that can measure wind speeds up to 70 meters per second (156 miles per hour). It is made up of three parts: a shell, a wind cup, and a circuit module.

Adafruit Anemometer

The sensor comes with three connections and a length of three core cables. A black cable for power and signal ground, a brown wire for power (which can range from 7 to 24 volts DC), and a third blue wire for analog voltage readings. The analogue voltage at the output will range from 0.4V (0 m/s wind) to 2.0V (32.4 m/s wind).

Specifications

  • Voltage Required: 7-24v DC
  • Output: 0.4V to 2V
  • Testing Range: 0.5m/s to 50m/s
  • Start wind speed: 0.2 m/s
  • Resolution: 0.1m/s
  • Accuracy: Worst case 1 meter/s
  • Max Wind Speed: 70m/s
  • Pin details: Pin 1 – Power (brown wire), Pin 2 – Ground (black wire), Pin 3 – Signal (blue wire)

Internal Circuitry of the Sensor

By removing the knots, you can open the sensor. Photovoltaic modules, an industrial processor, and a current generator are all integrated into the internal drive’s circuitry.

The material of the circuit PCB is military-grade A. This ensures that the parameters are stable and that the electrical qualities are of high quality. The electronic components on the inside are all industrial chips with excellent electromagnetic interference resistance. The internal system can operate normally in temperatures ranging from –20°C to +50°C, with humidity levels ranging from 35% to 85%.

The plug on the cord is a military plug. It has good anticorrosive and anti-erosive characteristics, making it possible to use the instrument for a long time.

Measure Wind Speed using Anemometer & Arduino

Let’s connect the Adafruit Anemometer Sensor to the Arduino and take a wind speed reading. Check out the circuit or diagram below.

arduino anemometer project

The Adafruit Anemometer can operate between 7 and 24 volts DC. As a result, the Arduino’s voltage is insufficient to turn on the sensor. As a result, I’ll be using the MT3608 DC-to-DC Boost Converter Module to boost the 3.7V Lithium-Ion Battery to 7.5V. To modify the output voltage, connect the battery to the MT3608 Module’s input first, then twist the potentiometer until the output voltage on the multimeter reads 7.5V.

The Boost Converter Module’s output provides 7.5V to the Sensor VCC wire and the Arduino Vin pin. The anemometer sensor’s analog output pin, which is blue, is linked to Arduino’s pin A0. Similarly, the SDA and SCL pins of the OLED Display are linked to Arduino pins A4 and A5. The OLED Display receives 3.3V from the Arduino 3.3V pin.

anemometer sensor arduino Wind Speed

Project PCB Gerber File & PCB Ordering Online

If you don’t want to put the circuit together on a breadboard and instead prefer a PCB, this is the PCB for you. EasyEDA was used to create the PCB. The Arduino Anemometer PCB Board looks something like this.

The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from https://www.nextpcb.com/

Download Gerber File: Arduino Anemometer PCB

Now you can visit the NextPCB official website by clicking here: https://www.nextpcb.com/. So you will be directed to the NextPCB website.

You can now upload the Gerber File and place an order on the website. The PCB quality is excellent. That is why the majority of people entrust NextPCB with their PCB and PCBA needs.

You can assemble the components on the PCB Board.

Source Code/Program for Arduino Anemometer

Here’s a simple Arduino Anemometer program for the Arduino IDE. It is possible to compile and upload the Arduino anemometer project code to the Arduino Board. You can choose between m/s and mph for the wind speed.

Compilation of the code necessitates the use of SSD1306 and the GFX OLED library. To begin, download and install the libraries listed below into the Arduino IDE.

.

1. Download SSD1306 Library: https://github.com/adafruit/Adafruit_SSD1306

2. Download Adafruit GFX library: https://github.com/adafruit/Adafruit-GFX-Library

You can now copy the code and upload it to the Arduino Board.


#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


void setup()
{
Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
Serial.println(F(“SSD1306 allocation failed”));
for (;;); // Don’t proceed, loop forever
}
display.display();
delay(100);
display.clearDisplay();

display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0, 20);
display.print(“Anemometer”);
display.display();
delay(3000);
}

void loop()
{
float sensorValue = analogRead(A0);
Serial.print(“Analog Value =”);
Serial.println(sensorValue);

float voltage = (sensorValue / 1023) * 5;
Serial.print(“Voltage =”);
Serial.print(voltage);
Serial.println(” V”);

float wind_speed = mapfloat(voltage, 0.4, 2, 0, 32.4);
float speed_mph = ((wind_speed *3600)/1609.344);
Serial.print(“Wind Speed =”);
Serial.print(wind_speed);
Serial.println(“m/s”);
Serial.print(speed_mph);
Serial.println(“mph”);

display.clearDisplay();

display.setTextSize(1);
display.setCursor(30, 0);
display.println(“Wind Speed”);

// display.setTextSize(2);
// display.setCursor(25, 30);
// display.print(wind_speed, 1);
// display.setTextSize(1);
// display.print(” m/s”);

display.setTextSize(2);
display.setCursor(25, 30);
display.print(speed_mph, 1);
display.setTextSize(1);
display.print(” mph”);

display.display();

Serial.println(” “);
delay(300);
}

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x – in_min) * (out_max – out_min) / (in_max – in_min) + out_min;
}

Code Explanation

Here is a complete explanation of arduino anemometer code line by line.

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

The library for OLED Display is first included because it requires two libraries: Adafruit SSD1306 Library for SSD1306 OLED Driver and Adafruit GFX Library for Graphics Display.

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

Then we define the height, width, and reset pin for the OLED Display, as well as create instances for it.

Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
Serial.println(F(“SSD1306 allocation failed”));
for (;;); // Don’t proceed, loop forever
}

We initialized the Serial and OLED functions in the setup section. The OLED Display’s I2C address is 0x3c. 0x3D is the address of some OLED displays. If the OLED isn’t working, change the I2C address.

float sensorValue = analogRead(A0);
float voltage = (sensorValue / 1023) * 5;

Then we are reading the sensor analog value and then converting the value into voltage.

float wind_speed = mapfloat(voltage, 0.4, 2, 0, 32.4);

It’s simple to change the voltage to fast. At 0.4V, the wind speed starts at 1 m/s and reaches a high of 32.4 m/s around 2. The map() function on Arduino is built-in, but it does not work with floats, thus we have a mapFloat() function.

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x – in_min) * (out_max – out_min) / (in_max – in_min) + out_min;
}

This functions is used to map the variable under a float.

float speed_mph = ((wind_speed *3600)/1609.344);

Using this line you can convert the wind speed from m/s to miles per hour (mph).

/ display.setTextSize(2);
// display.setCursor(25, 30);
// display.print(wind_speed, 1);
// display.setTextSize(1);
// display.print(” m/s”);

display.setTextSize(2);
display.setCursor(25, 30);
display.print(speed_mph, 1);
display.setTextSize(1);
display.print(” mph”);

In an OLED panel, this line shows the wind speed. You can comment or uncomment the above lines depending on whether you need m/s or mph.

Measuring Wind Speed & Testing the Device

The wind speed will be displayed on the OLED Display when you upload the Arduino Anemometer code to the Arduino Board. When the anemometer cup is stable, the OLED will display a speed of 0.1 to 0.3 meters per second. When the sensor is taken in a windy area, the speed will change or rise. To measure the wind speed, I utilized the roof of my house.

Initially, measure the speed in m/s and obtained the following result. Depending on the blade rotation, the speed variation increases or decreases.

Then convert the m/s to miles per hour using an industrial standard measurement (mph). You can easily convert the speed to kilometers per hour using the mathematical formula (kph).

Conclusion

I hope all of you understand how to make DIY Arduino Anemometer Project for measuring wind speed for Weather Station. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.