Titan – Example Scenario 2.13: Autonomous reading of Modbus registers and automatic sending to two web platforms. HTTP GET will be used to send the registers to one platform, and to the other we will send the data via FTP

Details of the example scenario:

  • We need to read several Modbus registers of 5 Modbus RTU devices. The data should be read every 10 minutes
  • The router must send the readings to two web platforms. On the one hand, we will send the readings in real time (in JSON format) via HTTP GET to Platform 1. On the other hand, the router will send a file once a day with the readings to Platform 2 via FTP. The file will have a name of the format “IMEI-year-month-day.txt”
  • Registers: @1: registers 1-10, @2: register 20 and 30, @3: registers 21-25, @4: registers 100- 105 and @5:registers 1-5 and 20-25. All will use the Modbus read command 0x03
  • We also need to remotely access each of the Modbus devices, and change registers remotely via a Telnet console and webserver

Configuration example ready for use:

We can easily load the example from the router’s web configuration environment from the menu “Other>Backup/Examples”.

Details:

  1. After loading the configuration on our router, we can access the router’s configuration with the default username and password: “admin” and “admin” and the IP address “192.168.1.2”
  2. Check the configuration in the menus “Wan>Basic Settings”, “Serial Settings > Serial Port 1”, “External devices > Logger Configuration”, “External Devices>Modbus RTU
  3. Remember that readings are not taken immediately upon start-up, but at xx:00, xx:10, xx:20, xx:30, xx:40, etc. (i.e. every 10 minutes)

Details (2):

  1. To test this example, we can use a simple Slave Modbus simulator. For example, the following figure shows the creation of this example’s 5 devices, with addresses 1 to 5 and the corresponding registers.

The responses read and collected by the Titan device and then sent to a Web platform (in this example, the test platform www.metering.es) will have the following format, as shown in the “External Modbus RTU” section of this manual.

Regarding the FTP – having selected one file per day, a file with the name:

358173051092180-2015-02-15.txt (IMEI-year-month-day.txt)

will be created in the remote FTP server, and the following content shown below (the previous JSON registers, grouped together in an easy-to-mange.txt file).

Details (3):

For firmware versions up to 1.07, Titan routers can read data types UNSIGNED WORD (2 bytes). For versions 1.08 or later, they can also read data types DOUBLE WORD (4 bytes), FLOAT (4 bytes), COIL (1 bit) and INPUTS (1 bit).

For example, we can configure the emulator with five Modbus slaves, each of which with a different data types.

If we wish to read registers 1, 2 and 3 from device @1 (SlaveWORD), registers 2, 4 and 6 from device @2 (SlaveDWORD), and registers 2, 4 and 6 from device @3 (SlaveFLOAT), as well as 10 bits, starting from bit 1, from device @5 (SlaveCOIL) and 7 bits, starting from bit 2, from device @6 (INPUTS), the configuration would be as follows: