MODBUS icon

MODBUS

Read and write to MODBUS devices

Actions2

Overview

This node enables interaction with MODBUS devices by reading from or writing to their memory registers or coils. It is useful in industrial automation, building management systems, and IoT scenarios where MODBUS protocol is used for communication with sensors, actuators, or controllers.

  • Read operation: Reads one or more holding registers starting from a specified memory address.
  • Write operation: Writes a single value either to a register or a coil at a specified memory address.

Practical examples:

  • Reading temperature or pressure sensor values stored in MODBUS registers.
  • Turning a device on or off by writing to a coil.
  • Updating configuration parameters by writing to registers.

Properties

Name Meaning
Operation Choose between "Read" (read registers) or "Write" (write to register or coil).
Memory Address The memory address (register index) to read from or write to.
Quantity Number of registers to read (only shown when Operation is "Read").
Write Target Target to write to: "Register" or "Coil" (only shown when Operation is "Write").
Value The numeric value to write to the register (only shown when Write Target is "Register").
Coil Value The coil state to write: "On" or "Off" (only shown when Write Target is "Coil").

Output

The node outputs a JSON array containing an object with a data field:

  • For Read operations, data is an array of integers representing the values read from the requested holding registers.
  • For Write operations, data contains the response from the MODBUS device confirming the write action.

No binary data output is produced by this node.

Dependencies

  • Requires connection credentials to a MODBUS device via an API key or authentication token configured in n8n.
  • Uses an internal client created by a helper function to communicate with the MODBUS device.
  • The node depends on the MODBUS protocol support on the target device.

Troubleshooting

  • MODBUS Error: ... — Indicates communication failure or invalid request parameters. Check that the memory address and quantity are valid and that the device is reachable.
  • Writing values outside allowed ranges (e.g., register values beyond -32768 to 32767) may cause errors.
  • Ensure correct selection of "Write Target" matching the device's supported memory type.
  • Network issues or incorrect credentials can prevent successful communication.

Links and References

Discussion