Titan – AN14: Silo Level Reading and Sending with Router Titan and Maxbotix Distance Sensor

¿Buscas alguna otra cosa?

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 store and send data from a Maxbotix RS232 series distance sensor 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 via HTTP / HTTPS and FTP data from a Maxbotix RS232 distance sensor.

Configuration of the Associated Serial Port

The first thing to decide is which of the 4 serial ports of the Titan router is going to connect the Maxbotix distance sensor. It should be remembered that Serial Port1 can be configured as RS232 or RS485, Serial Port2 and Serial Port 3 only as RS232 and Serial Port 5 only as USB (for FDTI devices).

Let’s assume that the Maxbotix distance sensor is going to be connected to the serial port COM2 (RS232) of the Titan router. The Maxbotix serial port configuration is 9600.8, n, 1 so we will have to click on the “Serial Settings > Serial Port2-232” menu and configure the screen as follows:

Setting the Maxbotix RS232 Distance Sensor

The next step is to configure the Maxbotix RS232 distance sensor, that is, we have to indicate the serial port that will be used for the Titan (previously commented on COM2), every time we want to log the distance read (ie every few minutes we want to make / send a distance measurement).

For our example we will connect the sensor to the serial port RS232 number 2. We will read every 30 minutes and store the data in the internal logger, so that we can send the measurements to a remote server. Also, we want to configure an additional SMS alarm to send us a message when the read distance by the sensor exceeds 5 meters.

To do this we click on the link: “External Devices > “Distance Sensor” and configure the screen as shown below:

The last step is to configure the Logger, that is, the storage and data sending system, made by the own Router Titan. In this example, with illustrative pretension, we will send the data to an HTTPS server (via a JSON object) and to an FTP server. Both things at once.

In this case we will configure an ftp server with IP (or DNS) ftp.myserver.com and we want to leave the data in the “/ data / silo1 /” folder. The username of the FTP server will be “silo1” and the password “12345678”. Finally we have to specify every time we want to upload a file with the data collected via FTP. We can specify every minute, every hour or every day. We will select each hour.

Regarding the HTTPS server, we will send the data to the server https://www.mydomain.com/set.asp?data=, where we will receive in the variable “data” the JSON with the data of each reading (timestamp, computer ID, …)

As seen in the previous figure, we will access through the menu “External Devices > Logger Configuration” and configure that section as shown.

The client configuration is simple. The router configured with a LAN IP 192.168.2.2 and with 3G or 4G connectivity is assumed. To configure the VPN, simply go to the “VPN> OpenVPN Client” menu.

Several considerations

  • After the configuration of the Titan router it is necessary to perform a reset to take the new configuration and begin the readings and shipments.
  • Each time the Titan router sends a measure to an HTTP / HTTPS server, it does so using a JSON object of the following type:
{"TYPE":"DIST","TS":"20/09/2015 17:19:44","IMEI":"358709050113764","P":"silo1","DIS":"1000", ”ALDH”:”0”,”ALDL”:”0”}

Where:
TYPE indicates the data type (DIST = distance)
TS indicates that Timestamp (ie the time of reading the measurement)
IMEI indicates a unique identifier for the modem
P, in case of HTTP it would indicate the configured ID field
DIS indicates distance read in millimeters
ALDH indicates if there is a maximum distance alarm exceeded (0/1)
ALDL indicates if there is a minimum distance alarm exceeded (0/1)

  • Files sent to the FTP server will have a filename similar to:
58709050113764-2015-09-20-13-44.txt

Where:
358709050113764 IMEI of the Titan router, unique for each router
2015-09-20-13-44 date of creation of the file
Within each file we can find a series of records in JSON format, identical to the one described
on this page…