Skip to main content

YO Modbus

Overview

Description

The YO Modbus acts as a bridge between the Modbus network and LoRaWAN, enabling users to read data from Modbus RTU slave devices and send it via LoRaWAN. It supports up to 150 Modbus queries, transmitting them in a maximum of 30 LoRa packets, with each packet capable of carrying up to 5 queries. This efficient data transfer capability ensures seamless integration between Modbus devices and LoRaWAN networks.

Device top viewDevice top view

Figure 1. Device top view

Device sticker placed on the right side of the device enclosure contains information about model, version, LoRaWAN region and 3 parameters important in case of device identification and configuration:

  • DEV EUI: 64-bit unique device identifier in a LoRaWAN network,
  • DEV ADDR: address required to connect via ABP activation type to LoRaWAN,
  • BLE MAC: Bluetooth physical address.
Device stickerDevice sticker

Figure 2. Device sticker

Features

  • LoRaWAN Technology: Available in multiple versions with LoRa radio configured for various regions and ISM frequency bands (e.g., EU868, US915, AU915), it is compatible with both private and public LoRaWAN networks and supports connections via ABP (Activation by Personalization) or OTAA (Over-The-Air Activation).
  • Bluetooth Low Energy (BLE): Enables easy configuration through a user-friendly JSON data exchange format, supports firmware updates via OTA (Over-the-Air), and boasts very low energy consumption.
  • Modbus Network: Can request up to 150 different queries from slave devices.
  • RS485 input: Galvanically isolated from the rest of the device modules for maximum protection.
  • Yosensi Management Platform: Provides a web tool for device configuration, firmware updates, and infrastructure management. Enables comprehensive monitoring of transmitted data and easy device management.
  • Yosensi Mobile App: Effortlessly manage devices with features to register new ones, configure settings, perform firmware updates, view/send logs, and test LoRaWAN connectivity. Learn more in our detailed Yosensi App blog post.

Specifications

Physical

DimensionDimension

Figure 3. Dimensions of the device

Device

AttributeDescription
DimensionsHeight: 90 mm
Width: 17.5 mm (1 pole)
Depth: 58 mm
ColourLight Grey
Mounting method35 mm DIN rail standard
Enclosure materialPolycarbonate
Level of protectionIP20, UL94-VO
Input signalDigital RS485
Weight90 g

Operating Conditions

°C°F
AttributeDescription
Temperature0°C to 70°C
Humidity0 to 90%
PlacementIndoor use
Power supply6-30 V DC
5-21 V AC
Power consumptionTypical: 12 mA DC (12 V DC)
Maximum: 120 mA DC (12 V DC)

Measured Values

ParameterMeasurement rangeAccuracy
Internal Voltage6-30 V DC-
Queries and Polls--

Queries and polls

YO Modbus can request up to 150 different queries from slave devices. Establishing communication requires advance knowledge of the device's starting registers, slave address and function codes. This device supports the following read functions:

  • 01 (0x01) Read coils
  • 02 (0x02) Read discrete inputs
  • 03 (0x03) Read holding registers
  • 04 (0x04) Read input registers
  • 05 (0x05) Write single coil
  • 06 (0x06) Write single holding register
  • 0F (0x0F) Write multiple coils
  • 10 (0x10) Write multiple holding registers

The query data are read by Modbus RTU and sent by LoRaWAN. Each LoRa packet contains data from the read registers. One LoRa packet can contain 5 user-created polls, each up to 4 bytes.

More information can be found in the parameters section.

RS485 Interface

Connecting RS485 Nodes to YO Modbus

  • Connect the A+ line to the RS485 A bus and B− line to the RS485 B bus.
  • Connect GND to the ground terminal of the RS485 bus.
Power Supply
  • The device supports 6–30 VDC or 5–21 VAC power input.
  • Optionally, connect a protective earth cable. To avoid loop currents, ensure the earth connection is made at only one point in the network.
Line Topology and Termination
  • For certain line topologies, terminating loads may be required depending on the cable length.
  • The termination load impedance should match the line impedance on both ends, typically 120 Ω on each side.
  • The device includes a built-in terminating resistor (RT).
Communication

YO Modbus operates by:

  1. Sending queries to each device in the network.
  2. Converting the collected data into LoRa frames for relay to the application server.

Before communication begins:

  • Configure the serial transmission settings in the YO Modbus device.
  • Obtain the slave addresses and the individual registers required for reading data.

Controls and Indicators

LED Status Indicator

YO Modbus communicates its current behaviour to the user by RGBW LED placed on the top.

Diode statuses interpretation

BehaviorColourStatus
Single flashGreenGeneral: device is working correctly (power and memory).
Single flashRedGeneral: device is working incorrectly (power and memory).
LoRaWAN communication: failed to receive an acknowledgement from LoRaWAN Server within specified timeout.
Single flashWhiteLoRaWAN communication: LoRaWAN frame sent / confirmation from LoRaWAN Server after receiving the frame.
Slow flashingBlueBLE communication: connection to the device via BLE (configuration).
Rapid flashingBlueLoRaWAN communication: connecting to LoRaWAN network.
Continuous litOrangeTerm diode: Terminating resistor connected.
Rapid flashing RS485RedRX/TX diode: RS485 packet sent.
GreenRX/TX diode: RS485 packet received.

Buttons

YO Modbus is equipped with one reset button under the interference status diode RX/TX shown on the device top view. It is possible to press it with a thin pin.

Device reset buttonDevice reset button

Figure 4. Device reset button

Installation

Package Contents

  1. Device.
  2. Antenna.
  3. Warranty card.

Safety Precautions

NOTE

Go to the Safety Precautions section to see important information on handling, disposal and maintenance.

Installation Guide

  1. Mount the device on a 35 mm DIN rail.
Device mounting instructionsDevice mounting instructions

Figure 5. Device mounted on 35 mm DIN rail

  1. Screw RS485 protocol communication wires to the device's A+ and B- terminal blocks. Optionally, connect cable shielding to the device's GND terminal block.
Connecting communication wires to device terminal blocksConnecting communication wires to device terminal blocks

Figure 6. Connecting communication wires to device terminal blocks

  1. Screw the power supply wires to the device (6-30 V DC, 5-21 V AC). Optionally, connect a protective earth (PE) cable. Once power is connected, the indicator diodes should behave as described in LED Status Indicator.
Connecting power supply to the deviceConnecting power supply to the device

Figure 7. Connecting power supply to the device

  1. Connect the antenna to the device.
Device with antennaDevice with antenna

Figure 8. Device with antenna

Configuration

Configurable Parameters

A few parameters must be set before sending data to the gateway. The default firmware is configured in OTAA mode with predefined deveui, appkey (OTAA) and appskey, nwkskey (ABP).

Configuration of the device is stored in a JSON file divided into the following sections:

  • info (generic, read only): information about the device,
  • lorawan (generic): configuration data for LoRaWAN connection,
  • ble (generic): Bluetooth settings,
  • device (dynamic): individual configuration for a specific device (this section’s structure differs for each device),
  • modbus (dynamic): individual configuration of Modbus RTU communication,
  • serial (dynamic): asynchronous serial communication parameters for Modbus RTU protocol,
  • timings (dynamic): timings for response and delays between master-slave communications,
  • queries (dynamic): queries configured and executed by the user,
  • pollstosend (dynamic): polls sent by slave to the master; data collections prepared to send via LoRaWAN,

Sample configuration file for the YO Modbus device.

{
"info": {
"devmodel": "LNRM",
"fwver": "3.6.3",
"loraradio": "SX1261",
"lorawanver": "1.0.2",
"loraregion": "EU868",
"blemacaddr": "0123456789ab"
},
"lorawan": {
"subband": 1,
"nwktype": "public",
"acttype": "otaa",
"otaa": {
"deveui": "0123456789abcdef",
"appeui": "fedcba9876543210",
"appkey": "000102030405060708090a0b0c0d0e0f",
"trials": 3
},
"abp": {
"devaddr": "01234567",
"nwkskey": "0123456789abcdef0123456789abcdef",
"appskey": "000102030405060708090a0b0c0d0e0f"
}
},
"ble": {
"power": 0,
"interval": 1600
},
"device": {
"measinterval": 600,
},
"modbus": {
"terminationresistor": false,
"driverswitchidletime": 5
},
"serial": {
"baudrate": 9600,
"databits": 8,
"parity": "none",
"stopbits": 1
},
"timings": {
"responsetimeout": 1000,
"delaybetweenpolls": 100
},
"queries": [
{
"name": "01Ph1V",
"slaveaddr": 1,
"funccode": 3,
"startreg": "1000",
"regnbr": 2
},
{
"name": "RunHour",
"slaveaddr": 1,
"funccode": 3,
"startreg": "106e",
"regnbr": 1
},
{
"name": "3PHpwrfctr",
"slaveaddr": 1,
"funccode": 3,
"startreg": "1024",
"regnbr": 1
},
{
"name": "1PHactpwr",
"slaveaddr": 1,
"funccode": 3,
"startreg": "102c",
"regnbr": 2
}
],
"pollstosend": [
{
"cnt": 1,
"out": [
"01Ph1V",
"RunHour",
"3PHpwrfctr",
"1PHactpwr"
]
}
]
}

OTAA & ABP

OTAAABP
Device EUIDevice Address
Application EUINetwork Session Key
Application KeyApplication Session Key
Number of Trials

Generic Parameters

Parameters

Device Parameters

NameDescriptionPossible ValuesDefault ValueRead/Write
measintervalMeasuring and sending interval LoRa [s]601-999999600R/W
  1. OTAA minimum 60 [s], ABP minimum 120 [s]

Modbus Parameters

NameDescriptionPossible ValuesDefault ValueRead/Write
terminationresistorPresence of termination resistor in RS485 standardtrue, falsefalseR/W
driverswitchidletimeDelay [ms] of TX and RX parameters in serial communication between devices in the network1-1005R/W

Serial and Timings Parameters

NameDescriptionPossible ValuesDefault ValueRead/Write
baudrateBus speed [bps]1200, 2400, 4800, 96009600R/W
databitsNumber of data bytes per packet7, 8, 98R/W
parityData integrity validation typenone, odd, evennoneR/W
stopbitsLast bit type of a one-byte transmission1, 21R/W
responsetimeoutResponse timeout from slave device in [ms]10-100001000R/W
delaybetweenpollsDelay [ms] before the next query1-10000100R/W

Queries and Polls Parameters

NameDescriptionPossible ValuesDefault ValueRead/Write
nameName of query, up to 10 characters“0-9, A-Z, a-z, _, . ,”
e.g. aB.cD-01
-R/W
slaveaddrNumber of slave addresses to communicate with0-2551R/W
funccodeSupported Modbus function codes1, 2, 3, 43R/W
startregStart register to read data from2B (HEX), e.g. 1000-R/W
regnbrNumber of words (2 bytes) to read from registers, begins from ’startreg’1-81R/W
cntLoRa packet collection index number. Each packet can contain 5 queries.1-30-R/W
outName of the query to be transmitted in a LoRa packet“0–9 A–Z a–z . ,”
e.g. aB.cD-01
-R/W

Parameters description

  • nwktype: used for setting the device in public or private network type.
  • acttype: used for setting the device in ABP or OTAA mode.
  • deveui, … , appskey: predefined addresses and keys, these parameters are generated using multiple IDs specific to the particular MCU and are unique for each device. They can be changed if needed.
  • interval: determines the interval of sending broadcast packets, used to connect to every BLE receiver around the device.
  • subband: used for setting the communication frequency sub-band in LoRaWAN.
  • measinterval: measurement interval [s] between sending LoRa packets.
  • teminationresistor: whether a resistor is applied to the end line to prevent signal reflections for correct signal transmission. Value “TRUE” means that the resistor is installed.
  • driverswitchiddletime: Delay [ms] from 1 ms up to 100 ms for serial TX and RX parameters between devices in the network.
  • baudrate: information transfer rate bits per second. Supported baud rates are 1200, 2400, 4800, 9600.
  • databits: the amount of data in each packet. 7, 8, 9 formats are not supported with parity “none” value.
  • parity: The parity bit, unlike the start and stop bits, is an optional parameter, used in serial communications to determine if the data character being transmitted is correctly received by the remote device.
  • stopbits: the last bit of a one-byte transmission, used for timing or synchronization.
  • responsetimeout: how long Modbus Poll should wait for a slave device response before giving up. Default is 1000 ms.
  • delaybetweenpolls: the minimum delay until the next request is transmitted. Default is 100 ms.
  • name: name of the query parameter, up to 10 characters. The name can be freely modified by the user to correspond to the parameter to be read out.
  • slaveaddr: address of the target slave device.
  • funccode: function code for the Modbus RTU protocol. Value 1 indicates “read coils”, value 2 = “read contacts”, 3 = “read holding registers”, 4 = “read input registers”.
  • startreg: starting register, which is the address from which the reading of data from a particular slave will start.
  • regnbr: register number of data to read from the slave. Value “1” means that 2 bytes will be read, value “2” = 4 bytes will be read over the Modbus network..
  • cnt: packet counter index. The YO Modbus device can handle up to 150 queries. Limitation is 5 variables per query.
  • out: the query name for the output of the slave. Maximum of 5 queries per packet (along with maximum of 150 queries per Modbus).

You can remotely adjust certain parameters by sending a downlink message through our platform. Simply navigate to the "COMMANDS" section for the selected device.

Update Measurement Interval

It is possible to change the measurement interval (measinterval) by using downlink. Information about changing the parameter will be sent from the server via the gateway.

Example of Downlink Message:

  • Prefix: 0x03
  • Measurement Index: 0x00
  • Data (up to 4 bytes in hex): 0258

Sample Downlink: 0x03000258 - Sets a measurement interval of 600 seconds (10 minutes).


Payload Decoder

If you want to connect to your own server, it is necessary to decode the specific payload for each device. To accomplish this, a payload decoder is required, which can be downloaded using the following link: Payload decoder. You can also use our integrated Payload Decoder here. Extended documentation of the protocol can be found in the Payload description on our website.

Compliance Statements

NOTE

To view or download the Declaration of Conformity for YO Modbus go here