SIM7600 and ThingSpeak, unable to publish
-
Dear all,
I nearly got SIM7600, MQTT and Thingspeak working. But I am not able to get the public working.
This is my basic syntax:
The module returns OK status, so so far so good. But no data shows up in my channel.
The weird things is I use the same Topic and message structure as with my SIM7080 module, and that works. Any suggestions?My last part of the code :
String payload="channels/"+ String(ChannelId)+"/publish";
int Payload_Length;
Payload_Length=payload.length();SerialAT.println("AT+CMQTTTOPIC=0,"+String(Payload_Length)); // Input the publish message topic <client_index,req_length>
SerialAT.println(payload);
Read_Response_Ignore_OK(3000);payload="field1=345&field2=543";
Serial.print(" ");
Payload_Length=payload.length();
Serial.println ("AT+CMQTTPAYLOAD=0,"+String(Payload_Length));
SerialAT.println("AT+CMQTTPAYLOAD=0,"+String(Payload_Length)); // input the publish message body <client_index,req_length>
SerialAT.println(payload);
//delay(50);
Read_Response_Ignore_OK(1000);SerialAT.println("AT+CMQTTPUB=0,0,60,0,0"); // Publish a message to the server <client_id,qos,pub_timeout,retained>
Read_Response_Ignore_OK(1000); -
Hello @HappyUser
according to the documentation, after sending the
AT+CMQTTTOPIC=0,<length>command the modem answers with a prompt>after which the topic can be sent. However your code seems to sent the topic right after issuing the command. Maybe try adding a short delay?Same for the payload - try with a short delay before sending the payload.
If that solves the issue then of course the proper solution would be to actually wait for the prompt (or error) with a timeout.
Thanks
Felix -
@felmue And indeed, I needed to add a delay before sending the payload. I had hoped that it would be necessary (in order to speed up he process of waking up, sending and going to sleep).
Regards
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login