A7672S GSM module AT commands error

Hello Experts help me out I don't no why I am not able to hit my request I got HTTPACTION: 1,714,0 am not able to hit my API I am using Node.js localhost server. Please solve my issue
Thanks in advance.

#include <stdio.h>
#include <string.h>
#include <DHT.h>

#define DEBUG true
#define RXD2 27    // VVM501 MODULE RXD INTERNALLY CONNECTED
#define TXD2 26    // VVM501 MODULE TXD INTERNALLY CONNECTED
#define powerPin 4 // VVM501 MODULE ESP32 PIN D4 CONNECTED TO POWER PIN OF A7670C CHIPSET, INTERNALLY CONNECTED
#define Sensor_PIN 5  // D15-DHT22 CONNECT EXTERNALLY

DHT dht(Sensor_PIN, DHT22);

#define SerialAT Serial1
String rxString;
void setup() {
  pinMode(powerPin, OUTPUT);
  digitalWrite(powerPin, LOW);
  Serial.begin(115200);
  delay(100);
  SerialAT.begin(115200, SERIAL_8N1, RXD2, TXD2);
  delay(10000);  // WAITING FOR MODEM RESET
  dht.begin();
  delay(2000);

  Serial.println("Modem initialized, Please Wait");
  delay(20000); // Increased delay for initialization
  rxString = SerialAT.readString();
  Serial.print("Got: ");
  Serial.println(rxString);
  if (rxString.indexOf("OK") == -1 && rxString.indexOf("*ATREADY: 1") == -1) {
    Serial.println("Modem initialization failed.");
    return;
  }
  Serial.println("Modem initialization successful.");

  SerialAT.flush();

  Serial.println("Echo Off");
  SerialAT.println("ATE0");
  delay(1000);
  rxString = SerialAT.readString();
  Serial.print("Got: ");
  Serial.println(rxString);
  if (rxString.indexOf("OK") == -1) {
    Serial.println("Failed to turn off echo.");
    return;
  }
  Serial.println("Echo off successful.");

  Serial.println("SIM card check");
  SerialAT.println("AT+CPIN?");
  delay(2000);  // Increased delay to ensure response is received
  rxString = SerialAT.readString();
  Serial.print("Got: ");
  Serial.println(rxString);
  if (rxString.indexOf("+CPIN: READY") == -1) {
    Serial.println("SIM card not ready.");
    return;
  }
  Serial.println("SIM Card Ready");

  Serial.println("4G HTTP Test Begin!");
  delay(1000);
}

void loop() {
  //--------Get temperature and humidity-------------
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // Check if any reads failed and exit early (to try again)
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.println("%");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println("*C");

  delay(1000); // Added delay to ensure the data is logged

  //-----------HTTP---------------------
  String http_str = "AT+HTTPPARA=\"URL\",\"http://192.168.1.238:3000/getdata?temperature=" + String(t) + "&humidity=" + String(h) + "\"\r\n";
  
  Serial.println(http_str);

  SerialAT.println("AT+HTTPINIT");
  delay(1000);
  rxString = SerialAT.readString();
  Serial.print("HTTPINIT: ");
  Serial.println(rxString);
  if (rxString.indexOf("OK") == -1) {
    Serial.println("Failed to initialize HTTP.");
    return;
  }

  SerialAT.println(http_str);
  delay(1000);
  rxString = SerialAT.readString();
  Serial.print("HTTPPARA: ");
  Serial.println(rxString);
  if (rxString.indexOf("OK") == -1) {
    Serial.println("Failed to set HTTP parameters.");
    return;
  }

  SerialAT.println("AT+HTTPACTION=1");
  delay(5000);
  rxString = SerialAT.readString();
  Serial.print("HTTPACTION: ");
  Serial.println(rxString);
  if (rxString.indexOf("+HTTPACTION: 1") == -1) {
    Serial.println("HTTP action failed.");
    return;
  }

  SerialAT.println("AT+HTTPREAD");
  delay(2000);
  rxString = SerialAT.readString();
  Serial.print("HTTPREAD: ");
  Serial.println(rxString);

  SerialAT.println("AT+HTTPTERM");
  delay(1000);
  rxString = SerialAT.readString();
  Serial.print("HTTPTERM: ");
  Serial.println(rxString);

  delay(7000); // Wait before next loop iteration
}

here is my response which I got
17:38:03.648 ->

17:38:05.629 -> HTTPPARA:

17:38:05.629 -> OK

17:38:05.629 ->

17:38:11.612 -> HTTPACTION:

17:38:11.612 -> OK

17:38:11.612 ->

17:38:11.612 -> HTTP action failed.

17:38:11.612 -> Humidity: 57.70%

17:38:11.612 -> Temperature: 26.50*C

17:38:12.610 -> AT+HTTPPARA="URL","http://192.168.1.238:3000/getdata?temperature=26.50&humidity=57.70"

17:38:12.656 ->

17:38:14.638 -> HTTPINIT:

17:38:14.638 -> ERROR

17:38:14.638 ->

17:38:14.638 -> Failed to initialize HTTP.

17:38:14.638 -> Humidity: 57.60%

17:38:14.638 -> Temperature: 26.40*C

17:38:15.636 -> AT+HTTPPARA="URL","http://192.168.1.238:3000/getdata?temperature=26.40&humidity=57.60"

17:38:15.637 ->

17:38:17.897 -> HTTPINIT:

17:38:17.897 -> ERROR

17:38:17.897 ->

17:38:17.897 -> +HTTPACTION: 1,714,0

17:38:17.897 ->

17:38:17.897 -> Failed to initialize HTTP.

17:38:17.897 -> Humidity: 57.60%

17:38:17.897 -> Temperature: 26.40*C

17:38:18.906 -> AT+HTTPPARA="URL","http://192.168.1.238:3000/getdata?temperature=26.40&humidity=57.60"

17:38:18.906 ->

17:38:20.879 -> HTTPINIT:

17:38:20.879 -> ERROR

Is your power supply sufficient for the GSM module?

1 Like

actually I don't know about it i have power my board using cpu com port and I am very new to arduino.

is this error is related to power supply ?

It's possible to see different errors due to a lower power supply than needed. Kindly check the voltage and current ratings of the GSM module.

my code looks fine or what ??If any mistake i made please tell me?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.