Suchen Sie etwas anderes?
Table of Contents
Scene Details
The Titan Routers have all the typical features of a 2G / 3G / 4G router but also have a number of additional features that make it one of the most profitable routers on the market.
One of the additional features is the ability to interrogate autonomously Modbus RTU or TCP devices, with the subsequent sending of the data to a WEB or FTP server.
As always, this will be illustrated with a simple example.
Description of the Example
In this example you will configure a Titan router to collect, store and send by Modbus registers of a temperature and humidity sensor. These readings will be performed every 10 minutes. In addition, it must be possible to establish a Telnet session to be able, through AT commands, to obtain the data in real time at any moment of the sensor as well as to be able to switch 2 relays.
Titan Serial Port Configuration, where Sensor will be Connected
As a temperature/humidity sensor, we are going to use a sensor with an RS485 port and communication is made through MODBUS protocol, at 9600.8, N, 1.
For this we will first configure the COM1 serial port of the TITAN router, as this port can be configured as RS232 port or RS485 port. We will configure the COM1 port as shown in the following figure.
Configuration of the Modbus Devices to be Read
The next step is to configure the Modbus devices to read. In this case it will only be the Modbus RS485 temperature/humidity sensor, that is, we have to indicate the serial port to be used of the Titan (previously commented it would be COM1), every time we want to read the registers (that is, how many minutos we want to make/send a temperature/humidity measurement).
For our example, we will connect the temperature / humidity sensor to the serial port RS232 number 1. We will take readings every 10 minutes and store the data in the internal logger so that we can send measurements to a remote server via HTTP.
To do this we click on the link: External Devices > Modbus Devices and configure the screen as shown below:
Logger Configuration (Communication with HTTP Server)
The next step is to configure the Logger, that is, the storage and data sending system, made by the own Router Titan. In this example we will configure the router to send the data to an HTTP server (HTTPS or FTP could also be used).
As HTTP server we will use the URL https://www.mydomain.com/set.asp?data=, where we will receive the data in JSON format of each readout (timestamp, computer ID …).
As shown in the following figure, we will access through the External Devices > Logger Configuration menu and configure this section as shown below:
Configuration of the Socket for AT Commands
Now we will configure the Titan Router to be able to send AT commands via socket (Telnet style). These commands can be sent via 3G / 4G, Ethernet or Wifi. By activating this option, commands can be sent to the router to be able to perform a Modbus read at any time as well as perform other configuration change operations, coverage query, relay switching, etc.
Just go to the Other> Remote Console menu and configure it as shown in the following screen:
Connecting Titan with the Temperature/Humidity Probe
The connection between the TITAN router and the temperature/humidity probe will be made using the internal terminals of the equipment. The first thing we will do is configure the DIP Switch SW2. Switch 1 to switch 1 and 2, putting COM1 in RS485 mode. On the other hand we will set the switch 4 to ON to activate the 5V output, which will be power the temperature/humidity sensor.
Once the user and password are connected and entered, we can send the commands to read the modbus devices as well as to switch the relay.
Commands Execution via Telnet
To execute commands via TELNET simply use a program similar to Putty.
Once the user and password have been connected and entered, we can send the commands to read the modbus equipment as well as to switch the relay. To know in depth the allowed AT commands, consult the TITAN router user manual.
Several Considerations
- After configuration of the Titan router it is necessary to perform a reset to take the new configuration and begin the readings and sendings.
- Each time the Titan router sends a measure to an HTTP server it does so by means of a JSON object of the following type:
{TYPE: MODB,TS:20/09/2015 17:19:44,IMEI:358709050113764,P:Device1,ST:0, ”A”:”49”,”V”:[0,237,16829,49806,0,288,16871,1018]}
Where:
TYPE indicates the data type (MODB = modbus read)
TS indicates that Timestamp (that is, the reading time of the measurement)
IMEI indicates a unique identifier for the modem,
P, in case of HTTP it would indicate the configured ID field
ST indicates the address of the first read modbus register, in this case the 0
V Array with read data. The information of each register (temperature, humidity,…) will be
found in the table of modbus registers of the datasheet of the probe.
https://www.dropbox.com/s/kgten664ekkgod6/tht-modbus-rtu.pdf?dl=0