🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    SIM7600 and ThingSpeak, unable to publish

    Modules
    2
    3
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      HappyUser
      last edited by HappyUser

      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);

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        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

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        H 1 Reply Last reply Reply Quote 0
        • H
          HappyUser @felmue
          last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post