SARA SFF, N310 modem, MQTT

Hello,

I’m trying to use a SARA SFF board with N310 modem to send messages to an MQTT server.

I found that libraries:
Sodaq_R4X (GitHub)
Sodaq_MQTT (v1.0.0 required) (GitHub)
Sodaq_R4X_MQTT (GitHub)
they are written for the R4xx series modem and I cannot use them with the N310 modem.

On github I found the Sodaq_N3X library. But I still can’t use the Sodaq_MQTT library because Sodaq_N3X doesn’t have an interface for MQTT.

Am I wrong somewhere?
Can you help me with a simple example of how to send a message on an MQTT server (with SARA SFF board and N310 modem)?

Thank you very much,
Ionel

Hi @ionel ,

The N310 supports MQTT. Our N3X library indeed does not support MQTT.
You can look at the commands from ublox on how to implement MQTT
SARA-N2 / SARA-N3 series - SARA-N2-N3_ATCommands_(UBX-16014887).pdf (u-blox.com)
I will put MQTT with the N3X on the feature request list.

Best regards,
Jan

Hi Jan again,

Thank a lot fro the answer. I will try to implement MQTT with AT command but also I very interested about MQTT interface on N3X library.
Please let’s me know when this is available.

BR,
Ionel

Hello @Jan ,

We have implemented MQTT via AT commands as in the U-Blox manual.

Unfortunately we came over a very strange situation: if we do not power off the modem, message uploads works every time with a server which does not require authentication (such as Mosquito) but fails the third time with a server requiring authentication such as Ubidots! A particular thing is that if the message has the same payload, it does not fail with Ubidots, either! Each time the modem responds as if the message sending was successful, but the publishing does not happen.

If we power off the modem between transmissions, magic happens, it works every time!

We made a small programm to issue a series of commands, and should you be interested to test yourselves we can send it over. Anyway, the commands/answers succession is as below.

Do you have any idea what happens?


13:30:46.195 → AT
13:30:46.195 → OK
13:30:47.181 → AT+CGDCONT?
13:30:47.215 → +CGDCONT: 1,“IP”,“nbiot.vodafone.ro”,“10.21.0.216”,0,0,0
13:30:47.521 →
13:30:47.521 → OK
13:30:49.185 → AT+CSQ
13:30:49.219 → +CSQ: 20,99
13:30:49.287 →
13:30:49.287 → OK
13:30:50.204 → AT+CPIN?
13:30:50.238 → +CPIN: READY
13:30:50.306 →
13:30:50.306 → OK
13:30:51.190 → AT+UMQTTNV=0
13:30:51.224 → OK
13:30:52.005 → AT+UMQTT=0,“SFF_b000”
13:30:52.039 → OK
13:30:52.786 → AT+UMQTT=3,“169.55.61.243”,1883
13:30:52.820 → OK
13:30:53.602 → AT+UMQTT=4,"<32 character user name>",“pass”
13:30:53.636 → OK
13:30:54.891 → AT+UMQTT=10,10
13:30:54.925 → OK
13:30:55.707 → AT+UMQTT=12,1
13:30:55.741 → OK
13:30:56.523 → AT+UMQTTC=1
13:30:56.557 → OK
13:30:58.018 →
13:30:58.018 → +UUMQTTC: 1,1
13:31:04.500 → AT+UMQTTC=2,1,1,1,"/v1.6/devices/b000",“7B2262617474657279223A207B2276616C7565223A202234323135227D2C202274696D655F746F74616C223A207B2276616C7565223A202230227D7D”
13:31:04.568 → OK
13:31:05.723 →
13:31:05.723 → +UUMQTTC: 2,1
13:31:07.523 → AT+UMQTTC=0
13:31:07.523 → OK
13:31:07.557 →
13:31:07.557 → +UUMQTTC: 0,1


Hi @darius.popa ,

I see that you have the mqtt timeout set to 10 seconds.
Maybe it will help to extend this timeout, or set it to 0 to have no timeout.

Best regards,
Jan

Thank you, we shall try.