Skip to content
Contact

DALI · How-to guides

Add a Modbus sensor

Poll a Modbus TCP, RS232 or RS485 device and log its readings as parameters.

Goal: the station polls your Modbus device and logs its readings as named parameters.

Two pages are involved: Modbus, where you add a query (what to read), and Parameters, where you turn the registers it reads into named values.

Before you start

  • You need the Admin role.
  • From the device's manual: its Slave ID, which registers hold the values you want, whether they are holding (function 3) or input (function 4) registers, and each value's data type and byte order.
  • For a serial device: its baud rate, parity and stop bits. For a TCP device: its IP address or host name and port.
  • The device wired to the right port, or reachable on the network.

Steps

  1. 1

    Open the bus's tab. Go to Modbus and open the master tab for the connection: TCP Master, RS232 Master, RS485 Master or RS485-2 Master.

  2. 2

    Add a query. Click + Add Query and fill in:

    • Slave ID (1 to 255), Function Code (3 or 4), Start Address and Quantity (1 to 50 registers).
    • TCP: Slave IP / Domain and Port (usually 502).
    • Serial: Baud Rate, Parity and Stop Bits, matching the device.
    • RS485 Master: TX Mode. Use Sensor (hold) for third-party sensors.
    • Active: Yes.

    Click Save Query.

  3. 3

    Turn the bus on. Switch Enable on at the top of the tab. It saves as soon as you flip it. Leave Poll Delay (s) as it is unless you need slower polling.

  4. 4

    Create the parameters. Go to Parameters and click + Add Parameter. Set Type to the same bus, for example RS485 (Modbus). Pick the Slave ID, Function Code and Address from the lists (they only offer what your queries read), then the Data Type and Byte Order. Give it a Name and Unit and click Save Parameter. Repeat for each value. See Create a parameter.

Check it worked

  • On the Dashboard, the bus shows a tick under Communication Protocols, and the new parameters show live values in Live Parameters.
  • On Data output, Raw Data, the new columns fill with readings.

If something goes wrong

What you seeWhat to do
The parameter shows a dash or goes IdleThe device is not answering. Check wiring, Slave ID, baud rate and parity, or IP and port.
Values are wildly wrongThe Data Type or Byte Order does not match the device. Try the other byte orders.
Query already existsAnother query on this bus reads exactly the same registers.
Maximum 50 queries reached.The bus is full. Delete a query or use another bus.
The address list on Parameters is emptyNo query on that bus reads that device yet. Add one first.

RS232 takes over the service console

Turning on RS232 Master or RS232 Slave switches off the service console on that port.

Many queries at once? See Import Modbus queries from CSV.