Documentation

Project 1 - Wind Speed Monitoring System

Updated July 14, 2026

1. What You Will Build

In this tutorial, you will learn how to build Project 1 - Wind Speed Monitoring System using Arduino.

By the end of this tutorial, your project will be able to:

  • Read wind speed data from an RS485 wind speed sensor.

  • Calculate the average wind speed from multiple readings.

  • Display the average wind speed on the Serial Monitor.

2. What You Will Learn

After completing this tutorial, you should understand:

  • How to connect an RS485 wind speed sensor to an Arduino Uno.

  • How to communicate with a Modbus RTU sensor using the ModbusMaster library.

  • How to read holding registers from a Modbus device.

  • How to calculate and display the average wind speed.

3. Components Needed

No.

Component

Quantity

1

Arduino Uno

1

2

RS485 Wind Speed Sensor

1

3

MAX485 Module

1

4

Jumper wires

Several

5

Breadboard

1

6

USB cable

1

4. Software Needed

Use the tools below depending on your board.

Board

Software

Arduino

Arduino IDE 

Libraries Needed

Install these libraries before uploading/running the code:

  • SoftwareSerial

  • ModbusMaster

5. Circuit Connection

Connect the components as shown below.

Component Pin

Connect To

MAX485 RO

GPIO 10

MAX485 DI

GPIO 11

MAX485 RE & DE

GPIO 2

MAX485 VCC

5V

MAX485 GND

GND

MAX485 A

Wind Speed Sensor A

MAX485 B

Wind Speed Sensor B

Wind Speed Sensor VCC

5V

Wind Speed Sensor GND

GND

Wiring Steps

  1. Connect the RE and DE pins together and connect them to Arduino digital pin 2.

  2. Connect the RO pin to Arduino pin 10.

  3. Connect the DI pin to Arduino pin 11.

  4. Connect the A and B terminals of the MAX485 module to the wind speed sensor.

  5. Connect VCC of MAX485 to  5V on the board.

  6. Connect GND of MAX485 to GND on the board.

  7. Connect VCC of Wind Speed Sensor to  5V on the board.

  8. Connect GND of Wind Speed Sensor to GND on the board.

  9. Double-check all wiring before powering the board.

Circuit Diagram

6. Code

#include <SoftwareSerial.h>
#include <ModbusMaster.h>

#define MAX485_RE_DE 2

SoftwareSerial rs485(10, 11);   // RX, TX
ModbusMaster node;

// Enable RS485 transmit mode
void preTransmission() {
  digitalWrite(MAX485_RE_DE, HIGH);
}

// Enable RS485 receive mode
void postTransmission() {
  digitalWrite(MAX485_RE_DE, LOW);
}

void setup() {
  Serial.begin(9600);
  rs485.begin(9600);

  pinMode(MAX485_RE_DE, OUTPUT);
  digitalWrite(MAX485_RE_DE, LOW);

  node.begin(3, rs485);          // Slave ID = 3
  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);

  Serial.println("Wind Speed Sensor");
}

void loop() {

  float totalSpeed = 0;
  int sampleCount = 5;
  int validSamples = 0;

  for (int i = 0; i < sampleCount; i++) {

    // Read Holding Register 0x0000
    uint8_t result = node.readHoldingRegisters(0x0000, 1);

    if (result == node.ku8MBSuccess) {

      uint16_t value = node.getResponseBuffer(0);

      float windSpeed = value / 10.0;

      totalSpeed += windSpeed;
      validSamples++;
    }

    delay(100);
  }

  if (validSamples > 0) {
    float averageSpeed = totalSpeed / validSamples;

    Serial.print("Wind Speed : ");
    Serial.print(averageSpeed, 2);
    Serial.println(" m/s");
  }
  else {
    Serial.println("No response");
  }

  delay(500);
}

7. Upload / Run the Project

  1. Connect the board to your computer using USB.

  2. Open the code in Arduino IDE.

  3. Select the correct board.

  4. Select the correct port.

  5. Click Upload.

  6. Open the Serial Monitor if needed.

8. Expected Result

When the project is working correctly:

  • The Serial Monitor displays "Wind Speed Sensor".

  • The average wind speed is displayed in m/s.

  • If communication fails, "No response" is displayed.

9. Troubleshooting

Problem

Possible Fix

Board not detected

Check USB cable, driver, board, and port selection

Code upload failed

Select the correct board and COM port

Sensor not working

Check VCC, GND, and signal pin wiring

Output not turning on

Check pin number and component polarity

Wrong readings

Check sensor voltage and calibration

Technical Article
By ZiraaSTEM