812 views|1 replies

222

Posts

3

Resources
The OP
 

[DFRobot Skylark Weather Meter Review] Arduino Wireless Intelligent Air Monitoring System Construction-02 Connect Arduino to Get Data [Copy link]

This post was last edited by eew_TKwwQ7 on 2023-11-12 23:39

How to connect Arduino devices to obtain real-time data from the Skylark DFRobot Skylark weather instrument. The official website has introduced it in detail.

For reference: https://wiki.dfrobot.com.cn/_SKU_EDU0157_%E4%BA%91%E9%9B%80%E6%B0%94%E8%B1%A1%E4%BB%AA

I happen to have a few DFRobot Romeo V2 development boards. The operation of other development boards is similar. You can refer to the specific development boards. Basically, all mainstream development boards have supported

For detailed information of DFRobot Romeo V2, please refer to: https://wiki.dfrobot.com.cn/_SKU_DFR0225_RoMeo_V2

Let's start the preparation work:

1. Installation and download of DFRobot Skylark Weather Instrument Library on Arduino platform

1.1 Download DFRobot_LarkWeatherStation library

The installation link is:
链接已隐藏,如需查看请登录或者注册
, download the zip file DFRobot_LarkWeatherStation-master.zip (17.71 KB, downloads: 0)

1.2 Library installation, add the zip library method as follows:

Adding the ZIP library to the Arduino IDE

1.3 Compile and report an error if the DFRobot_RTU library is missing

1.4 Add DFRobot_RTU library

1.5 Open the case program and compile it

1.6 Compiled and downloaded, the interface uses IIC interface

1.7 Physical connection photos

2. Obtaining DFRobot Skylark Weather Instrument Data via Arduino

2.1 Get the data and print it to the computer through the USB serial port. You can view the data in real time through the Arduino IDE

2.2 The program code is as follows

/*!
 * @File  getData.ino
 * @brief  This is a routine to get skylark data
 * ---------------------------------------------------------------------------------------------------------------
 *    board   |             MCU                | Leonardo/Mega2560/M0 |    UNO    | ESP8266 | ESP32 |  microbit  |
 *     VCC    |            3.3V/5V             |        VCC           |    VCC    |   VCC   |  VCC  |     X      |
 *     GND    |              GND               |        GND           |    GND    |   GND   |  GND  |     X      |
 *     RX     |              TX                |     Serial1 TX1      |     5     |   5/D6  |  D2   |     X      |
 *     TX     |              RX                |     Serial1 RX1      |     4     |   4/D7  |  D3   |     X      |
 * ---------------------------------------------------------------------------------------------------------------
 * 
 * @copyright    Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license       The MIT License (MIT)
 * @author        [TangJie](jie.tang@dfrobot.com)
 * @version       V1.0.0
 * @date          2023-06-8
 * @URL          https://github.com/DFRobot/DFRobot_LarkWeatherStation
 */
#include "DFRobot_LarkWeatherStation.h"
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
#include <SoftwareSerial.h>
#endif
#define DEVICE_ADDR                  0x42

#define MODESWITCH        /*UART:*/0 /*I2C: 0*/

#if MODESWITCH
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
  SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
  DFRobot_LarkWeatherStation_UART atm(&mySerial);
#else
  DFRobot_LarkWeatherStation_UART atm(&Serial1);
#endif
#else
DFRobot_LarkWeatherStation_I2C atm(DEVICE_ADDR,&Wire);
#endif

void setup(void){
  #if MODESWITCH
  //Init MCU communication serial port
  #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
    mySerial.begin(115200);
  #elif defined(ESP32)
    Serial1.begin(115200, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
  #else
    Serial1.begin(115200);
  #endif
  #endif
  Serial.begin(115200);
  while(atm.begin()!= 0){
    Serial.println("init error");
    delay(1000);
  }
  Serial.println("init success");
  atm.setTime(2023,1,11,23,59,0);
}

void loop(void){
    Serial.println("----------------------------");
    Serial.print(atm.getValue("Temp"));
    Serial.println(atm.getUnit("Temp"));
    Serial.print(atm.getValue("Humi"));
    Serial.println(atm.getUnit("Humi"));
    Serial.print(atm.getValue("Speed"));
    Serial.println(atm.getUnit("Speed"));
    Serial.println(atm.getValue("Dir"));
    Serial.print(atm.getValue("Altitude"));
    Serial.println(atm.getUnit("Altitude"));
    Serial.print(atm.getValue("Pressure"));
    Serial.println(atm.getUnit("Pressure"));
    Serial.println("----------------------------");
    Serial.println(atm.getInformation(true));
    delay(500);
}

Since then, the Arduino device has been used to obtain the data of the Skylark DFRobot Skylark weather instrument in real time. The data acquisition of other development boards is similar. Later, when there is time, other development boards will be used to obtain the data of the Skylark DFRobot Skylark weather instrument.

This post is from Sensor

Latest reply

Thanks for the technical sharing provided by the host. I will collect and study it first and then express my personal opinion.   Details Published on 2023-11-21 13:37
 
 

725

Posts

4

Resources
2
 

Thanks for the technical sharing provided by the host. I will collect and study it first and then express my personal opinion.

This post is from Sensor
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list