Telit Cinterion IoT Developer Community
How to do MQTT on EXS82 platform
Tutorial, December 27, 2019 - 3:39am, 8422 views
Because EXS82 doesn’t support JAVA like PLS62 and ELS61 series, we need to use AT command to achieve MQTT feature.
- Environment setting:
- Ubuntu 18.04.03 for MQTT broker and client
- EXS82 CS2 FW:REVISION 00.038, A-REVISION 01.000.00
- Steps:
Ubuntu:
1. Install MQTT related update and
"sudo apt install -y mosquito" (Install Mosquitto MQTT Broker)
"sudo apt install -y mosquitto-clients" (Install Mosquitto Client)
2. Make sure MQTT subscriber/publisher works
mosquitto_sub -h IP -t Topic (Create a subscriber for specific Topic)
ex: "mosquitto_sub -h 60.250.82.33 -t test" means to wait for Topic as test message
mosquitto_pub -h IP -t Topic -m Message (Create a publisher for specific Topic and send message)
ex: "mosquitto_pub -h 60.250.82.33 -t test -m 1234" means to send Topic as test and message is 1234 to the subscriber.
Module (EXS82-W):
AT command for publisher:
AT+COPS?
+COPS: 0,0,"Chunghwa Telecom",7
at^SICA=0,1
OK
AT^SISS=1,srvType,"Mqtt"
OK
AT^SISS=1,conId,"1"
OK
AT^SISS=1,address,"mqtt://60.250.82.33"
OK
AT^SISS=1,cmd,"publish"
OK
AT^SISS=1,hcContLen,4
OK
AT^SISS=1,clientId,"1111"
OK
at^SISS=1,Topic, "test"
OK
at^SISS?
^SISS: 0,"srvType",""
^SISS: 1,"srvType","Mqtt"
^SISS: 1,"conId","1"
^SISS: 1,"address","mqtt://60.250.82.33"
^SISS: 1,"cmd","publish"
^SISS: 1,"hcContLen","4"
^SISS: 1,"clientid","1111"
^SISS: 1,"topic","test"
^SISS: 2,"srvType",""
at^sica=1,1
OK
AT^SISO=1
OK
^SIS: 1,0,8800,"Mqtt connect 60.250.82.33:1883"
^SIS: 1,0,2500,"Connection accepted on clean session."
at^SISW=1,4
^SISW: 1,4,0
Result:
Module side: (After Sending at^SISW=1,4 command, type “abcd”)
Ubuntu side:
You can see the result like:
mosquitto_sub -h 60.250.82.33 -t test
abcd => Receive the message from publisher
Hello Leon
That's a nice start :)
do you have an example use of the Dynamic setup, making use of ^SISD and ^SISU ?
I'm unable to make it work (I'm on a EXS82-W with REVISION 00.038).
"Static" setup with ^SISW works fine
Hi Leon
Some precisions / more details :
I'm testing with Cayenne Mydevices (https://developers.mydevices.com/cayenne/features/) where the topic name is a bit long.
Reminder : it works fine when I use the static method (SISO=x, SISW, SISC=x)
I've tried 2 methods for dynamic send (SISO=x,2) :
1/ ^SISU with arguments.
at^sisu=2,"publish","1:v1/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/things/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/data/2:0:rel_hum,p=40:12"
+CME ERROR: text string too long
--> what's the maximum allowed size for this command ? is it possible to extend it ?
2/ ^SISD + ^SISU without arguments :
remark a/ looks like "GSM" coding is used (it doesn't make sense to me to use this coding schemen here):
at^sisd=2,"setParam","hcContent","rel_hum,p=100"
OK
at^sisd=2,"getParam","hcContent"
^SISD: 2,"hcContent","rel\11hum,p=100"
remark b/ the documentation doesn't seem clear to me because I would expect to define everything with SISD and then just trigger the command with SISU, but SISU seems to expect from me to use SISW (I receive a ^SISW: 2,1 URC, then I write some data, which are transmitted, then I receive a SISW: 2,2 URC but the connection is maintained and I can send some more data, which looks like what I want. But it's a bit confusing).
--> I don't know if I understood well.
I also need a clear example on AT^SISD - AT^SISU commands
Jesus Santos
FAE
Hi,
after at^siss definition with AT^SISS=1,"srvType","Mqtt"
etc. please try the following...first open connection, then define the dynamic parameters and fire them with at^sisu.
at^sica=1,1
OK
at^siso=1,2
OK
^SIS: 1,0,8800,"Mqtt connect xyz:1883"
^SIS: 1,0,2500,"Connection accepted on clean session."
at^sisd=1,setParam,cmd,publish
OK
AT^sisd=1,setParam,topic,"dev1/temperature"
OK
at^sisd=1,setParam,hcContent,"13.14"
OK
at^sisu=1
OK
^SISW: 1,2
BR,
Markus
Please see https://iot-developer.thalesgroup.com/tutorial/data-transfer-methods-mqt...
This article will tell you all about, Python, Java and AT Internet Services on PLS62-W and EXS82-W