Example Code for Arduino-Reading Wind Speed Rating

Last revision 2025/12/16

This article presents a comprehensive guide on using Arduino to measure wind speed with the SEN0170 sensor, including wiring instructions, setup guidance, and sample code for effectively reading wind speed levels based on voltage signals.

Wiring Diagram

  • Red ------ +9-24V
  • Black ---- GND
  • Yellow --- voltage signal
  • Blue ----- current signal

Other Preparation Work

Please make the external power (DC 9-24V) and the wiring to Arudino in same ground, i.e. connect GND to arduino as well as to external power's GND. In the diagram, it was not indicated out.

Sample Code

/*!
 * @file  SEN0170.ino
 * @brief Reading wind speed rating
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  DFRobot
 * @version  V1.0
 * @date  2023-08-03
 */

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

void loop()
{
  int sensorValue = analogRead(A0);
  float outvoltage = sensorValue * (5.0 / 1023.0);
  Serial.print("outvoltage = ");
  Serial.print(outvoltage);
  Serial.println("V");
  int Level = 6 * outvoltage;//The level of wind speed is proportional to the output voltage.
  Serial.print("wind speed is ");
  Serial.print(Level);
  Serial.println(" level now");
  Serial.println();
  delay(500);
}

Additional Information

Dimension Diagram

Was this article helpful?

TOP