SIM7020E Can't post data through HTTP or MQTT

I just bought SIM7020E breakout board from

I become able to register to NB-LTE network, but when I tried to post some data according to datasheet,
https://www.google.com/url?sa=t&source=web&rct=j&url=https://simcom.ee/documents/SIM7020/SIM7020%20Series_HTTP_Application_Note_V1.1.pdf&ved=2ahUKEwjw3u683fXfAhUMuRoKHd_qDh4QFjACegQIARAB&usg=AOvVaw2NgxmHG65q4koslye6yKim

I always get error message in step num(4).

My AT commands sequence to send data are as follows:


//1- To Create HTTP host instance

AT+CHTTPCREATE=“http://demo.thingsboard.io

//2- To connect to server

AT+CHTTPCON=0

//3- To allow to POST data

AT+CHTTPPARA=1

//4- Posting Data to certain topic in thingsboard cloud

AT+CHTTPSEND=0,1, " api/v1/ $Access_TOKEN /attributes " , " HTTPHEADER_in_hex " , “application/json” , " json_data_in_hex "

//5- Disconnect from cloud

//Disconnect from the Server

AT+CHTTPDISCON=0


Noting that:


json_data_in_hex =

{“Sens1” : “23” }

That is encoded in hex to be --> 7b2253656e733122203a2022323322207d

HTTPHEADER_in_hex =

Accept: /

Connection: Keep-Alive

That is encoded in hex to be --> 4163636570743a202a2f2a0d0a436f6e6e656374696f6e3a204b6565702d416c697665

So, Finally I`m running the command as:

AT+CHTTPSEND=0,1," api/v1/ $Access_TOKEN /attributes " , " 4163636570743a202a2f2a0d0a436f6e6e656374696f6e3a204b6565702d416c697665 " ,

" application/json " , " 7b2253656e733122203a2022323322207d "

and it gives me error !

I don`t know what is the wrong?

Also, when I tried use MQTT AT commands, I followed the manual to start mqtt service:

https://www.google.com/url?sa=t&source=web&rct=j&url=http://www.microchip.ua/simcom/LTE/SIM7020/AppNotes/SIM7020%20Series_MQTT_Application_Note_V1.1.pdf&ved=2ahUKEwi7yffu3fXfAhXFyYUKHdI7D80QFjAAegQIAxAB&usg=AOvVaw3RXqAFydwu1o2oV-JhWLBg

But always I got error in all mqtt commands.

I`d be grateful if someone could help me.

Hi,
Please post proper URL. You have linked Google search results. Visit that page and get the link.

Errors can be for many reasons , unless you share the screenshot of the error and what and when exactly it happens we cant help much. If possible capture the AT command data in a terminal software and paste here.

Dear RaviPujar,

Here is the same post with proper HTML links. I have got the HW and tested it before, but currently, I don`t have the HW device with me to retest and give you some screenshots of the Error.

However, The following steps are exactly the serial AT commands I used to send to SIM7020E.
As I mentioned before, when sending AT command in step(4), the SIM7020E responded with just ERROR, I believe its a problem with the syntax of AT command, it seems that the SIM7020E module doesnt even accept the AT command syntax.


I just bought SIM7020E breakout board from

I become able to register to NB-LTE network, but when I tried to post some data according to datasheet,
https://simcom.ee/documents/SIM7020/SIM7020%20Series_HTTP_Application_Note_V1.1.pdf

I always get error message in step num(4).

My AT commands sequence to send data are as follows:

//1- To Create HTTP host instance

AT+CHTTPCREATE=“ http://demo.thingsboard.io

//2- To connect to server

AT+CHTTPCON=0

//3- To allow to POST data

AT+CHTTPPARA=1

//4- Posting Data to certain topic in thingsboard cloud

AT+CHTTPSEND=0,1, " api/v1/ $Access_TOKEN /attributes " , " HTTPHEADER_in_hex " , “application/json” , " json_data_in_hex "

//5- Disconnect from cloud

//Disconnect from the Server

AT+CHTTPDISCON=0

Noting that:

json_data_in_hex =

{“Sens1” : “23” }

That is encoded in hex to be --> 7b2253656e733122203a2022323322207d

HTTPHEADER_in_hex =

Accept: /

Connection: Keep-Alive

That is encoded in hex to be --> 4163636570743a202a2f2a0d0a436f6e6e656374696f6e3a204b6565702d416c697665

So, Finally I`m running the command as:

AT+CHTTPSEND=0,1," api/v1/ $Access_TOKEN /attributes " , " 4163636570743a202a2f2a0d0a436f6e6e656374696f6e3a204b6565702d416c697665 " ,

" application/json " , " 7b2253656e733122203a2022323322207d "

and it gives me error !

I don`t know what is the wrong?

Also, when I tried use MQTT AT commands, I followed the manual to start mqtt service:
http://www.microchip.ua/simcom/LTE/SIM7020/AppNotes/SIM7020%20Series_MQTT_Application_Note_V1.1.pdf

But always I got error in all mqtt commands.

I`d be grateful if someone could help me.

Finally, I become able to publish and subscribe data to the cloud using both HTTP and MQTT. The mqtt AT commands of sim7020 seems not working properly, So, I went through building the MQTT frame by my self and I sent the frame over TCP, using TCP AT commands, and finally it worked.

2 Likes

Can you post your MQTT frame, please? I use AT command and test with Hercules terminal , I have problem with AT MQTT command when I send packet publish to thingsboard cloud.

1 Like

Hi,
Can you share your code for the http request? i have the same problem

Many thanks!

Please share you code, thanks

Can you explain please how you builded your own MQTT frame and how you achieved to publish the data? I have the same problem with at commands for MQTT in sim7020 ,in order to publish data in “demo thingsboard”. Thanks in advance!

Hey Ahmed I have a similar problem when I try to post a JSON with MQTT. Can you please help me and share how you managed to get it worked with MQTT?

Hi, I had also problems trying to connect to Thingsboard. Solved them using 4 as parameter value for MQTT version 3.1.1 in AT+CMQCON=0,4,“device_id”,600,0,0,“device_token”,""
hope it helps