Suchen Sie etwas anderes?
Scenario details:
- There is a vending machine with an RS232 serial port. We want to connect the RS232 serial port of the vending machine directly to an MQTT platform, where the communications protocol will be implemented. When the reading protocol of the vending machine is implemented in the MQTT platform, the modem must behave as a “transparent RS232-MQTT gateway,” providing the MQTT platform access to the machine’s data bus in RAW format
- The modem must be able to be managed from the platform, being able to change its configuration remotely at any time via MQTT. The modem must also inform periodically about its status (coverage, technology used, …)
- The modem must immediately inform the MQTT platform when it detects a change in one of its digital inputs, which will be connected to the open door sensor of the machine
Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2 EXAMPLE of configuration (config.txt file) for the indicated scenario. Solution for quick communication via Socket TCP:
Configuration | Observations |
COMM_baudrate: 9600 |
Serial port baud rate 8 bit data No flow control No flow control 1 stop bit No parity APN GPRS provided by the GSM operator GPRS Login GPRS Password Permanent 3G session The SIM card PIN (if there is any) MQTT serial gateways will be used MTX modem model being used One ping every 35 min. without communications Ping address Gateway port RS485 No fragmented networks No limitations to AT commands Time synch protocol Time server Backup time server Send SMS with commands from any phone Modem won’t respond IP to a missed call/SMS Commands can be sent to the MTX by SMS MTX responds with an SMS to a command SMS MQTT service enabled Broker IP/DNS specified, including identifying port Identifier MQTT topic to send AT commands Topic to send replies to commands to Connection keep alive (300 seconds) Data received will be retransmitted via serial Data received v/serial, retransmitted to this topic Status data sending activated Sending mode MQTT Topic where status data will be sent Extended data not sent (E/S, ADCs…) Every 300 secs. (5 mins.) there’s a sending Logger activated Size of the record Number of records in flash storage Sending mode MQTT Sending topic to MQTT broker of the data Changes in digital inputs automatically sent |
Details:
- A transparent RS232-MQTT gateway allows to exchange raw data between the MQTT broker (or another application connected to the MQTT broker) and the machine connected to the RS232 port of the modem. All data the modem receives through its RS232 serial port will be forwarded via MQTT to the broker’s topic specified in the “MQTT_commtxtopic” parameter, and viceversa
- If, instead of specifying an RS232-MQTT gateway, we need an RS485-MQTT gateway (and the MTX modem has an RS485 port), we only need to set the “MTX_invertedCom: on” parameter in the configuration file
- Keep in mind that communications latencies may be somewhat greater than direct communication latencies since there is an intermediary (the mqtt broker) and the speed of communications will depend on the power of the latter. Set the timeout if necessary
- In addition, the modem will send its status periodically (every 300 sec) to the MQTT broker (in a JSON object) to the topic configured in the “DNS_mqtttopic” parameter. Similarly, each time there is a change in one of the digital inputs, the modem will send a JSON with the changes to the topic configured in the “LOGGER_mqtttopic” parameter