how to connect a third-party rs485 sensor to the rak sensor hub

The RAK2560 Sensor Hub is designed to interface with multiple sensor types, enabling centralized data collection over a LoRaWAN network. While it works seamlessly with RAKwireless sensors, it can also be configured to support third-party devices, including RS485/Modbus sensors, via the Generic Probe IO adapter.

To illustrate the integration process, this guide outlines the steps for connecting a third-party Modbus RS485 soil sensor. The sensor used in this example is the VEMSEE SN-3002-TR-ECTHNPKPH-N01, a multi-parameter device commonly used in agricultural and environmental monitoring.

 

Requirements

  • RAK2560 Sensor Hub
  • Generic Probe IO
  • A power supply
  • WisToolBox
  •  Smartphone with NFC
  • Third-party RS485 sensor, with:
    • Wiring/connection diagram
    • Communication parameters
    • Register description
‼️
IMPORTANT

It is crucial to have detailed information about the sensor. The most reliable source is the sensor manufacturer, typically provided in in the sensor datasheet. 

Without a sensor connection diagram, communication parameters and a register description, establishing a connection with the Sensor Hub is not possible. 

Gather the Third-Party RS485 Sensor Specifications

Before connecting the RS485 sensor to the RAK2560 Sensor Hub, review the sensor’s datasheet to ensure correct wiring, protocol settings, and power requirements. Accurate setup depends on having complete technical specifications.

Communication Parameters

Most RS485 devices support multiple baud rates, with 9600 baud often used as a default. However, this is not consistent across manufacturers. The sensor in use defaults to 4800 baud, with 8 data bits, no parity, and 1 stop bit (8N1 configuration).

Sensor-Parameter-1.png

Figure 1: VEMSEE RS485 sensor basic communication parameters

Register Description

Each sensor defines its register map for data access. For this sensor, the relevant values are located in the first four registers. Additionally, scaling factors must be applied to convert raw register values into meaningful sensor data. These factors are required during setup to ensure accurate data interpretation.

Sensor-Parameter-2.png

Figure 2: VEMSEE RS485 sensor register address

ℹ️
INFO

The sensor types noted in the image as comment will be required later for the setup if a sensor profile file is used.

 

Connection Diagram

The Sensor Probe IO uses a screw-terminal interface for sensor connections. If the sensor cable includes a pre-installed connector, it must be removed to expose the individual wires. 

RS485 devices typically use four wires: 

  • Two  for power 
  • Two for differential data (A/B)

Refer to the sensor’s datasheet to identify wire functions and ensure correct pin assignments.

Sensor-Parameter-3.png

Figure 3: RS485 sensor interface and wiring details

At this point, you should have all the essential information needed to wire the sensor to the Sensor Hub, including:

  • The correct wiring diagram
  • The sensor’s supply voltage requirements
  • The register map and scaling factors
  • The communication parameters (baud rate, data bits, parity, stop bits)

You can now proceed to connect the sensor wires to the Sensor Probe IO.

 

Connect the RS485 Sensor to the Sensor Hub Probe IO

To connect the sensor wires to the Probe IO, follow the steps below:

1. Open the Probe IO
Remove the four screws to open the lid and access the internal screw terminals.

2. Identify Terminals
Locate the two screw terminals and refer to the pin labels printed on the side of the enclosure.

Sensor-Connection-1.png

Figure 4: Sensor probe IO

3. Prepare and Connect Wires
Using the sensor’s datasheet, match each wire to the correct pin. RS485 sensors require only four connections: two for power and two for differential data (A and B). 

Refer to the wire color codes in the sensor datasheet and the screw terminal labels on the Sensor Hub to ensure correct alignment. Secure all connections firmly.

 

Sensor-Connection-2.png

Figure 5: Probe IO RS485 power and communication pins

 

ℹ️
INFO

For full description of the screw terminals, refer to the Probe IO datasheet.

 

‼️
IMPORTANT

Do not connect the Probe IO to the Sensor Hub during wiring. Complete all connections and check for exposed wires before powering on. 

 

4. Check and Finalize

Ensure no bare wires are exposed or touching adjacent terminals or the PCB. Then, close the Probe IO and connect it to the Sensor Hub.

Sensor-Connection-3.png

Figure 6: RS485 sensor to Sensor Hub Probe IO connection

Configure the RS485 Sensor for the Sensor Hub in WisToolBox

Since the Generic Probe IO does not contain any predefined information about the connected sensor, you must configure both the connection parameters and sensor data settings manually using WisToolBox.

There are two ways to do this:

  1. Manual Setup in WisToolBox: Configure the sensor directly by entering the parameters in the UI. 
  2. Sensor Profile File Setup: Create a reusable sensor profile file that can be imported into WisToolBox and applied to the Probe IO.

Manual configuration is ideal for setting up a single sensor, such as for testing purposes. However, when deploying multiple units, using a sensor profile file is a more efficient and scalable option, allowing the same configuration to be applied consistently across all devices.

Manual Setup in WisToolBox

Once the generic Probe IO is connected to the Sensor Hub, it will be automatically detected in the WisToolBox as Generic Probe IO. If the Probe IO has not yet been configured, it will display only the standard IO options. 

To set up the connection to the soil sensor, refer to the instructions below:

1. Navigate to the RS485 Interface tab in WisToolBox.

WisToolBox-Manual-Setup-1.png

Figure 7: RS485 Interface tab

2.Configure the RS485 data interface with the following parameters:

    • Baud Rate: 4800 baud
    • Data Bit: 8 bits
    • Parity Bit: None
    • Stop Bit: 1

WisToolBox-Manual-Setup-2.png

Figure 8: RS485 configuration parameters

 

3. Open the Modbus Commands. Each sensor register requires a separate Modbus read command to retrieve its value. 

4. Select Command ID 1 to set up the reading of the sensor’s soil moisture values.

5. Update the Function Code, Start address, Data type, and Scale fields based on the information provided in the sensor datasheet. Set the following fields to:

WisToolBox-Manual-Setup-3.png

Figure 9: Modbus Commands configuration

  • Function code: Holding Register (for the sensor fields)
  • Start address: 0000. It should match the register address listed in the sensor datasheet. From the sensor datasheet:

WisToolBox-Manual-Setup-7.png

Figure 10: RS485 register address and content

  • Data type: INT16_BE. Must match the standard size of a register.
  • Scale: 0.1. It corresponds to the expanded 10 times comment in the datasheet.

WisToolBox-Manual-Setup-8.png

Figure 11: Scale parameter

6. Enter the Device Address. This must match the Modbus used by the sensor.

According to the datasheet, the default address is 1. Most devices allow this address to be changed, which is essential when multiple sensors share the same RS485/Modbus bus. If the device uses a different address, enter the correct value in the Device Address field.

WisToolBox-Manual-Setup-6.png

Figure 12: Sensor's address code description

7. The Unit field is a drop-down menu with all sensor types supported by the SensorHub. For the soil sensor moisture data, Moisture is the correct setting.

WisToolBox-Manual-Setup-9.png

Figure 13: Sensor type options under Unit

8. Set Max wait (ms) to 5000 and Max retry to 2. These values are good starting points and can be increased if there are issues retrieving data from the sensor.

9. Enter a custom label in the Name field, and the Period (s) defines the data polling interval, which should be configured to suit the requirements.

10. Once all fields are adjusted, the Modbus command used to acquire the data is shown in the Modbus ADU field. 

11. If the sensor datasheet includes Modbus command examples, compare them to verify accuracy, then click APPLY to save the settings.

12. Repeat the process for additional sensor parameters:

  • Command ID 2: Soil temperature
  • Command ID 3: Soil conductivity
  • Command ID 4: Soil pH

13. Once all RS485/Modbus read commands have been configured and saved using the APPLY button, forcibly remove the Probe IO from the Sensor Hub by clicking the REMOVE SENSOR PROBE button.

WisToolBox-Manual-Setup-4.png

Figure 14: Temporarily remove the sensor probe 

The Probe IO will automatically reconnect with the new configuration. The new sensor values will now be visible in WisToolBox.

WisToolBox-Manual-Setup-5.png

Figure 15: New sensor values

14. On the initial refresh, the sensor values might still display as 0. Click the FETCH DATA button to manually trigger a sensor read.

ℹ️
INFO

The FETCH DATA function only reads and displays the sensor data in the app. It does not transmit the values over LoRa or cellular networks.

 

Sensor Profile File Setup for the Sensor Hub

The second method to configure custom sensors for the Sensor Hub is to create a sensor profile file.

This method not only simplifies configuration when deploying multiple identical sensors but also enables advanced control of the sensor’s power supply behavior.

Creating a Sensor Profile File

A profile file is a JSON format that defines the sensor configuration, containing five entries:

SensorName A unique name for the sensor, such as VEMSEE.
TemplateVersion 1
ProbeioVersion 1.2.9
Interface

Select the interface of the generic Probe IO to configure. Available options are:

  • RS485 for RS485/Modbus
  • RS232 for RS232 serial interface
  • SDI12 for SDI-12 serial interface
  • AI for analog in, e.g., 4-20 mA
  • DI for digital input
  • DO for digital output
Content

An array with AT commands to define the sensor actions.

Here is the sensor profile file created for the VEMSEE RS485 soil sensor used in this tutorial:

{
  "SensorName": "VEMSEE",
  "TemplateVersion": "1",
  "ProbeioVersion": "1.2.9",
  "Interface": "RS485",
  "Content": [
    "atc+io_psm={PRB_ID}:9:1:6000:0:1",
    "ATC+IO_CFG={PRB_ID}:RS485:4800:8:1:0",
    "ATC+SNSR_CONF={PRB_ID}:8:{SNSR_INTV}:2",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID1}:{DEV_ADDR}0300000001:60:1000:2:6:0.1:188:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID2}:{DEV_ADDR}0300010001:60:1000:2:6:0.1:103:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID3}:{DEV_ADDR}0300020001:60:1000:2:6:1:127:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID4}:{DEV_ADDR}0300030001:60:1000:2:6:0.1:194:{PROFILE_NAME}",
    "atc+prb_del={PRB_ID}"
    ]
}

 

Another sensor profile example for the 4-20 mA sensor. For more details, refer to the 4-20 mA Sensor to Sensor Hub guide.

{
    "SensorName": "ULB16_05",
    "TemplateVersion": "1",
    "ProbeioVersion": "1.2.7",
    "Interface": "AI",
    "Content": [
      "atc+io_psm={PRB_ID}:9:1:10000:0:1",
      "ATC+SNSR_CONF={PRB_ID}:8:{SNSR_INTV}:2",
      "atc+io_decode={PRB_ID}:ai:1:130:5:0:{PROFILE_NAME}:0",
      "atc+prb_del={PRB_ID}"
      ]
}

 

AT Command Reference for Sensor Interface Setup

The following AT commands are used to set up the sensor interface, such as configuring power management, data interface settings. 

ℹ️
INFO
  • Values enclosed in braces {...} are assigned automatically while deploying the sensor profile.
  • Values enclosed in angle brackets <..> are values that have to be setup in the profile.

 

1. ATC+IO_PSM

Defines how the sensor’s power supply is managed. Two power mechanisms are available:

  1. Always On: The sensor remains powered continuously.
  2. Interval-Based Power: The sensor remains off until a reading is triggered. Power is then enabled for <SensorWarningTime> milliseconds before the data is read, after which the sensor is powered off again.

Parameters of the atc+io_psm command:

ATC+IO_PSM={PRB_ID}:<UartPSM>:<SensorPSM>:<SensorWarningTime>:<SensorVolt>:<method>
{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.
<UartPSM>

UART power mechanism:

  • 8 = power always on
  • 9 = automatic power-off mode
<SensorPSM>

Sensor power mechanism:

  • 0 = power always on
  • 1 = automatic power-off mode
<SensorWarningTime>

The duration, in milliseconds, that the sensor remains powered in automatic power-off mode before the sensor data is read.

Otherwise, it’s 0.

<SensorVolt>

 Voltage selector for sensor supply:

  • 0 = 12 V
  • 1 = 24 V
  • 2 = 0 V (sensor has its power supply)
<method>
  • 0 = Enforce to use {SensorWarningTime}
  • 1 = Use the {SensorWarningTime} or existing device setting, whichever is greater.

Example
Periodic power-off mode with 5-second sensor power on:

ATC+IO_PSM={ProbeID}:9:1:5000:0:1

 

2. ATC+IO_CFG

Defines the interface parameters.

ATC+IO_CFG={PRB_ID}:<if>:<value1>:...:<valueN>
{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.
<if>

Interface ID:

  • 0 = RS485
  • 1 = RS232
  • 2 = SDI12
  • 3 = DI
  • 4 = DO
  • 5 = AIC (current)
  • 6 = AIV (voltage)
  • 7 = PT100
<value1>:...:<valueN> Depends on the interface type

 

For RS485, RS232, and SDI12, the value fields are:

ATC+IO_CFG={PRB_ID}:<if>:<baudrate>:<databit>:<stopbit>:<parity>
<baudrate>
Supported values include 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200.
<databit>
The number of data bits supported is 7 and 8.
<stopbit>
The number of stop bits supported is 1, 1.5, and 2.
<parity>

Parity:

  • 0 = None
  • 1 = Even
  • 2 = Odd

Example
RS485 connection with 4800 baud, 8 data bits, 1 stop bit, and no parity:

ATC+IO_CFG={PRB_ID}:RS485:4800:8:1:0

 

3. ATC+SNSR_CONF

Sensor rules for sending data packets

ATC+SNSR_CONF={PRB_ID}:<snsr_rule>:{SNSR_INTV}:<method>
{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.
<snsr_rule>
The sensor template only supports 8 for the periodic time.
{SNSR_INTV}
Default identifier assigned by WisToolBox. Keep {SNSR_INTV} unchanged.
<method>
  • 0 = Change setting if existing
  • 1 = Force change setting
  • 2 = Change the setting if it does not exist

Example
Periodic sending of data every 5 minutes:

ATC+SNSR_CONF={PRB_ID}:8:{SNSR_INTV}:1

 

4. ATC+IO_ADDPOLL

Definition of an RS485/Modbus register read command

ATC+IO_ADDPOLL={PRB_ID}:<if>:{TASK_ID2}:{DEV_ADDR}<reg_type><reg_addr><data_len>:<period>:{timeout>:{retry>:{data_type>:{scale>:{snsr_type>:{PROFILE_NAME}

 

{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.
<if>
Interface type: Options include RS485, RS232, and SDI-12.
{TASK_IDn}
Task Identifier: Must start with {TASK_ID1}, followed by {TASK_ID2}, {TASK_ID3}, and so on.
{DEV_ADDR} Default identifier assigned by WisToolBox. Keep {DEV_ADDR} unchanged.
<reg_type> Specifies the register type. Use 03 for a Holding Register.
<reg_addr>
Modbus register address: 4-byte hex value.
<data_len> Data length in hexadecimal (4 bytes). Common value: 0001.
<period> Register poll intervals in seconds, with a minimum of 60 seconds.
<timeout> Time to wait for a sensor response, in milliseconds.
<retry> Number of attempts to read the value.
<data_type> The data type of the register, where 6 represents a 16-bit signed integer.
<scale> Divider/Multiplier for scaling sensor data.
<snsr_type> Specifies the sensor type and its unit of measurement. Refer to the table of sensor types.
{PROFILE_NAME} Default identifier assigned by WisToolBox. Keep {PROFILE_NAME} unchanged.

Example
RS485/Modbus register read from device 0x01. It uses a holding register (03) with the following parameters:

  • Register Address: 0
  • Data Length: 1
  • Poll Interval: 60 seconds
  • Max Wait Time: 1000ms
  • Max retries: 2
  • Data Type: 16-bit unsigned integer
  • Scale: 0.1
  • Sensor Type: Moisture

AT command syntax:

ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID1}:{DEV_ADDR}0300000001:60:1000:2:6:0.1:188:{PROFILE_NAME}

Parameter Details:

  • {DEV_ADDR}: The RS485/Modbus address of the device. This is a 2-byte hexadecimal value, assigned when the sensor profile is imported.
  • <reg_type>: Indicates the type of action to be performed on the Modbus. It occupies 2 bytes.
reg_type ACTION
01 Read coils or digital outputs
02 Read digital inputs
03 Read registers or analog outputs
04 Read analog inputs
05 Write a single coil or output
06 Write a single register
15 Write multiple coils or outputs
16 Write multiple registers
  • <reg_addr>: The start address of the end device to read or write to. It occupies 4 bytes in hexadecimal value format.
  • <data_len>: The number of registers or coils to read or write to. It occupies 4 bytes in hexadecimal format.
ℹ️
INFO

{DEV_ADDR}, <reg_type>, <reg_addr> and <data_len> form the ModBus command for data polling. They are written together without a separating colon between them.

 

Sensor Types

SENSOR VALUE TYPE SENSOR VALUE TYPE

Air Quality Index

105 Analog Input 2

BOD (Biochemical Oxygen Demand)

26 Battery Level (Voltage) 186
CO2 concentration

 

125 Battery Capacity 184
COD (Chemical Oxygen Demand) 22 DC Current (Battery Charging) 185
Digital Input 0 Digital Output 1
EC (Electrical Conductivity) uS/cm 192 Humidity 104
Moisture 188 Illuminance 101
NO3 24 NH4+ 25
Noise 233 Nitrogen 16
PM10 227 PM2.5 228
Percentage 120 Orientation 229
Potassium 18 Phosphorus 17
Presence 102 Precipitation 119
Salinity 19 Pressure 115
Temperature 103 Strikes 145
VOC 138 Turbidity 23
Wind Direction 159 DC Voltage 154
Wind Speed 158 Pressure 130

 

5. ATC+IO_DECODE

Definition for DI, DO, and analog interface

ATC+IO_DECODE={PRB_ID}:<ifname>:<Channel>:<value1>:...:<valueN>
{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.
<ifname>
Interface name (e.g., ai, di, or do).
<Channel>

Channel number

  • for ai = 1
  • for di = 1
  • for do = 1 or 2
<value1>:...:<valueN> Depends on the interface type

 

Values for the analog interface:

<ipso>
Type of sensor as the IPSO code
<max>
Min input value
{PROFILE_NAME}
Default identifier assigned by WisToolBox. Keep {PROFILE_NAME} unchanged.
<method>
  • 0 = Change setting if existing
  • 1 = Force change setting
  • 2 = Change the setting if it does not exist

Example
Analog interface on channel 1, sensor type 130, max value 5, min value 0:

ATC+IO_DECODE={PRB_ID}:ai:1:130:5:0:{PROFILE_NAME}:1

 

Values for digital input:

<ipso>
Type of sensor as the IPSO code
<trigger_mode>

When to trigger

  • 0 = no trigger (read-only value in intervals)

  • 1 = Rising edge trigger

  • 2 = Falling edge trigger

  • 3 = Rising and falling edge trigger

<debounce>
Debounce time
{PROFILE_NAME}

Default identifier assigned by WisToolBox. Keep {PROFILE_NAME} unchanged.

<method>

0 = Change setting if existing

1 = Force change setting

2 = Change the setting if it does not exist

 

Values for digital input:

<ipso>
Type of sensor as the IPSO code
<reserved>
Reserved field, use 0
{PROFILE_NAME}
Default identifier assigned by WisToolBox. Keep {PROFILE_NAME} unchanged.
<method>
  • 0 = Change setting if existing
  • 1 = Force change setting
  • 2 = Change the setting if it does not exist

 

6. ATC+PRB_DEL

Force removal of the Probe IO after setup. Probe IO will automatically reconnect with the new interface settings.

ATC+PRB_DEL={PRB_ID}
{PRB_ID}
Default identifier assigned by WisToolBox. Keep {PRB_ID} unchanged.

 

Importing a Sensor Profile File

Additional Requirement:

A text editor or viewer on the mobile phone that supports JSON files.

Preparation

1. Write a sensor profile and save it as a .json file. For example, the VEMSEE sensor content may look like this:

{
  "SensorName": "VEMSEE",
  "TemplateVersion": "1",
  "ProbeioVersion": "1.2.9",
  "Interface": "RS485",
  "Content": [
    "atc+io_psm={PRB_ID}:9:1:6000:0:1",
    "ATC+IO_CFG={PRB_ID}:RS485:4800:8:1:0",
    "ATC+SNSR_CONF={PRB_ID}:8:{SNSR_INTV}:2",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID1}:{DEV_ADDR}0300000001:60:1000:2:6:0.1:188:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID2}:{DEV_ADDR}0300010001:60:1000:2:6:0.1:103:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID3}:{DEV_ADDR}0300020001:60:1000:2:6:1:127:{PROFILE_NAME}",
    "ATC+IO_ADDPOLL={PRB_ID}:RS485:{TASK_ID4}:{DEV_ADDR}0300030001:60:1000:2:6:0.1:194:{PROFILE_NAME}",
    "atc+prb_del={PRB_ID}"
    ]
}

2. Save this file as VEMSEE.json and transfer it to your mobile phone. Alternatively, the file can be sent to the phone via email or a messaging app.

Import the Sensor Profile

1. Connect WisToolBox to the Sensor Hub and navigate to the Sensor Probe tab.

2. Open the Generic Probe IO section, scroll down to locate the IMPORT SETTINGS option, and click it.

WisToolBox-Profile-Setup-1.png

Figure 16: Import the sensor file

3. A new window will appear, prompting a QR code scan or to open the RAKwireless URL.

WisToolBox-Profile-Setup-2.png

Figure 17: Scan QR code

4. Keep the WisToolBox app page open in the background and switch to the text editor or viewer on your mobile phone.

5. Open the VEMSEE.json file and copy the entire text content.

WisToolBox-Profile-Setup-3.png

Figure 18: Open the VEMSEE.json file

 

WisToolBox-Profile-Setup-4.png

Figure 19: Copy VEMSEE.json code

💡
QUICK TIP

Instead of storing the sensor profile as a file on the mobile device, you can copy it directly from an email or chat application. Open the message and copy the sensor profile without using a text editor or opening a file.

 

6. Return to the WisToolBox window. When the pop-up appears, enter the RS485/Modbus device address 01, then click APPLY to proceed.

WisToolBox-Profile-Setup-5.png

Figure 20: RS485/Modbus device address

WisToolBox will return to the main screen and show the import progress.

WisToolBox-Profile-Setup-6.png

Figure 21: Applying commands in progress

After the Sensor Profile Import

Once the import is finished, the Probe IO will disconnect and reconnect automatically. After the reconnection, the new setup of the Probe IO with the soil sensor will be visible.

WisToolBox-Profile-Setup-7.png

Figure 22: Probe IO new setup

On the first refresh, the sensor values might still be showing 0. Use the FETCH DATA button to manually trigger a sensor read.

ℹ️
INFO

The FETCH DATA function only reads and displays the sensor data in the app. It does not transmit the values over LoRa or cellular networks.

 

The third-party RS485 sensor connected to the Probe IO and Sensor Hub is now ready to transmit data.


bernd-giesecke.png

Bernd Giesecke

Bernd is an Electronics Engineer and Product Manager at RAKwireless with 23 years of experience in industrial and automotive hardware and software R&D. He has been supporting the Arduino open-source community since 2014.

 


Changelog

  • Version 1 - How to Connect a Third-Party RS485 Sensor to RAK Sensor Hub
    • Author: Bernd Gieseck
    • Reviewer: Karla Jimenez
    • Date Published: 05/19/2025

 


 

 

 

 

 

Updated