Google Cloud Iot /MQTTS

Anyone use the rak2011 arduino sheild to connect to google iot core. Doesn’t seem to be any resources available other than the unsupported google library that only connects over wifi. Googles MQTT IOT library supports the dynamic creation of JWT’s that auto recreate before expiration but seems to be a lot of work to get something done they claim is simple. Rak WisLTE library allows for inclusion of the tokens but no real way to create dynamic JWT’s or documentation about anything if your not willing to go through the cpp files to extract your methods that way to use in your program. Seems like there was a lot of effort to build these things but unless you’ve got a computer science degree its a pretty steep learning curve. Any pointers?

I will suggest you to go with the managed version of google web hosting. Instead of the conventional GCE hosting server which is powered by Cloudways. I think this might help you connect with server in a more proper way.

here is example for AWS MQTT
configure the number of looping MQTT PUBLISH msg
pub_loop_val=100

MQTTS_CA_CRT = ‘C:\certs\VeriSign-G5.crt’
MQTTS_CLI_CRT = ‘C:\certs\66b60800b6-certificate.pem.crt’
MQTTS_CLI_KEY = ‘C:\certs\66b60800b6-private.pem.key’

;;;;;;;;;;;install cert index 0;;;;;;;;;;;;;;;;;
sendln ‘AT+QFDEL=“ufs:*”’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘at+qfupl=“UFS:CaCert.crt”,1758,100’
waitln ‘CONNECT’
mpause AT_timeout
sendfile MQTTS_CA_CRT 1
waitln ‘+QFUPL:’
mpause AT_timeout

sendln ‘at+qfupl=“UFS:Client.crt”,1224,100’
waitln ‘CONNECT’
mpause AT_timeout
sendfile MQTTS_CLI_CRT 1
waitln ‘+QFUPL:’
mpause AT_timeout

sendln ‘at+qfupl=“UFS:key.pem”,1675,100’
waitln ‘CONNECT’
mpause AT_timeout
sendfile MQTTS_CLI_KEY 1
waitln ‘+QFUPL:’
mpause AT_timeout

sendln ‘AT+QFLST="*"’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+cereg=2’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘ATE1’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘at+cimi’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+CGDCONT?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+CGMM’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+CGMR’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+GSN’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

;waiting for registration, looking for special pattern from at+cops? CATM GSM will help more forwards
:_wait_cops
timeout=5
sendln ‘AT+cops?’
waitln ‘,"’
if result != 1 then
goto _wait_cops
endif
mpause AT_timeout
timeout=60

sendln ‘AT+cops?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+cereg?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+creg?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+cgreg?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“ciphersuite”,2,0XFFFF’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“sslversion”,2,4’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“cacert”,2,“UFS:CaCert.crt”’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“clientcert”,2,“UFS:Client.crt”’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“clientkey”,2,“UFS:key.pem”’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“seclevel”,2,2’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QSSLCFG=“ignorelocaltime”,1’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

;yesnobox ‘ATT or VZW sim inserted? Yes: ATT No:VZW’ ‘Test Option’
;if result=1 goto _ATT_SIM_CASE

;sendln ‘AT+QMTCFG=“pdpcid”,0,3’
;waitln ‘OK’ ‘ERROR’
;mpause AT_timeout

:_ATT_SIM_CASE

sendln ‘AT+QMTCFG=“SSL”,0,1,2’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QMTCFG=“version”,0,4’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

timeout=1
sendln ‘AT+QMTOPEN?’
waitln ‘8883’
if result == 1 then
sendln ‘AT+QMTDISC=0’
waitln ‘+QMTDISC: 0,0’
mpause AT_timeout
endif

timeout=60

sendln ‘AT+QMTOPEN=0,“axn8skiwy5vn3.iot.us-west-2.amazonaws.com”,8883’
waitln ‘+QMTOPEN: 0,0’
if result !=1 then
messagebox “Error锛孋an’t connect to AWS server, check certs and start over!!” “ERROR”
goto _end
endif

mpause AT_timeout

sendln ‘AT+QMTOPEN?’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

sendln ‘AT+QMTCONN=0,“clientExample”’
waitln ‘+QMTCONN: 0,0,0’
mpause AT_timeout

i=0
while i< pub_loop_val

int2str valstr i
i=i+1

sendln ‘AT+QMTPUB=0,0,0,0,“topic/pub”’
pause 1
sendln valstr
pause 1
send #26
pause 1

endwhile

sendln ‘AT+QMTDISC=0’
waitln ‘OK’ ‘ERROR’
mpause AT_timeout

goto _end

:_end

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.