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 for this project:
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
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.
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.
#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);
}
}
#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);
}
#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");
}
}