Tunnel – Periodic monitoring via 4G/3G/2G of a 4-20mA sensor with ultralow consumption modem. Activating sensor supply via relay. Sending to broker MQTT

¿Buscas alguna otra cosa?

Scenario details:

  • We want to monitor a 4-20mA sensor with a 4G/3G/2G modem
  • The modem will be powered by batteries, so it must remain in ultra-low consumption mode (~10 uAmper), waking up only to make the reading and send the data via 4G/3G/2G (depending on the modem model) to an MQTT broker
  • Every 24 hours, the modem should wake up, activate its internal relay to feed the 4-20mA sensor, wait a few seconds for the signal to stabilize and then proceed to read it. After the reading, the data will be sent to an MQTT broker. In case of not being able to send the data, it should be stored in a flash memory (not volatile) to send it as soon as possible
  • After sending the data (satisfactorily or not), the modem must disconnect the internal relay to remove the power supply fromthe 4-20mA sensor and save power, and re-enter ultra-low consumption mode for a 24h period

Solution: MTX-Tunnel firmware + MTX-Java-IoT

Config.txt configuration file:

Configuration Observations
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_pin: 0000
MTX_model: 199801458
MTX_TPProtocol: ntp
MTX_TPServer: ntp.roa.es
MTX_TPServer2: es.pool.ntp.org
MTX_mode: none
ULP_enabled: on
ULP_sleepMode: minutes
ULP_minutesOff: 1440
ULP_secondsOn: 120
ULP_relayMode: 1
MQTT_enabled: on
MQTT_server: tcp://test.mosquitto.org:1883
MQTT_id: [IMEI]
MQTT_attopic1: [IMEI]/AT1
MQTT_qos: 1
MQTT_keepalive: 300
MQTT_persistent: off
LOGGER_enabled: on
LOGGER_mode: mqtt
LOGGER_numRegistersFlash: 90
LOGGER_numRegistersRam: 0
LOGGER_mqttTopic: [IMEI]/logger
LOGGER_ioPeriod: 300
LOGGER_ioPeriodDelay: 10
GPRS APN from your network operator
GPRS Login
GPRS Password
Connected while awake
SIM without a PIN
MTX terminal modem model used
Time synchronization protocol
Time server (MTX must synch time)
Time server backup
No gateways used
Modem ULP service activated
It will wake up by date/time
It will wake up every 1440 minutes (24 hours)
It will be awaken 2 minutes
Relay will activate when modem awake
MQTT service in the modem activated
Broker IP/DNS, including port
Identifier
MTX-Tunnel subscribes to this topic for commands
Service quality
Keep alive MQTT connection (300 seconds)
We don’t need persistence
Logger activated
Sending mode MQTT
Upto 90 flash readings (3 months)
No readings stored in RAM
Sending topic to MQTT broker of the data
There’s time for just 1 reading (the first one)
10 seconds to stabilize reading 4-20mA

Details:

  • The frame sent to the server has the following JSON format:
    {“TYPE”:”IOS”,”IMEI”:357042060366409, “P”:””, “TS”:”28/04/19 18:32:53”,”IO1”:0,”IO2 ”:0,”IO3”:0,”IO4”:0, “IO5”:0,”IO6”:0,”IO7”:0,”IO8”:0,”IO9”:0,”IO10”:0,”AD1”:1420,”AD2”:0, “CO1”:”0”,”CO2”:”0”,”CO2”:”3”}
    Where:
    TYPE: IOS frame type
    IMEI: internal identifier of MTX
    P: user field specified in the LOGGER_password parameter
    TS: TimeStamp from when the data was collected
    IO1: value of digital input/output 1 of the modem (if available)
    IO2: value of the digital input/output 2 of the modem (if available)
    IO3: value of the digital input/output 3 of the modem (if available)
    IO4: value of the digital input/output 4 of the modem (if available)
    IO5: value of the digital input/output 5 of the modem (if available)
    IO6: value of the digital input/output of the modem (if available)
    IO7: value of digital input/output 7 of the modem (if available)
    IO8: value of the digital input/output 8 of the modem (if available)
    IO9: value of the digital input/output 9 of the modem (if available)
    IO10: value of the digital input/output 10 of the modem (if available)
    AD1: value of the analog input 1 of the modem (sensor reading 4-20mA)
    AD2: value of the analog input 2 of the modem (if available)
    CO1: value of the pulse counter 1 input (if available)
    CO2: value of the pulse counter input 2 (if available)
    CO3: value of the pulse counter 3 input (if available)
    To configure the analog inputs as 4-20mA (instead of the defualt 0-50V) you must configure the microswitches 7 and 8 to ON, as indicated in the tables in “Appendix A” of this guide
  • The minutes that MTX-Tunnel will remain asleep begin to count when the modem enters ultralow consumption mode
  • From the MQTT platform, you can end the ULP session at any time without waiting for the 2 minutes to end. To do this, you can send the AT ^ MTXTUNNEL = SETULPSECONDS command to the modem to the topic [IMEI] / AT1, 0
  • The modem sends a JSON where the time is included. For that reason the configuration of 2 NTP time servers is included
  • The summary of the operation of the example:
    • The modem wakes up
    • The modem initiates the internal processes of connection to the internet and activates the relay to feed the sensor
    • Once connected to the Internet, the time is synchronized
    • After the seconds configured in Logger_ioPeriodDelay, to stabilize the sensor after its activation with the relay, the modem takes a sample of its I/O, reading the sensor 4-20mA
    • The modem stores the reading in flash memory and tries to send it to the MQTT server, along with other readings that may have been stored from previous days that could not be sent due to a problem
    • Every reading sent correctly is deleted from the flash memory
    • Passed “ULP_secondsOn” seconds, or having forced the end from the MQTT server, the modem goes into low power mode 1440 minutes (1 day), but not before deactivating the
      relay and removing, therefore, the power to the sensor 4- 20mA