Does anybody worked on Quectel EC200 series SIM module for establishing an MQTT connection to cloud

AT+QMTCONN=0,"deployment-fc9b6ee2","chara","chara"

OK

+QMTCONN: 0,1

+QMTSTAT: 0,3

I'm getting the error like the above, but Ideally the response should be +QMTCONN:0,0,0
Solution
#include <PubSubClient.h>
#include <QuectelMQTT.h>

const char* mqtt_server = "your_mqtt_server";
const int mqtt_port = 1883;
const char* mqtt_username = "your_username";
const char* mqtt_password = "your_password";
const char* mqtt_topic = "your_topic";

QuectelMQTT quectel_mqtt("your_apn", "your_username", "your_password", "your_simcard_pin");
WiFiClient espClient;
PubSubClient client(espClient);

void setup() {
  quectel_mqtt.PowerOn(); // Power on the Quectel module
  quectel_mqtt.InitializeGPRS(); // Initialize GPRS connection
  
  Serial.begin(115200);
  delay(100);
  
  WiFi.begin("your_ssid", "your_password"); // Connect to WiFi network
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  
  Serial.println("");
  Serial.println("WiFi connected");
  
  quectel_mqtt.InitializeMQTT(client, mqtt_server, mqtt_port, mqtt_username, mqtt_password); // Initialize MQTT connection
  quectel_mqtt.ConnectMQTT(client);
  }
  client.loop();
  
  // Publish a message to the MQTT broker
  char message[50];
  snprintf(message, 50, "Hello from Quectel SIM module!");
  client.publish(mqtt_topic, message);
  
  delay(5000); // Publish message every 5 seconds
}


Hope this helps
Was this page helpful?