Arduino

Wind Anemometer

Wind Anemometer

If you are interested in creating a DIY Arduino wind speed meter or anemometer to monitor the wind strength in your location, you might be interested in this, This project measures wind speed and log the data straight to the SD card, Build one with us.

Parts Used

Parts used for this project:

  1. Arduino Uno R3 Board

How It Works

The Arduino Uno R3 Board is one of the more popular boards in the Arduino family and a great choice for beginners.

Arduino Uno R3 is an open-source platform used for building electronics projects like Wind Anemometer

2. SD card module

The SD Card Module is a simple solution for transferring data to and from a standard SD card…. This module has SPI interface which is compatible with any sd card and it use 5V or 3.3V power supply which is compatible with Arduino UNO R3. SD card module has various applications such as audio, video, graphics or even data logger for Wind anemometer.

3. Anemometer Kit

Anemometer Kit is an instrument that measures wind speed and wind pressure it also compatible to arduino board like Arduino Uno R3.

4. SD card 8gb

A Secure Digital (SD) card is a tiny flash memory card designed for high-capacity memory and it can become a storage for the data of wind speed of the wind Anemometer.

lightweight, sturdy instrument for measuring wind speed and direction in your harsh environments. Its simplicity and corrosion-resistant construction make it ideal for a wide range of wind measuring applications.

Main Sketch — Wind Speed Logger

#include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display unsigned long previousMillis = 0;
const long interval = 600000; unsigned long previousMillisLCD = 0;
const long intervalLCD = 1000; void setup() { lcd.init(); lcd.backlight(); Serial.begin(115200); lcd.setCursor(0,0); lcd.print("INITIALIZING SD"); setupRTC(); setupSD(); lcd.clear(); lcd.setCursor(0,0); lcd.print("SD INITIALIZED"); delay(2000); lcd.clear(); lcd.setCursor(3,0); lcd.print("WIND SPEED"); int sensorValue = analogRead(A0); float outvoltage = sensorValue * (5.0 / 1023.0); float Level = 6.0*outvoltage;//The level of wind speed is proportional to the output voltage. String data = getTimeDate(); data += "t"; data += String(Level,1); data += "m/s"; SDWRITE(data); } void loop()
{ int sensorValue = analogRead(A0); float outvoltage = sensorValue * (5.0 / 1023.0); float Level = 6.0*outvoltage;//The level of wind speed is proportional to the output voltage. unsigned long currentMillisLCD = millis(); if (currentMillisLCD - previousMillisLCD >= intervalLCD) { previousMillisLCD = currentMillisLCD; Serial.print("wind speed is "); Serial.print(Level); Serial.println(" level now"); Serial.println(); lcd.setCursor(5,1); lcd.print(Level,1); if(Level > 9){ lcd.setCursor(9,1); lcd.print("m/s"); }else{ lcd.setCursor(8,1); lcd.print("m/s"); } } unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; String data = getTimeDate(); data += "t"; data += String(Level,1); data += "m/s"; SDWRITE(data); } }

RTC Module Helpers


#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC; void setupRTC () { Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { Serial.println("RTC is NOT running!"); RTC.adjust(DateTime(__DATE__, __TIME__)); }
} String getTimeDate () { DateTime now = RTC.now(); String timedate = ""; timedate += now.year(); timedate += "/"; timedate += now.month(); timedate += "/"; timedate += now.day(); timedate += " "; timedate += now.hour(); timedate += ":"; timedate += now.minute(); timedate += ":"; timedate += now.second(); return(timedate);
}

SD Card Logging Helpers

#include <SPI.h>
#include <SD.h> const int chipSelect = 53; void setupSD() { while (!Serial) {; // wait for serial port to connect. Needed for native USB port only } Serial.print("Initializing SD card..."); if (!SD.begin(chipSelect)) { Serial.println("Card failed, or not present"); while (1); } Serial.println("card initialized."); if (SD.exists("datalog.xls")) { Serial.println("datalog.xls exists."); } else { Serial.println("datalog.xls doesn't exist."); String up = "Time/Date Stamp"; up += "tWind Speed (m/s)"; File dataFile = SD.open("datalog.xls", FILE_WRITE); if (dataFile) { dataFile.println(up); dataFile.close(); // print to the serial port too: Serial.println(up+" LOGGED TO SD"); } else { Serial.println("error opening datalog.txt"); } } } void SDWRITE(String dataString) { File dataFile = SD.open("datalog.xls", FILE_WRITE); if (dataFile) { dataFile.println(dataString); dataFile.close(); // print to the serial port too: Serial.println(dataString+" LOGGED TO SD"); } else { Serial.println("error opening datalog.txt"); }
}
See also  Rocky Dancing Biped Robot

Frequently Asked Questions

What does this Wind Anemometer tutorial cover?

If you are interested in creating a DIY Arduino wind speed meter or anemometer to monitor the wind strength in your location, you might be interested in this, This project measures wind speed and log the data straight to the SD card, Build one with us.

Can I use an Arduino Nano or Mega instead of UNO for the Wind Anemometer build?

Yes. Nano shares the same ATmega328P and pinout. Mega has more I/O if you outgrow UNO. The code stays the same — just match the pin numbers used in the Sample Code section.

Why does my Wind Anemometer sketch fail to upload?

Usually wrong COM port, missing CH340/CH341 driver for clone boards, or another program holding the serial port. Disconnect the board, install the driver, reselect the port, retry.

// written by circuitrocks

Official account for the Circuitrocks team. Store updates, product announcements, and shop-wide news from the Philippines maker electronics retailer behind the tutorials, kits, and components.

Leave a comment