This
This is the output I got on the serial monitor. I'm not sure how to parse it.
I am not seeing a POST request on the webhook site.
Starting Arduino web client.
TAT
OK
AT+IPR=921600
OK
AT
OK
AT+UPSV=3
OK
AT+CPIN?
ERROR
AT+CPIN?
+CPIN: READY
OK
AT+CMGF=1
OK
AT+UDCONF=1,1
OK
AT+CTZU=1
OK
AT+UDTMFD=1,2
AT+CREG?
+CREG: 0,0
OK
+UMWI: 0,1
+UMWI: 0,2
+UMWI: 0,3
+UMWI: 0,4
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,5
OK
AT+UCALLSTAT=1
OK
AT+CGATT=1
OK
AT+UPSD=0,1,"prepay.pelion"
OK
AT+UPSD=0,6,3
OK
AT+UPSD=0,2,"arduino"
OK
AT+UPSD=0,3,"arduino"
OK
AT+UPSD=0,7,"0.0.0.0"
OK
AT+UPSDA=0,3
OK
AT+UPSND=0,8
+UPSND: 0,8,1
OK
Connected
AT+USECMNG=0,0,"AddTrust_External_CA_Root",1082
>
+USECMNG: 0,0,"AddTrust_External_CA_Root","1d3554048578b03f42424dbf20730a3f"
OK
AT+USECMNG=0,0,"Baltimore_CyberTrust_Root",891
>
+USECMNG: 0,0,"Baltimore_CyberTrust_Root","acb694a59c17e0d791529bb19706a6e4"
OK
AT+USECMNG=0,0,"COMODO_RSA_Certification_Authority",1500
>
+USECMNG: 0,0,"COMODO_RSA_Certification_Authority","1b31b0714036cc143691adc43efdec18"
OK
AT+USECMNG=0,0,"DST_Root_CA_X3",846
>
+USECMNG: 0,0,"DST_Root_CA_X3","410352dc0ff7501b16f0028eba6f45c5"
OK
AT+USECMNG=0,0,"DigiCert_High_Assurance_EV_Root_CA",969
>
+USECMNG: 0,0,"DigiCert_High_Assurance_EV_Root_CA","d474de575c39b2d39c8583c5c065498a"
OK
AT+USECMNG=0,0,"Entrust_Root_Certification_Authority",1173
>
+USECMNG: 0,0,"Entrust_Root_Certification_Authority","d6a5c3ed5ddd3e00c13d87921f1d3fe4"
OK
AT+USECMNG=0,0,"Equifax_Secure_Certificate_Authority",804
>
+USECMNG: 0,0,"Equifax_Secure_Certificate_Authority","67cb9dc013248a829bb2171ed11becd4"
OK
AT+USECMNG=0,0,"GeoTrust_Global_CA",856
>
+USECMNG: 0,0,"GeoTrust_Global_CA","f775ab29fb514eb7775eff053c998ef5"
OK
AT+USECMNG=0,0,"GeoTrust_Primary_Certification_Authority_G3",1026
>
+USECMNG: 0,0,"GeoTrust_Primary_Certification_Authority_G3","b5e83436c910445848706d2e83d4b805"
OK
AT+USECMNG=0,0,"GlobalSign",958
>
+USECMNG: 0,0,"GlobalSign","9414777e3e5efd8f30bd41b0cfe7d030"
OK
AT+USECMNG=0,0,"Go_Daddy_Root_Certificate_Authority_G2",969
>
+USECMNG: 0,0,"Go_Daddy_Root_Certificate_Authority_G2","803abc22c1e6fb8d9b3b274a321b9a01"
OK
AT+USECMNG=0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5",1239
>
+USECMNG: 0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5","cb17e431673ee209fe455793f30afa1c"
OK
AT+USECMNG=2,0,"AmazonRootCA1"
ERROR
AT+USECMNG=0,0,"Starfield_Services_Root_Certificate_Authority_G2",1011
>
+USECMNG: 0,0,"Starfield_Services_Root_Certificate_Authority_G2","173574af7b611cebf4f93ce2ee40f9a2"
OK
AT+USOCR=6
+USOCR: 0
OK
AT+USOSEC=0,1,0
OK
AT+USECPRF=0,0,1
OK
AT+USOCO=0,"webhook.site",443
ERROR
AT+USOCL=0
ERROR
connection failed
Welcome to the club! I'm already fighting a long battle on this field of shame...
AT+USOCO=0,"webhook.site",443
Means the modem failed creating a socket to webhook.site on port 443.
ERROR
AT+USOCL=0
The modem answers ERROR...how exciting...
Then tries to close the never opened socket. Answer is ERROR
So, this is the core of the problem. The baseband (the modem) is a seperate "computer" with firmware etc. You can only communicate with AT commands but you can never control or debug whats happening between the modem and the network.
Can anybody help me what could be the problem?
(The same post working from postman)
Thanks
This is the serial monitor output:
Starting Arduino web client.
⸮AT
OK
AT+IPR=921600
OK
AT
OK
AT+UPSV=3
OK
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
ERROR
AT+CPIN?
+CPIN: SIM PIN
OK
AT+CPIN="6836"
OK
AT+CMGF=1
OK
AT+UDCONF=1,1
OK
AT+CTZU=1
OK
AT+UDTMFD=1,2
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,0
OK
AT+CREG?
+CREG: 0,1
OK
AT+UCALLSTAT=1
OK
AT+CGATT=1
OK
AT+UPSD=0,1,"internet.vodafone.net"
OK
AT+UPSD=0,6,3
OK
AT+UPSD=0,2,""
OK
AT+UPSD=0,3,""
OK
AT+UPSD=0,7,"0.0.0.0"
OK
AT+UPSDA=0,3
OK
AT+UPSND=0,8
+UPSND: 0,8,1
OK
connecting...
AT+CSQ
+CSQ: 25,2
OK
Connecting to HTTP Server...
AT+USECMNG=0,0,"AddTrust_External_CA_Root",1082
>
+USECMNG: 0,0,"AddTrust_External_CA_Root","1d3554048578b03f42424dbf20730a3f"
OK
AT+USECMNG=0,0,"Baltimore_CyberTrust_Root",891
>
+USECMNG: 0,0,"Baltimore_CyberTrust_Root","acb694a59c17e0d791529bb19706a6e4"
OK
AT+USECMNG=0,0,"COMODO_RSA_Certification_Authority",1500
>
+USECMNG: 0,0,"COMODO_RSA_Certification_Authority","1b31b0714036cc143691adc43efdec18"
OK
AT+USECMNG=0,0,"DST_Root_CA_X3",846
>
+USECMNG: 0,0,"DST_Root_CA_X3","410352dc0ff7501b16f0028eba6f45c5"
OK
AT+USECMNG=0,0,"DigiCert_High_Assurance_EV_Root_CA",969
>
+USECMNG: 0,0,"DigiCert_High_Assurance_EV_Root_CA","d474de575c39b2d39c8583c5c065498a"
OK
AT+USECMNG=0,0,"Entrust_Root_Certification_Authority",1173
>
+USECMNG: 0,0,"Entrust_Root_Certification_Authority","d6a5c3ed5ddd3e00c13d87921f1d3fe4"
OK
AT+USECMNG=0,0,"Equifax_Secure_Certificate_Authority",804
>
+USECMNG: 0,0,"Equifax_Secure_Certificate_Authority","67cb9dc013248a829bb2171ed11becd4"
OK
AT+USECMNG=0,0,"GeoTrust_Global_CA",856
>
+USECMNG: 0,0,"GeoTrust_Global_CA","f775ab29fb514eb7775eff053c998ef5"
OK
AT+USECMNG=0,0,"GeoTrust_Primary_Certification_Authority_G3",1026
>
+USECMNG: 0,0,"GeoTrust_Primary_Certification_Authority_G3","b5e83436c910445848706d2e83d4b805"
OK
AT+USECMNG=0,0,"GlobalSign",958
>
+USECMNG: 0,0,"GlobalSign","9414777e3e5efd8f30bd41b0cfe7d030"
OK
AT+USECMNG=0,0,"Go_Daddy_Root_Certificate_Authority_G2",969
>
+USECMNG: 0,0,"Go_Daddy_Root_Certificate_Authority_G2","803abc22c1e6fb8d9b3b274a321b9a01"
OK
AT+USECMNG=0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5",1239
>
+USECMNG: 0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5","cb17e431673ee209fe455793f30afa1c"
OK
AT+USECMNG=2,0,"AmazonRootCA1"
ERROR
AT+USECMNG=0,0,"Starfield_Services_Root_Certificate_Authority_G2",1011
>
+USECMNG: 0,0,"Starfield_Services_Root_Certificate_Authority_G2","173574af7b611cebf4f93ce2ee40f9a2"
OK
AT+USOCR=6
+USOCR: 0
OK
AT+USOSEC=0,1,0
OK
AT+USECPRF=0,0,1
OK
AT+USOCO=0,"api.thingspeak.com",443
OK
Connected!
connected to:
api.thingspeak.com
443
Beginnning JSON Post Sequence
AT+USOWR=0,5,"504F535420"
+USOWR: 0,5
OK
AT+USOWR=0,21,"2F7570646174652E6A736F6E20485454502F312E31"
+USOWR: 0,21
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
POST /update.json HTTP/1.1
AT+USOWR=0,24,"486F73743A206170692E7468696E67737065616B2E636F6D"
+USOWR: 0,24
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
Host: api.thingspeak.com
AT+USOWR=0,53,"557365722D4167656E743A206D772E646F632E62756C6B2D757064617465202841726475696E6F204D4B522047534D203134303029"
+USOWR: 0,53
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
User-Agent: mw.doc.bulk-update (Arduino MKR GSM 1400)
AT+USOWR=0,17,"436F6E6E656374696F6E3A20636C6F7365"
+USOWR: 0,17
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
Connection: close
AT+USOWR=0,30,"436F6E74656E742D547970653A206170706C69636174696F6E2F6A736F6E"
+USOWR: 0,30
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
Content-Type: application/json
AT+USOWR=0,16,"436F6E74656E742D4C656E6774683A20"
+USOWR: 0,16
OK
Content-Length: AT+USOWR=0,3,"313236"
+USOWR: 0,3
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
126
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
{"api_key":"1231231231321","field1":"32","latitude":"","longitude":"","status":"Arduino Test: "}AT+USOWR=0,1,"7B"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"61"
+USOWR: 0,1
OK
AT+USOWR=0,1,"70"
+USOWR: 0,1
OK
AT+USOWR=0,1,"69"
+USOWR: 0,1
OK
AT+USOWR=0,1,"5F"
+USOWR: 0,1
OK
AT+USOWR=0,1,"6B"
+USOWR: 0,1
OK
AT+USOWR=0,1,"65"
+USOWR: 0,1
OK
AT+USOWR=0,1,"79"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3A"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"34"
+USOWR: 0,1
OK
AT+USOWR=0,1,"31"
+USOWR: 0,1
OK
AT+USOWR=0,1,"56"
+USOWR: 0,1
OK
AT+USOWR=0,1,"4C"
+USOWR: 0,1
OK
AT+USOWR=0,1,"39"
+USOWR: 0,1
OK
AT+USOWR=0,1,"39"
+USOWR: 0,1
OK
AT+USOWR=0,1,"35"
+USOWR: 0,1
OK
AT+USOWR=0,1,"41"
+USOWR: 0,1
OK
AT+USOWR=0,1,"59"
+USOWR: 0,1
OK
AT+USOWR=0,1,"4D"
+USOWR: 0,1
OK
AT+USOWR=0,1,"38"
+USOWR: 0,1
OK
AT+USOWR=0,1,"30"
+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"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"6C"
+USOWR: 0,1
OK
AT+USOWR=0,1,"6F"
+USOWR: 0,1
OK
AT+USOWR=0,1,"6E"
+USOWR: 0,1
OK
AT+USOWR=0,1,"67"
+USOWR: 0,1
OK
AT+USOWR=0,1,"69"
+USOWR: 0,1
OK
AT+USOWR=0,1,"74"
+USOWR: 0,1
OK
AT+USOWR=0,1,"75"
+USOWR: 0,1
OK
AT+USOWR=0,1,"64"
+USOWR: 0,1
OK
AT+USOWR=0,1,"65"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3A"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"2C"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"73"
+USOWR: 0,1
OK
AT+USOWR=0,1,"74"
+USOWR: 0,1
OK
AT+USOWR=0,1,"61"
+USOWR: 0,1
OK
AT+USOWR=0,1,"74"
+USOWR: 0,1
OK
AT+USOWR=0,1,"75"
+USOWR: 0,1
OK
AT+USOWR=0,1,"73"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3A"
+USOWR: 0,1
OK
AT+USOWR=0,1,"22"
+USOWR: 0,1
OK
AT+USOWR=0,1,"41"
+USOWR: 0,1
OK
Thanks. I am not familiar with mqtt protocol. The final target to write the data to my database. Thingspeak just an exapmle to test post. At the end i would call my own web api to store data.
If i use mqtt i need an MQTT Broker if I am right.
There are some advantages with small data amounts (persistent socket, less overhead etc) and you can provide the data to many endpoints, because the "server" is a broadcaster called broker.
Read some introductions and you will get it.
Yes, you are right, a mqtt broker (server) is needed, there are public ones (also with a web interface to debug and visualize( shiftr.io for example). I run a broker called mosquitto and wrote a node.js that acts as a receiver (listener) of the broadcast and writes the data in a database.
On the arduino site, as mentioned, you need a library (i use GitHub - 256dpi/arduino-mqtt: MQTT library for Arduino) but there are others.
The SARA410 modem on the mkr1500 has also a internal mqtt functionality, i started a lib under GitHub - CptHolzschnauz/MKRNB: NBMQTT is a new class for the MKRNB library to use the internal MQTT functionality of the SARA R410 modem (my other name is cpt. holzschnauz ;=)
It's under construction, you can connect, send etc. but receiving data from the broker is not yet implemented (everyone is welcome to contribute!)
You can also stay with the http and find a POST solution or, maybe simpler, do a get request (like the example) with the data (example: blabla.html?data=helloworld ) and parse on the server.