SETUP AND OPERATION
CHAPTER 2
Getting Started
Before setting up the MQTT gateway, ensure the following conditions are met:
- Hardware is installed as per Chapter 1's Mounting and Wiring sections.
- Necessary connection information for your MQTT broker is available.
- A device with a web browser is ready to connect to the MQTT gateway via its RJ-45 Ethernet port, either over a LAN or with a crossover cable.
Configuration is done via the web interface. Connect using an internet browser. The default Ethernet configuration is:
- IP address: 192.168.1.100
- Subnet Mask: 255.255.255.0
- Default Gateway: 192.168.1.1
- User Name: admin
- Password: password
Setup Network Connection
To modify network parameters, select "Network interfaces" from the "More Options" [menu-icon] in the upper-right corner of the web UI.
Enter the required network parameters and click SAVE, then CONFIRM the changes.
Note: The gateway uses its permanent default IP address in recovery mode.
Verify settings by reopening the "Network interfaces" screen and clicking "TEST INTERNET CONNECTION".
The "Network interfaces" screen displays fields for Hostname, MAC address, DHCP, IP Address, Subnet mask, Gateway, Preferred DNS, and Alternate DNS, with SAVE and TEST INTERNET CONNECTION buttons.
Setup Modbus Communications Channel
The gateway supports communication via RS-485 and Ethernet. Configure the RS-485 or Ethernet communications channel before setting up Modbus devices.
Click the CHANNEL tab to define Modbus communication parameters.
The CHANNELS tab shows the device name (SGW-MQ1611) and tabs for CHANNELS, DEVICES, MQTT. It indicates if no channels are configured and provides an "Add Channel" button [add-icon].
Click the [add-icon] to add a new channel or edit an existing one.
Channel configuration includes fields for Name, Communication protocol (e.g., Modbus RTU), Baud Rate, Data bits, Stop bits, Parity, Timeout (ms), Queue delay (ms), and Device delay (ms). A SAVE button is available.
Configuration steps:
- Enter a Name for the channel.
- Select the Communications protocol (Modbus RTU, Modbus TCP, or Modbus RTU over TCP).
- For Modbus RTU, set Baud Rate, Data bits, Stop bits, and Parity.
- For Modbus TCP or RTU over TCP, enter the IP address and TCP Port.
- Set the Timeout value (max time in ms for a valid response).
- Set the Queue delay (time in ms between Modbus requests).
- Set the Device delay (time in ms between querying devices).
Click SAVE upon completion.
Setup Modbus Devices
The gateway supports up to 32 Modbus RTU Slaves (RS-485) and eight Modbus TCP Servers or Modbus RTU over TCP Servers (Ethernet). After defining channels, configure device connections and variables.
Configure Modbus Device
Navigate to the DEVICES tab to define Modbus devices for querying.
The DEVICES tab displays the device name (SGW-MQ1611) and tabs for CHANNELS, DEVICES, MQTT. It indicates if no devices are configured and provides an "Add Device" button [add-icon].
Click the [add-icon] to add a new device or edit an existing one.
Device configuration requires:
- A Name for the device.
- Selection of an existing Channel.
- The device Address (Unit ID).
- Checking "Block sampling" to combine contiguous variables into a single query.
Configure Modbus Variables
Add variables to be read from or written to a Modbus device by clicking the [add-icon].
The "Set variable" dialog allows configuration of Read-only status, Format, Variable name, Address, Function Code, Conversion parameters (Measured value 1/2, Engineering value 1/2), Validity, Operator, and Value. It includes an OK button and a close icon [close-icon].
- Uncheck "Read-only" to enable writing to the variable.
- Select the variable Format. Check "Unsigned" if applicable. Available formats include:
Category | Format |
---|---|
Digital | 1 bit |
Integer | 16 bit (INT) signed or unsigned 32 bit (INT) Big endian signed or unsigned 32 bit (INT) Little endian signed or unsigned |
Floating Point | 32 bit (FP) Big endian 32 bit (FP) Little endian |
Variable configuration details:
- Enter a Variable name.
- Enter the Modbus Address.
- Select the Modbus Function Code for reading and writing.
Valid function codes per variable type:
Variable Type | Read Function Codes | Write Function Codes |
---|---|---|
1 bit | 01 - Read Coil Status 02 - Read Input Status | 05 - Force Single Coil 15 - Force Multiple Coils |
16 bit (INT) | 03 - Read Holding Registers | 06 - Preset Single Register 16 - Preset Multiple Registers |
32 bit (INT) Big endian | 03 - Read Holding Registers | 16 - Preset Multiple Registers |
32 bit (INT) Little endian | 03 - Read Holding Registers | 16 - Preset Multiple Registers |
32 bit (FP) Big endian | 04 - Read Input Registers | 16 - Preset Multiple Registers |
32 bit (FP) Little endian | 04 - Read Input Registers | 16 - Preset Multiple Registers |
- For linear scaling, define Measured value 1 and 2, and corresponding Engineering value 1 and 2.
- If "Validity" is checked, set an additional Address and Value to check data validity.
Configure MQTT Topics
Enable checkboxes for variables to be sent or controlled via MQTT, and configure MQTT message parameters.
Note: MQTT Gateway topic naming is flexible; your broker might require specific structures.
For publishing to an MQTT broker:
- Enter an MQTT Topic (PUB). The [reset-icon] resets the topic to the default format like <DEVICE_NAME>/get/<VARIABLE_NAME>.
- Choose publication triggers: "On value change" or "At a fixed frequency". Specify a Threshold for value change or an interval (Every (s)) for fixed frequency.
- Set the Quality of Service (QoS) level.
QoS | Description |
---|---|
0 | Does not include confirmation of receipt |
1 | Guarantees delivery at least once. |
2 | Guarantees delivery exactly once. |
- Checking "Retain" keeps the last published message for new subscribers.
- For writing from a subscribed MQTT topic:
- Enter an MQTT Topic (SUB). The [reset-icon] resets the topic to the default format like <DEVICE_NAME>/set/<VARIABLE_NAME>.
- Set the Quality of Service (QoS) level.
- Click SAVE after configuring all variables and topics.
A green LED indicates successful communication; red indicates an error. The [log-icon] icon opens a real-time communication log.
Configure MQTT Broker
Verify your MQTT broker's required settings before configuring the gateway.
Click the MQTT tab to establish the connection.
Configure Broker Address, Broker Port, ClientId, Keep Alive frequency, and optionally Clean session, Username, and Password.
Enable TLS/SSL by uploading a certificate, private key, or CA certificate if needed.
Payload structure customization allows defining message content for valid and invalid values. Select desired information (e.g., Sampled value, Validity, Device name, Timestamps, Communication status) via checkboxes. Each field can be edited using the [edit-icon]. The [reset-icon] reverts values to defaults. A PREVIEW option shows sample messages.
Custom values can be set for invalid sampled values or communication problems.
Message queueing batches transmissions, useful for managing message frequency and complying with IoT service limits. Configure minimum delay, maximum queue length, and message expiration.
Diagnostic messages can be enabled to publish status information on channels, devices, and the MQTT connection.
Click SAVE to finalize MQTT connection settings.
A green LED next to the Broker Port indicates successful connection; red indicates an error. The [log-icon] icon provides access to communication logs.
Other Options
Additional settings are accessible via the "More Options" [menu-icon] icon. Network interface settings were detailed previously.
Date & Time
Set the date and time manually or enable NTP to use an internet time server.
The Date & time interface includes fields for System date, Time zone, Enable NTP, Date, and Time.
Import/Export Configuration
Export the entire configuration (channels, devices, MQTT) as a JSON file or import a configuration to another gateway. A backup prompt appears before importing to prevent data loss.
Change Password
Change the gateway's web UI login password. The username cannot be edited.
Password requirements: minimum 8 characters, including letters, numbers, and specific symbols (_ - ! # $ % ^ &). The new password must differ from the old and default passwords.
Fields include Old password, New password, and Confirm password, with a SAVE button.
Logout
The web UI session times out after inactivity. For immediate logout, select Logout from the "More Options" [menu-icon] menu.
Maintenance
The Maintenance dialog allows firmware updates, system log downloads, and device restarts.
Options include Firmware upgrade, System log, and Restart.
System Log
Download log files (tar.gz archives) to your PC. An unarchive utility like WinZip or 7-Zip is required.
Restart
Click Restart and then Confirm to reboot the gateway.
Firmware
New firmware is announced on the website https://support.automationdirect.com/firmware. Subscribe to firmware notifications at https://notify.automationdirect.com/firmware.
To update firmware: download the file, unzip it, then navigate to More Options [menu-icon] > Maintenance > Firmware upgrade.
Click BROWSE, select the .swu firmware file, and click Open.
The file uploads and verifies. Warnings state: "DO NOT POWER OFF THE DEVICE!" and "Interrupt this operation might corrupt your device!". Recovery Mode is mentioned for failures.
After verification, click UPGRADE and CONFIRM.
The gateway reboots upon successful update. If the update fails, restart in Recovery Mode and try again.
Recovery Mode
Boot into Recovery Mode to reset configurations or perform maintenance and firmware updates.
To enter: press and hold the recessed reset button while cycling power until the ERR light stops blinking (approx. 5 seconds). The gateway starts with default Ethernet configuration (IP address: 192.168.1.100).
Reset
The Reset tab allows selective resetting of Hostname, Network interface, Date & time, Login credentials, or Configuration to default settings.
Options include Reset all, Hostname, Network interface, Date & time, Login credentials (username: admin, password: password), and Configuration. A RESET button is available.
Maintenance (in Recovery Mode)
In Recovery Mode, the Maintenance tab allows checking file system errors, downloading logs, and cleaning temporary files. Log files are tar.gz archives requiring unarchiving software.
Firmware Upgrade (in Recovery Mode)
Firmware upgrades in Recovery Mode follow the same steps as in normal mode. This method is useful if a normal mode upgrade fails.
Reboot and Return to Normal Mode
To reboot and return to normal mode, click the "More Options" [menu-icon] icon and select Reboot. The device will use its configured network settings upon reboot.