Suchen Sie etwas anderes?
Scenario details:
- 2 analog sensors need to be monitored, one of the 0-10V type and the other of the 4-20mA type
- The monitoring of the analog sensors will be carried out using MQTT, that is, the modem must send the data from both sensors to an MQTT broker
- In order to save bandwidth, there is no need to continuously send data from the sensors to the MQTT broker. Only the changes will be sent, that is, when the 0-10V input varies by 0.1V or the 4-20mA input varies 0.15mA, these values must be sent quickly to an MQTT platform (such as Cervello))
Solution: MTX-Tunnel firmware + MTX-IOT-S [4-N]
Configuration example (config.txt file) for the indicated scenario:
Configuration | Observations |
GPRS_apn: movistar.es GPRS_login: MOVISTAR GPRS_password: MOVISTAR GPRS_timeout: 0 MTX_pin: 0000 MTX_model: 199802407 MTX_mode: none MTX_ping: 30 MTX_pingIP: 8.8.8.8 MTX_TPProtocol: ntp MTX_numGSMErrors: 180 MTX_TPServer: ntp.roa.es MTX_TPServer2: es.pool.ntp.org MTX_TPFormat: unix SMS_allPhones: on SMS_sendIP: on SMS_ATEnabled: on SMS_ATResponse: on MQTT_enabled: on MQTT_server: tcp://broker.mqttdashboard.com:1883 MQTT_id: [IMEI] MQTT_login: MQTT_password: MQTT_attopic1: [IMEI]/AT MQTT_atrtopic: [IMEI]/ATR MQTT_qos: 1 MQTT_keepalive: 60 MQTT_defaultIOQos: 0 MQTT_defaultIOTopic: IOCHANGE ADC_mode0: voltage ADC_config0: mqtt;100;0 ADC_mode1: current ADC_config1: mqtt;150;0 |
GPRS APN provided by GSM operator GPRS Login GPRS Password Modem is permanently connected to GPRS PIN if it has one Device model Gateways used Every 30 minutes PING check Google IP (f.e.) to ping Time synchronization protocol Reset if no registry in GSM network in 1800 secs. Time server Time server backup Unix time format IP by SMS authorized IP by SMS authorized AT by SMS allowed SMS AT responses activated MQTT service MQTT broker. Protocol format://url:port Device ID in broker Username Password Topic of the MTX to receive AT commands Topic where MTX sends its answers to AT commands QoS established Keepalive Qos for defaultIOTopic MQTT topic to send quick telemetries ADC0 as votage input ADC0 MQTT configuration ADC1 as current input ADC1 MQTT configuration |
Details:
-
Setting the ADC0 input as “mqtt; 100; 0” indicates the following. Remember that all parameters are separated by semicolons ;
“mqtt” > The input is configured to send the analog input quickly by MQTT
“100” > Hysteresis in mV. Indicates how many mV the input must change to send the data to the MQTT broker. This avoids continuously sending data to the broker and excessive and unnecessary consumption of traffic
“0” > Indicates the timeout of the analog input. This means that the change of the analog input will be sent to the MQTT broker quickly. If, for example, a value of “60” were configured, even if there are multiple changes in the analog input, more than 1 MQTT message will never be sent in those 60 seconds -
The sending format of these messages follows the JSON structure, shown in the following example:
{
“IMEI”:”354033091487838”,
“TYPE”:”ADC”,
“TS”:” 2020-02-08T19:15:12Z”
“ID”:0,
“VALUE”:7750
“MODE”:”voltage”
}Where:
– IMEI: indicates the IMEI of the MTX modem
– TYPE: indicates the type of frame. ADC = analog input
– TS: Timestamp (unix format specified in MTX_TPFormat)
– ID: indicates the ADC index (0 = ADC0.1 = ADC1)
– VALUE: indicates the value of the input (in mV or mA)
– MODE: indicates the working mode of the input (“voltage” / “current”) -
The data of the digital inputs configured as “mqtt” are sent to the topic configured in the parameter “MQTT_defaultIOTopic”