Weather Station Sensor (SKU: SEN0186)

简介

DFRobot为您带来这款集成了风速计、风向仪和雨量器的新版气象站套件。所有数据都可通过串口直接读取。同时兼容Arduino设备,方便用户使用。 配合DFRobot其他的传感器,可以有效地检测区域性的风速,风向,降雨量的天气参数,可以广泛应用于农业,工业,气候研究领域。

注意:2016/3/28 更新:升级温湿度传感器,提升测量范围 ; 2020/6/18 更新:修正风速参数说明

产品参数

应用

  1. 气象站
  2. 天气监测

数据接口

编号 接口说明
B 雨量
C 风速风向
D 数据输出
E 指示灯
I I2C温湿度气压接口
J1 公英制跳线
J2 数据口2400/9600速率跳线

数据输出格式

c000s000g000t082r000p000h48b10022*3C

每秒输出37个字节,包括数据末尾的换行符CR/LF。

数据解析:

注 1: 接口板会自动检测是否安装了气压片、温湿度传感器,没有安装的传感器数据将显示“。。。”。 比如没有安装温湿度传感器和气压片,则输出数据: c000s000g000t...r000p000h..b.....

指示灯

DAT 发送数据时同步闪动

TX 随风速采样,同步闪动

RX 随雨量传感器,同步闪动

使用教程

连接示意图

示例代码

注意在下载程序前,请先拔掉连接在主控器上的RX和TX接线,不然会妨碍程序下载

/*!
 * @file  SEN0186.ino
 * @brief DFRobot为您带来这款集成了风速计、风向仪和雨量器的新版气象站套件
 * @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
 */

char                 databuffer[35];
double               temp;

void getBuffer()                                                                    //Get weather status data
{
  int index;
  for (index = 0;index < 35;index++) {
    if (Serial.available()) {
      databuffer[index] = Serial.read();
      if (databuffer[0] != 'c') {
        index = -1;
      }
    } else {
      index--;
    }
  }
}

int transCharToInt(char* _buffer, int _start, int _stop)                               //char to int)
{
  int _index;
  int result = 0;
  int num = _stop - _start + 1;
  int _temp[num];
  for (_index = _start;_index <= _stop;_index++) {
    _temp[_index - _start] = _buffer[_index] - '0';
    result = 10 * result + _temp[_index - _start];
  }
  return result;
}

int WindDirection()                                                                  //Wind Direction
{
  return transCharToInt(databuffer, 1, 3);
}

float WindSpeedAverage()                                                             //air Speed (1 minute)
{
  temp = 0.44704 * transCharToInt(databuffer, 5, 7);
  return temp;
}

float WindSpeedMax()                                                                 //Max air speed (5 minutes)
{
  temp = 0.44704 * transCharToInt(databuffer, 9, 11);
  return temp;
}

float Temperature()                                                                  //Temperature ("C")
{
  temp = (transCharToInt(databuffer, 13, 15) - 32.00) * 5.00 / 9.00;
  return temp;
}

float RainfallOneHour()                                                              //Rainfall (1 hour)
{
  temp = transCharToInt(databuffer, 17, 19) * 25.40 * 0.01;
  return temp;
}

float RainfallOneDay()                                                               //Rainfall (24 hours)
{
  temp = transCharToInt(databuffer, 21, 23) * 25.40 * 0.01;
  return temp;
}

int Humidity()                                                                       //Humidity
{
  return transCharToInt(databuffer, 25, 26);
}

float BarPressure()                                                                  //Barometric Pressure
{
  temp = transCharToInt(databuffer, 28, 32);
  return temp / 10.00;
}

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  getBuffer();                                                                      //Begin!
  Serial.print("Wind Direction: ");
  Serial.print(WindDirection());
  Serial.println("  ");
  Serial.print("Average Wind Speed (One Minute): ");
  Serial.print(WindSpeedAverage());
  Serial.println("m/s  ");
  Serial.print("Max Wind Speed (Five Minutes): ");
  Serial.print(WindSpeedMax());
  Serial.println("m/s");
  Serial.print("Rain Fall (One Hour): ");
  Serial.print(RainfallOneHour());
  Serial.println("mm  ");
  Serial.print("Rain Fall (24 Hour): ");
  Serial.print(RainfallOneDay());
  Serial.println("mm");
  Serial.print("Temperature: ");
  Serial.print(Temperature());
  Serial.println("C  ");
  Serial.print("Humidity: ");
  Serial.print(Humidity());
  Serial.println("%  ");
  Serial.print("Barometric Pressure: ");
  Serial.print(BarPressure());
  Serial.println("hPa");
  Serial.println("");
  Serial.println("");
}

结果

SEN0186_serial_monitor.png 注:由于测试环境没有风这一因素,所有关于风速和风向的参数都为0

常见问题

问: 总共有三个接头,转接板该如何连接?

- 答: 风向计下方有两个口,需要把风速计连到风向之后再连接到转接板,如图:

For A4, Anemometer was connected to Wind vane module

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。

更多