🤖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

    Scheduled Pinned Locked Moved Modules
    3 Posts 2 Posters 2.5k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          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
          • First post
            Last post