MQTT/S via LTE-M (SSL, MQTT, GSM)

Hi,

I'm trying to achieve a secure connection to a HiveMQ mqtt broker using LTE-M.
As hardware I'm using a Portenta H7 with a CAT M1 NB-IoT GNSS Shield attached.

I'm wondering if anybody has achieved a successful connection using this setup. The Arduino native GSM library for the shield apparently does not support SSL, and the third party libraries (namely SSLClient) I've tried are having problems with the mobile connection.

Any help is appreciated!

Hi,

Did you managed to do this ?
I'm also trying to connect the portenta h7 to a mqtt broker through LTE-M and if possible with TLS.

I also have problems to communicate with the broker though the standard port (without ssl). I can connect to the broker only with the Arduino Mqtt library but once connected, I can't managed to get or send messages. When trying though ethernet eveything working fine.

I also tried another library but I wasn't able to connect to the broker with the GSM client.

Hi mfuhry,

I have indeed not been able to achieve this using the GSM library, or any other third party libraries that aim at cellular devices. When I reached out to the Arduino support they stated that they currently do not support SSL in combination with their GSM llibrary out of the box, and SSLClient does not support LTE-M.

As a workaround you can use a passthrough sketch to set up a connection to the TX62-W modem directly. If you decide to go with this route, I'm sure you will find this forum post I made on the cinterion support forum helpful for setting up a connection with HiveMQ.
You will also need to get in contact with their support to access the certificate upload tool, but I can confirm that this solution will let you establish an encrypted connection to a HiveMQ broker with the Arduino shield.

@magnotherm @mfuhry @magmilo

I am also wanting to do the same thing MQTT -> AWS IOT and the reason I order the GNSS card was to get a production grade MQTT connection, I am currently using the MKR card but want to move to the Portenta H7 and GNSS
Any luck with libraries that would allow a secure connection to AWS?
thanks

Hi @jrobertshawe,

the setup described in my previous post should work for your purposes.
Directly communicating between H7 and the TX62-W module through the UART interface will allow you to set up a secure connection with AWS IoT Core. I was not able to replicate this using any libraries.

However, we ultimatively dropped the approach alltogether as it became apparent that the CAT M1 NB-IoT GNSS Shield is not compatible with the Portenta Machine Control.

Thanks @magmilo Do you end up selecting a different GSM card?

thanks

Julian

Hi @jrobertshawe,

we ended up using external hardware in the form of a cellular router as a temporary solution.

Have you tried the approach I mentioned above?

@magmilo Waiting for the card to arrive. I will let you know if successful.

thanks

Julian

Hi @magmilo ,
I am currently trying to connect the Portenta H7 with the shield via NB-IOT to Azure Iot. I am using the Azure SDK C for this. With the secure connection to mqtt the problems come as already described here. Partially, however, a connection is established and data is sent via mqtt. I use the GSM lib from the Mbed core.
I tried to implement your suggestion, the connection to the network via AT commands works. Unfortunately I do not get on from here, how I have to set up exactly the profile to connect via TLS to my broker?

Thanks
Manuel

Hi @manfi ,

it'd be helpful to be able to see the specific error you're getting. I'd also recommend writing a post in the Telit Cinterion forum, they were very helpful when trying to figure out how to establish a connection to HiveMQ.

That being said, I think you should double check that the correct TLS certificates are installed on your modem. You can use the AT^SBNR="is_cert" command when connected to the modem to display all installed certificates. Compare those with the root certificate of the Azure IoT broker, which you should probably be able to find by googling or can extract using openssl.
Apart from that, double check all the connection parameters you are setting on the modem. These are the options I used for testing
^SISS: 1,"srvType","Mqtt"
^SISS: 1,"conId","1"
^SISS: 1,"address","mqtts:/user:password@broker.s2.eu.hivemq.cloud:8883"
^SISS: 1,"secopt","1"
^SISS: 1,"ipVer","4"
^SISS: 1,"cmd","unsubscribe"
^SISS: 1,"cleanSession","1"
^SISS: 1,"clientid","004401083574984"
^SISS: 1,"topicFilter","MQTTDemoListener"
^SISS: 1,"secsni","1"
^SISS: 1,"sniname","broker.s2.eu.hivemq.cloud"

Hi @magmilo ,

thanks for the fast response!
I have checked the certificates, the correct certificate is one among 24, does it cause problems if there are too many certificates?
^SBNR: 4, size: "914", issuer: "/C=US/O=DigiCertInc/OU=www.digicert.com/CN=DigiCertGlobal Root G2", ...
Azure uses the DigiCert Root G2.

^SISS: 0,"srvType","Socket"
^SISS: 0,"conId","1"
^SISS: 0,"address","sockudp://:1337"
^SISS: 1,"srvType","Socket"
^SISS: 1,"conId","1"
^SISS: 1,"address","socktcp://<azure_broker_ip>:8883"

SISS 0 belongs to the NTP timeserver, SISS 1 to Azure. I copied the settings directly after a failed transfer. User and password are regenerated each time but I don't understand the socket label.
I suspect that the parameters are not set correctly and therefore no connection can be established.
Using Wifi, the connection is no problem with otherwise the same settings.

Thanks

Hi @manfi ,

The certificate seems to be nothing to worry about in this case.

Judging from your excerpt, I'm assuming that your connection settings are not configured properly. Where did you take the information from? Currently you're trying to connect to a mqtt broker via plain tcp.
Try setting the srvType to Mqtt and the address to mqtts://<azure_broker_ip>:8883. To connect via mqtt you also need to have a cmd and topicFilter set if I recall correctly. You can find all of this information and an example in the AT command set document for the module.

Hope this helps :slight_smile: