In our previous 2Smart blog posts, we’ve covered how to connect Modbus devices to the monitoring and automation platform, 2Smart Standalone, using a Teltonika gateway. This setup allows for controlling and managing sensor readings through automation scenarios. We also demonstrated how to configure an OpenVPN connection for cloud deployment of the automation platform, as well as how to integrate it with the 2Smart Cloud mobile application. This solution allows for remote management of Modbus equipment and monitoring of its sensor readings from anywhere with internet access. But what about monitoring the telemetry of the Teltonika gateway itself? This is crucial since it includes precise GPS coordinates of the gateway and statistics of the GSM traffic used. Such information is vital, for example, in cargo transportation scenarios, where the Modbus gateway allows monitoring of cargo transport conditions and tracking its location. In this article, the 2Smart team explains how to set up remote monitoring of Teltonika gateway telemetry within the interface of the 2Smart Standalone automation platform.
In our experiments, we are using the Teltonika TRB-245 gateway, and the set of metrics may vary depending on the device model. However, according to feedback from other users of the same model gateway who use it in the real world, the most valuable metrics for them are those that describe the statistics and status of the GSM module, as well as GPS coordinates.
The Teltonika TRB-245 gateway can provide the following telemetry related to GSM connection:
This telemetry is invaluable in cases where mobile internet is the primary means of connecting the Teltonika gateway to the world or when GSM is used in deploying local IoT infrastructure. Administrators can remotely monitor connection quality and traffic consumption. By setting up corresponding alerts, they can instantly be notified of critical drops in signal strength or traffic overages.
The following metrics allow you to monitor both the precise geographical location of the device and the quality of the GPS connection:
These metrics are less critical when the gateway operates at a stationary location. However, they become indispensable in scenarios such as monitoring the vehicle’s location during transportation.
We’re empower your business with our technology expertise
Previously, we experimented with various methods of connecting the Teltonika gateway to the 2Smart automation platform. Thanks to the gateway’s software features, there can indeed be several methods. However, the primary approach is to use the platform’s native Modbus bridge, where the interaction between the gateway and the platform occurs according to the standards of this protocol. This method was used in the experiment described below.
The Teltonika TRB-245 gateway can provide pre-configured sets of telemetry data, such as basic device information (firmware version, local time), MNF info, as well as technical information about the built-in GSM module, which is not related to traffic usage statistics (operator name, IMEI, CON state, IP, RSSI, etc.).
In addition, the gateway’s software includes functionality for monitoring via Modbus, where the device responds to Modbus queries and transmits various detailed metrics. The manufacturer provides a table of these metrics in the documentation via the link, and the administrator can select the required ones. This is how you can receive telemetry for GPS and GSM traffic.
Since the greatest interest lies in the metrics whose set needs to be configured manually, let’s start with that.
Let’s take a closer look at how to use the table to configure requests. First, let’s consider a parameter like GPS coordinates, latitude, and longitude. According to the table, the Register Address for latitude is 143 (145 for longitude), and the Register Number is 144 (146). For both latitude and longitude, the Number Of Registers is 2, and the Representation is a 32-bit float.
Since the data type is the same in both cases (32-bit float), and the values are consecutive in the register, we can retrieve them with a single request to later display them in a single line. Therefore, in the gateway’s web admin panel, we do the following:
We added all other requests for which we want to see the results as telemetry from the Teltonika gateway for remote monitoring using the same principle. The key here is to carefully follow the table in the Teltonika documentation and specify the correct data type. For example, if it’s textual data, then in the Data Type dropdown menu, you should select ASCII.
We recommend fetching multiple data with a single request whenever possible, just as we described earlier when GPS latitude and longitude are retrieved with a single combined request. For instance, we similarly retrieved 12 fields of traffic usage statistics on SIM2. This is faster and more convenient at this stage. Later, we’ll show how we handled the results of such requests and separated them from each other to display them correctly on the automation platform dashboard.
After configuring the desired requests, we saved the changes and proceeded to set up the data collection to be transmitted to the automation platform for remote monitoring.
We’re empower your business with our technology expertise
To configure the transmission of necessary telemetry to the 2Smart Standalone monitoring and automation platform, we need to set up a data collection in the “Data to Server” section of the built-in web admin panel of the gateway:
After making all the settings, we connected to the deployed 2Smart Standalone automation platform using the MQTT Explorer application to see what data the Teltonika gateway began transmitting and in what format.
We observed data from all inputs connected to the collection: separately from MNF, separately from Base, separately from GSM, and separately from Modbus.
To showcase Teltonika gateway telemetry on the automation platform dashboard, we utilized the MQTT Adapter bridge from the platform’s Market. We named this configuration “TRB245 gateway data.” After configuring all parameters, we obtained a sizable JSON file outlining the rules for the platform to retrieve the necessary data and display telemetry on the device card on the dashboard.
For self-configuration of the bridge, refer to its description in the 2Smart Standalone documentation. If you encounter any difficulties, feel free to contact us via the 2Smart Cloud Discussion Telegram chat. Here, we’ll focus on interpreting the metrics configured manually according to the Teltonika documentation table.
Analyzing the data received from the Teltonika gateway using MQTT Explorer and its format, we observed the following:
To interpret this data in the MQTT Adapter bridge configuration, we created a parser that searches for the desired parameter using a special function. If the parameter is found, the parser retrieves an array of data from the respective row. Then, it extracts the required value from this array.
Following Teltonika’s documentation, which indicates that the first (0) value in GPS coordinates is latitude, we retrieved it for the sensor with id=”lat”. The second (1) value, longitude, is retrieved for the sensor with id=”lng”. Using the same logic, we parsed all data from all objects to display them on the automation platform dashboard.
As a result, we obtained a device in the 2Smart Standalone automation platform, which card displays all the telemetry we configured earlier: basic information, MNF info, standard GPS metrics, and the collection of Modbus data we configured manually.
Thus, leveraging Teltonika gateway capabilities, we can retrieve crucial metrics in addition to Modbus device telemetry. This includes geographical coordinates and other GPS data, as well as GSM connection usage statistics.
The 2Smart Standalone automation platform stores historical values of all sensors connected to it in a database, which is one of its core features. This means you can use services like Grafana to analyze this value history, set alerts for values exceeding a set threshold, or create custom automations based on this data.
If you want to learn more about the capabilities of the 2Smart Standalone monitoring and automation platform, request its demonstration with our experts: contact@2smart.com.
Share with us your business idea and expectations about the software or additional services.