Skip to content

Latest commit

 

History

History
 
 

Wind_Speed_Monitoring

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Wind Speed Monitoring over LoRaWAN®

[TOC]

1. Introduction

exa-par-solution

This solution shows how to create an agriculture wind speed sensor node. The sensor node measures the wind speed from a sensor with a RS485 interface by Modbus protocol. It then transmits this data frequently over LoRaWAN® to a LoRaWAN® server.

At the LoRaWAN® server the data arrives in the following format:

Byte1 Byte2 Byte3
10 S1 S2
where
  • Byte 1 is a marker for the data type, here always 10
  • Wind speed is sent as S1.S2 e.g. 54.03 m/s

1.1 LoraWAN

If you want to know how to use the LoRa® communication with WisBlock. You can refer to the following document.

[LoRaWAN® ](/examples/communications/LoRa/LoRaWAN® /)

1.2 Modbus

Modbus has become a standard communications protocol and is now the most commonly available means of communicating with industrial electronic devices. In this case, the wind speed sensor supports Modbus protocol over RS-485 physical layers.

All Modbus devices include a register map with the location and a description of the data stored in the registers. Modbus functions operate on register map to monitor, configure, and control the device’s inputs and outputs. You have to refer to the register map of your device to gain a better understanding of its operation. Modbus registers are organized into reference types identified by the leading number of the reference address. You can see below an example of how to read and write data in a Modbus device.

exa-wind-regmap

In our example, we are going to read the speed value from our device. We can see in the register map on above, the default Device Address is 1, the speed value is stored in the register 0016H, and is accessible with the function ModbusRTUClient.requestFrom(), and is stored in 16 bits format (2 bytes).

ModbusRTUClient.requestFrom(1, HOLDING_REGISTERS, 0x0016, 2)

HOLDING_REGISTERS is 0x03. To get more detail, Please refer to Modbus protocol specification

If result is 0x0017.

0x0017(H) = 23 => Wind Speed is 2.3m/s

2. Hardware required

To build this system, the following hardware are required:

WisBlock Base RAK5005-O * 1pcs

WisBlock Core RAK4631 * 1pcs

WisBlock IO RAK5802 * 1pcs

JXBS-3001-FS * 1pcs

Note: To send the data of sensor node to LoRaWan® server, a LoRaWan® gateway is also needed. If you don't have, we recommend you use RAK7243.

The assembly of sensor node is as follows:

exa-par-assy

exa-wind-sensor

exa-wind-assy

3. Software required

3.1 Install library

lib-manager

lib-rs485-install

lib-modbus-install

lib-sx12x-install

4. Example

The code for the wind speed sensor node can be found in the sketch file

The logs of sensor node is as follows:

=====================================
Welcome to RAK4630 LoRaWan!!!
Type: OTAA
Region: EU868
=====================================
-------speed------ = 1.900000
OTAA Mode, Network Joined!
-------speed------ = 2.000000
-------speed------ = 2.000000
Sending frame now...
lmh_send ok count 1
-------speed------ = 2.000000
-------speed------ = 1.800000
Sending frame now...
lmh_send ok count 2
-------speed------ = 2.000000
-------speed------ = 2.000000
Sending frame now...
lmh_send ok count 3
-------speed------ = 2.000000
-------speed------ = 2.100000
Sending frame now...
lmh_send ok count 4

The logs of LoraWan Server is as follows:

exa-wind-data

LoRa® is a registered trademark or service mark of Semtech Corporation or its affiliates. LoRaWAN® is a licensed mark.