Tunnel – Example of reading of pulse counters (dry contact or reed). Sending data to web platform

¿Buscas alguna otra cosa?

Scenario details:

  • Every water meters in a multiple-site installation has a pulse output. At every site there are 2 counters in need of a modem capable of carrying out pulse counting of each counter
  • Every hour the modem must send counter data to a WEB platform to be dealt with

Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2

EXAMPLE of configuration (config.txt file) for the indicated scenario:

Configuration Observations
MTX_pin: 0000
MTX_mode: none
MTX_model: 199801436
MTX_ping: 30
MTX_pingIP: 8.8.8.8
MTX_ATLimited: off
MTX_TPProtocol: ntp
MTX_TPServer: ntp.roa.es
MTX_TPServer2: es.pool.ntp.org

GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0

SMS_allPhones: on
SMS_sendIP: on
SMS_ATEnabled: on
SMS_ATResponse: on

FIREWALL_enabled: off
TELNET_enabled: on
TELNET_login: user
TELNET_password: 1234

LOGGER_enabled: on
LOGGER_password: ID12345678
LOGGER_server: www.metering.es/json/set.asp?data=
LOGGER_registerSize: 600
LOGGER_numRegistersFlash: 500
LOGGER_ioPeriod: 3600
LOGGER_httpmode: getjson
SIM Card PIN
We don’t need 3G-RS232 gateways
Modem model
Keep alive every 30 minutes
IP address for ping
No limits for user AT Commands
Time synch. protocol
TimeServer 1 (time synch)
TimeServer 2 (backup)
SIM card APN
SIM card Username
SIM card Password
2G/3G permanent connection
All phones are allowed
IP by SMS authorized
AT by SMS allowed
SMS AT responses activated
No firewall
Telnet enabled
Telnet username
Telnet password
Datalogger enabled
User field
URL for sending data
Register size
Number of registers in internal datalogger
We want to read counters every 3600s (1h)
HTTP GET JSON sensing mode

Details:

  • How does MTX-Tunnel send counter data to the Web Server? Tunnel sends JSON data via HTTP(S) GET. In the previous example data will be sent to the URL: http://www.metering.es/json/dataset.php?data=
  • What is JSON data format like? 
  • Tunnel will send data from all inputs and counters due to LOGGER_ioPeriod being >0
{“IMEI”:357042060414951,”TYPE”:”IOS”,”TS”:”30/07/2016 13:14:36”,”P”:”ID12345678”,”IP”:”80.23.1.3”,”CSQ”:10,”VER”:”9.12”, “AUX”:””,”MOD”:”101”,”IO1”:0,”IO2”:0,”IO3”:0,”IO4”:0,”IO5”:0,”IO6”:0, “IO7”:0,”IO8”:0,”IO9”:0,”IO10”:0,”AD1”:0,”AD2”:0,”CO1”:”1023”, “CO2”:”18425”}

Where:

IMEI IMEI of the modem. Unique for each modem
TYPE JSON type
TS Time stamp of when data was collected from the modem
P User field specified in LOGGER_password
IP Current IP of the modem
CSQ Signal level. Between 0 … 31
VER MTX-Tunnel version
IO1 I/O value
AD1 Analog input 1 value
AD2 Analog input 2 value
CO1 Counter 1 value
CO2 Counter 2 value
  • If the modem is periodically reset, will the counters reset continuously? No. Counters value won’t be lost if modem is reseted. Counters reset when lacking power supply in the modem. The countes are not stored in flash memory, because doing it continuously would quickly shorten its life. When receiving data on your server always keep in mind that if you receive a value inferior to the previos reading, that means that there was a power supply failure. Therefore you should add it to the previous reading information stored.
  • What is the max. value the counters can count, and what happens when they reach the max.? 4 bytes. When surpassing they’re set to 0. If 1 pulse/sec is generated continuously. 
  • Is it possible to read counter data at a certain time? Yes, via Telnet or SMS by means of AT^MTXTUNNEL=GETCOUNTER,x command (x=counter). 
  • Is it possible to initialize the counters? Yes, via AT^MTXTUNNEL=SETCOUNTER,x,value command (x=counter, value=value to write in).
  • In which pins of MTX-3G-Java-IOT modem pulse generator cable is connected? Modem will count pulses every time PIN4 or PIN11 of DB15 connector of the modem is taken to a GND (PIN 14 of DB15). You should use PIN4/14 for Counter 1 and PIN11/14 for 2.