RS485 Device Configuration Guide
This guide explains how to connect an RS485 (Modbus) sensor to the Bridge IO, configure polling tasks to collect data, send it via LoRaWAN.
Prerequisite
Before configuring RS485, prepare the following:
- WisNode Bridge IO Lite
- An RS485 (Modbus) sensor
- External power supply (if required by the sensor)
- Gateway in range
- IO.Box (latest version recommended)
Connect RS485 Device to Bridge IO Device
This section shows how to use the RS485 interface on the Bridge IO to connect a device. The RK520-02 Soil Moisture, Temperature, and Electrical Conductivity Sensor (supports 12–24VDC wide input voltage) will be used as an example.
-
For other devices, refer to their documentation and connect accordingly.
-
If the sensor is powered by the Bridge IO, ensure the Bridge IO is connected to an external power supply. High-power sensors should be powered directly from an external supply.
Two wiring methods are supported depending on the sensor’s power source:
Sensor with Independent Power Supply
Connect the RS485 differential lines (A/B, labeled as D+/D− on some sensors) to the RS485_A and RS485_B interfaces of the Bridge IO. Sensor power is supplied externally.
Figure 1: wiring diagram1Sensor Powered by Bridge IO
- Connect the RS485 differential lines (A/B or D+/D−) to RS485_A and RS485_B.
- Power connections:
- Vout (12 V / GND): Sensor power input
- Vin (9–24 V): External power input
- Enable Power Output in IO.Box.
Figure 1: wiring diagram2Configure the RS485 Interface
Configure RS485 Communication Parameters
RS485 interface parameters must exactly match the sensor’s communication settings. Incorrect configuration will result in Modbus communication failure.
- Connect Bridge IO Device to IO.Box.
- Go to RS485 from the main menu and configure the following parameters.
NOTE
The parameters shown below are specific to the example sensor. For detailed parameter definitions, refer to RS485 Interface Configuration.
Figure 1: interface-configuration
- Baudrate: Select the RS485 communication speed (bits per second).
- Databits: Select the number of data bits for each character in the RS485 communication.
- Stopbits: Select the number of stop bits used in the RS485 communication.
- Parity: Select the parity setting for the RS485 interface.
- Transmission Mode: Defines how RS485 data is processed and transmitted over LoRaWAN®. This guide uses Parsing Mode. For configuration and data transmission using the transparent modes, refer to RS485 Transparent Transmission.
- Parsing Mode: Actively polls RS485 devices and converts the returned data into structured LoRaWAN payloads. A Modbus polling task is required.
- Polling Transparent Mode: Actively polls RS485 devices and forwards the returned raw Modbus data without parsing. A Modbus polling task is required.
- Passive Transparent Mode: Forwards received RS485 data without parsing or active polling. No Modbus polling task is required.
Add Modbus Poll Task
Because Parsing Mode is selected in this example, create Modbus polling tasks to define how the Bridge device queries and parses data from the connected RS485 sensor.
This example creates polling tasks for temperature, moisture, and electrical conductivity (EC). If you need to create a polling task with a raw binary data type, refer to (Optional) Add a Raw Data in Binary Poll Task.
- In the Modbus Poll Task menu, click +Add for a new poll. You will see the Polling Task parameters that need to be configured.
Figure 1: Add poll task - Fill in the relevant fields according to the specific sensor’s datasheet, as shown in the screenshot and parameter settings below. Here we create a temperature polling task as an example.
NOTE
Only parameters directly related to these polling tasks are described here. Other parameters remain at their default values. For more details, refer to Add Modbus Poll Task.
Figure 1: Add temperature polling task
- Channel ID: Identifier of the polling task.
- Device Address: The unique address of the connected device on the RS485 bus, obtained from the device manual.
- Function Code: Specifies the task's Modbus operation type (read or write), obtained from the device manual.
- Register Address: The target register or coil address used in the Modbus request, obtained from the device manual.
- Scale: To adjust the raw data from the Modbus response to the desired units.
- Sensor Type: Select the unit or category that best matches your slave device output (used for correct interpretation and presentation).
- Click Check to perform automatic validation. If the returned values are correct, save the polling task.
- Read Request: Displays the Modbus command generated from the selected settings, which is used to communicate with the device.
- Read Response: Displays the response received from the Modbus slave device.
- Read Value: Shows the parsed value extracted from the Response, based on the configuration above.
- Uplink Data: Displays the data payload format that will be sent to the server, based on the configuration above.
- Create moisture and EC polling tasks in the same way.
Figure 1: Add moisture polling task
Figure 1: Add EC polling task
Figure 1: Created polling tasks
(Optional) Add a Raw Data in Binary Poll Task
- In the Modbus Poll Task menu click +Add for a new poll. You will see the Polling Task parameters that need to be configured.
Figure 1: Add poll task - Fill in the relevant fields according to the specific sensor's datasheet. Here we create a temperature polling task as an example.
Figure 1: Add temperature polling task
- Channel ID: Enter the identifier for the polling task.
- Device Address: The unique address of the connected device on the RS485 bus, obtained from the device manual.
- Function Code: Specifies the Modbus operation type (read or write), obtained from the device manual.
- Register Address: The target register or coil address used in the Modbus request, as specified in the device manual.
- Data Type: The data type of the Modbus response. In this document, select
Modbus ADU. - Sensor Type: Select the unit or category that best matches your slave device output. In this document, set it to
Raw Data in Binary (Modbus ADU).
- Click Check to perform automatic validation. If the returned values are correct, save the polling task.
- Request: Displays the Modbus command generated from the selected settings, which is used to communicate with the device.
- Response: Displays the response received from the Modbus slave device.
- Value: Shows the parsed value extracted from the Response, based on the configuration above.
- Uplink Data: Displays the data payload format that will be sent to the server, based on the configuration above.
- Create moisture and EC polling tasks in the same way.
Figure 1: Add moisture polling task
Figure 1: Add EC polling task
Figure 1: Created polling tasks
Connect Bridge IO to LoRa Network Server for Uplink
This section provides you with operation guidance for connecting the Bridge IO to different LoRaWAN network servers and forwarding the collected data to the server (uplink).
Before connecting to the LNS, ensure that you have completed Configure LoRaWAN Parameters in IO.BOX.
Built-in Network Server
In this section, the Bridge IO is connected to a RAKwireless gateway running WisGateOS 2, using the gateway's built-in LoRaWAN Network Server (LNS).
Set Up the Built-in Network Server
- Log in to the gateway Web UI. For instructions on how to access the Web UI, refer to the user guide for your gateway.
Figure 1: WisGateOS 2 login page - Once logged in, head to the LoRa menu.
Figure 1: LoRa page - By default, the gateway works as a Built-In Network Server. If not, switch the Work mode to Built-in network server.
Adding Application
- Once the gateway is in Built-in network server mode, head to the Applications tab.
Figure 1: Create Application in the Built-In Network Server - Click the Add application button or add one now link to add a new application. On the new page, fill in the following information:
Figure 1: Adding application
- Application name: Type a name for the application.
- Application Type: Select the application type from the drop-down menu. In this document, choose Unified Application Key.
- Unified Application key: All devices use the same application key. After selecting this option, the Application Key field will appear. You can manually enter the application key or click Autogenerate to generate one automatically. This value must match the one configured on the end device.
Figure 1: Unified application key
- Unified Application key: All devices use the same application key. After selecting this option, the Application Key field will appear. You can manually enter the application key or click Autogenerate to generate one automatically. This value must match the one configured on the end device.
The Auto Add Device switch activates the Application EUI field. The device will be automatically added to the application after the application EUI and key verification.
Figure 1: Auto add device- Payload type: From the drop-down, select CayenneLPP payload type and turn on the Only forward data object feature.
- Once set, click Save application to add the application.
- After the application is added, head to the End devices tab. The devices should automatically register upon join request if you are using the Auto Add Device feature.
If that’s not the case, click the Add end device button. On the End device information page fill in the following information:
Figure 1: Successfully created application
- Activation Mode: Choose the activation mode of your device.
- OTAA: Selected in this document.
- ABP: This mode pops up two additional fields:
- Application Session Key
- Network Session Key
- End device (group) name: the name of the device.
- Class: the class of the device.
- Frame Counter width: the width of the frame counter. Leave it as default.
- LoRaWAN MAC Version: the LoRaWAN MAC version.
Adding the Device
- Once everything is set, click Add end devices to go to the page and add the device.
- On the Adding end devices page, type the device EUI at the End Device EUI (main) and click Add to “End Devices list”.
Figure 1: Adding end device - Once the device is added to the End devices list click Add end devices. Confirm you are adding the device.
Figure 1: Confirmation message for adding a device - After the device has successfully joined the LNS, you will see the LoRaWAN status in the IO.Box console toggles as activated. You might need to refresh the page.
Figure 1: Device is online
Figure 1: LoRaWAN status
Wait a while and you will see the uplink data from the LoRaWAN network.
The following is an example of RS485 uplink data and its message format:
01 + 67(tem) + 00cb(Hex) 20.5(Dec) 20.5℃ 02 + 70(RH) + 0124(Hex) 292(Dec) 29.2%
03 + 7f(EC) + 0000dea8(Hex) 57000(Dec) 57.000us/cm
Figure 1: Uplink dataThe Things Network (TTN)
Gateway Configuration
RAK gateways can connect to The Things Stack (TTN v3) using the following methods:
Packet Forwarder (UDP)
To connect a gateway to TTN v3 using Packet Forwarder (UDP), see How to Connect RAK Gateways to TTN v3 via UDP.
Basics™ Station (LNS)
To connect a gateway to TTN v3 using Basics™ Station (LNS), see How to Connect RAK Gateways to TTN v3 Using Basics™ Station (LNS).
Basics™ Station (CUPS)
To connect a gateway to TTN v3 using Basics™ Station (CUPS), see How to Connect RAK Gateways to TTN v3 Using Basics™ Station (CUPS).
Bridge IO Configuration
You can create applications and automatically register node devices on the TTN network server through IO.Box. For detailed configuration steps, refer to The Things Stack (TTN v3) Integration.
- After the device is created successfully, you can view the added device in the TTN.
Figure 1: Added device in the TTN - To activate the device, click Apply.
Figure 1: Active the device - After a successful Apply, the device in the TTN is activated and receives data as shown in Figure 62.
Figure 1: Device is online
Figure 1: Data details
You will also see the LoRaWAN activation status in the IO.Box console enabled.
Figure 1: LoRaWAN statusChirpStack
This guide will show you how to connect the Bridge IO to a ChirpStack v4 network server.
Gateway Configuration
A gateway can be connected to the ChirpStack v4 server using the following methods:
Packet Forwarder (UDP)
To connect a gateway to ChirpStack v4 using Packet Forwarder (UDP), see How to Connect RAK Gateways to Chirpstack v4 via UDP.
Packet Forwarder (MQTT)
To connect a gateway to ChirpStack v4 using Packet Forwarder (MQTT), see How to Connect RAK Gateways to Chirpstack v4 via MQTT.
Basics™ Station (CUPS)
To connect a gateway to ChirpStack v4 using Basics™ Station (LNS), see How to Connect RAK Gateway to Chirpstack v4 Using Basics™ Station (LNS).
Bridge IO Configuration
You can create applications and automatically register node devices on the ChirpStack server through IO.Box. For detailed configuration steps, refer to ChirpStack v4 Integration.
- After the device is created successfully, you can view the added device in the ChirpStack.
Figure 1: Added device in the ChirpStack - To activate the device, click Apply.
Figure 1: Active the device - After a successful Apply, the device in the ChirpStack is activated and receives data.
Figure 1: Device is online
Figure 1: Data details
You will also see the LoRaWAN activation status in the IO.Box console enabled.
Figure 1: LoRaWAN status