GRDs and Middleware
Connection between GRD-MQ and the broker
Configuration of the GRD-MQ to broker connection
Communication with the broker uses a TCP/GPRS connection. To be able to establish the connection it is necessary to:
- Place the antenna correctly and ensure GPRS coverage.
- Place the SIM card, and, if necessary configure PIN.
- Configure correctly the cell phone operator for the establishment of the GPRS connection.
- Configure the MQTT connection parameters
- Have a MQTT broker server ready and running
Configuring the broker connection
The broker's address and port are configured on the MQTT tab


Enabling the connection with the broker
When this option is enabled, we tell the cLAN-MQ to establish connection with the specified configuration. If this option is disabled the cLAN-MQ will not establish outgoing connections.
The IP address or URL of the server where the broker is running must be entered here. The cLAN-MQ can resolve URLs using DNS.
Unencrypted connections default port is 1883. Encrypted port is tipically 8883.
Encrypt
The cLAN-MQ can establish the link without encription ("No encryption") or using TLS 1.2 and TLS 1.0
CA signed server certificate: No cerfificate required.
CA certificate only: You must upload the CA certificate for validation
Self signed certificates: You must upload CA certificate, client certificate and client key

|
For GRD-MQ to be able to use "CA certificate only" and "Self signed certificates" the GRDs clock must be setted properly.
You can do this from "Monitor" in the configuration software.
|
This parameters must match the ones configured on the broker.
Keep Alive
Time in seconds to send the MQTT keep alive message (to keep the link alive in case there's no other MQTT message)
Certificates upload:

|
You must be connected to the cLAN to upload the certificates.
They are not included in the configuration |
After pressing the "Certificates" this window will pop up.

File format must be PEM
Advanced

SMS password
This password can be used to protect remote SMS configuration
Monitoring the connection in the GRD-MQ
To verify whether the entered configuration into the GRD-MQ is the correct one we have the possibility of monitoring the status of the connections and the signal.
To access the monitoring screen of the configurator click on the “Monitor” button. Then, the following screen will be displayed:
From here, the following parameters related to the connection are of interest: “Signal, SIM State, GPRS State and Link State”.
It indicates the signal level in dBm, the minimum value is -113 dBm, data transmission is impossible at this value.
Use this chart as reference for signal qualtity.

SIM State
- Disabled: The SIM (Chip) is disabled from the GRD-MQ configuration.
- Attaching: It is being registered in the GSM network.
- Selected but not resent: In models with SIM detection it indicates that the SIM is not placed.
- Pin Required: This message appears when a SIM card requires a PIN.
- PIN Error: This message shows that the PIN entered is incorrect.

|
If a PIN is entered incorrectly 3 consecutive times, the SIM card will block. To unblock it, you would need to enter its PUK. For more information contact your cell phone operator. |
- SIM Blocked: The SIM card is blocked, to be able to enable it you must enter its PUK. This operation is not possible using a GRD, and you will need a cell phone or another device to release the card.
|
If the PUK is entered erroneously too many times (the number of times depends on the telephone operator) you should change the SIM card. For additional information please contact you cell phone operator. |
- Low Signal: The signal level is insufficient.
- Ready: It is registered in the network.
The following are the possible states of the GPRS connection.
- Disabled: The GPRS connection is disabled in the GRD configuration.
- Waiting SIM Ready: The GPRS connection is disabled but is waiting for the equipment to register a GSM.
- Connecting: Is in the process of connection.
- Connected: Successful connection to GPRS.
- Error: Error in the connection to GPRS, it will retry in 30 seconds.
Link State
The TCP connection state can also be monitored. Remember that to be able to establish such a connection, you must count first on a GPRS service.
Once the GPRS connection is established, the possible TCP connection states are:
- Disabled: The TCP connection has net been enabled. In this state the Link LED is off.
- Waiting GPRS Ready: The connection to the broker is enabled but is waiting for the equipment to connect to the GPRS to initiate it.
- Connecting: The GRD is attempting to establish a connection to the indicated IP address and port. If the GRD is not able to establish the connection, the length of time in this state might be an indication of a failure. If it remains in this state for a few seconds (less than 10), it might be trying a connection to a closed port. If it maintains the state during a minute or more it might be attempting to connect to a port and/or IP behind a firewall and is being filtered.
- Connection Failed, Host Unreachable and Connection Refused: The 3 states imply that the connection to the broker was not possible, but individually, they indicate the reason why they occurred.
In general, each one has a specific motive although it depends on the connection on the server side for the indication to be correct, even so, any of the these 3 errors indicate a problem in the connection.
- Connection Failed: This error appears when a connection to the configured IP is not possible.
- Host Unreachable: This happens when a connection to the IP is possible the port is open, through the router or firewall, but there is nothing connected to that port.
- Connection Refused: In this case the connection cannot be established because the configured port is closed, this could happen because a router or firewall are blocking it.
- Host Closed Connection: This is an event that happens when the server closes the connection. This could be because the broker service has stopped, the server turned off, the connection to Internet dropped or any motive by which the server loses connectivity.
- Logging in : The connection has been established, and the GRD is going through the authentication process.
- Connected:The connection has been established and stable.
- DNS Failure : The GRD can't convert the URL into an IP address. Check if the IP address is OK.
- Error: The event occurs if the connection was not completed after a certain time and no other type of failure was reported.
2020-11-19