IOT-MCU / ESP-12S-A9-A9G-GPRS-Node-v1.0

63 stars 27 forks source link

No Response from A9G Module #19

Open ayazurrehman786 opened 3 years ago

ayazurrehman786 commented 3 years ago

I m running ESP-12S_A9G_TEST.ino but there is no response from A9G. This is what I am getting on Serial Monitor:

image

IOT-MCU commented 3 years ago

Hi dear, Do you power it via a 3.7V lipo battery? According the the serial print, the A9G no power on. so it cannot reback any AT command.

deejonur commented 3 years ago

So? What should we do? I have the same problem. I really hated your board in last 2 days. I will not use this product.

Also your A9 firmware update software and tools' web links are not working. You r server connections are too slow. Bad customer service and bass quality.

ayazurrehman786 commented 3 years ago

Use the below code: its working fine and make sure youconnect 3.7V Litium Battery which is use to Power A9G module

`#include

include

include

define DEBUG true

int PWR_KEY = 16; int RST_KEY = 15; int LOW_PWR_KEY = 2;

SoftwareSerial swSer(14, 12, false, 256);

bool Power_ON = false;

void setup() { Serial.begin(9600); swSer.begin(9600); pinMode(PWR_KEY, OUTPUT); pinMode(RST_KEY, OUTPUT); pinMode(LOW_PWR_KEY, OUTPUT);

digitalWrite(RST_KEY, LOW); digitalWrite(LOW_PWR_KEY, HIGH); digitalWrite(PWR_KEY, HIGH);

Serial.println("Calling Module State function"); moduleStateCheck();

if (Power_ON == false) //check if it's off { Serial.println("Module is OFF"); } else { Serial.println("Maduino A9/A9G Test Begin!"); delay(5000); sendData("ATE0", 1000, DEBUG); //GSM Test etisalat.ae //sendData("AT+CCID", 3000, DEBUG); //get SIM sendData("AT+CREG?", 3000, DEBUG); sendData("AT+CGATT=1", 3000, DEBUG); sendData("AT+CGDCONT=1,\"IP\",\"mnet\"", 1000, DEBUG); //Put your APN instead of mnet sendData("AT+CGACT=1,1", 3000, DEBUG); //sendData("AT+CSQ", 1000, DEBUG);

String cmdString = "AT+HTTPGET=\"YOUR URL\"";
sendData(cmdString, 7000, DEBUG);
cmdString = "AT+HTTPGET=\"YOUR URL\"";
sendData(cmdString, 5000, DEBUG);

} }

void loop() { while (swSer.available() > 0) { Serial.write(swSer.read()); yield(); } while (Serial.available() > 0) { swSer.write(Serial.read()); yield(); } delay(1); }

void moduleStateCheck() { Serial.println("Module State Check"); int i = 0;

digitalWrite(PWR_KEY, LOW); delay(3000); digitalWrite(PWR_KEY, HIGH); delay(100);

bool moduleState = false; for (i = 0; i < 3; i++) { delay(100); Serial.println(); Serial.println(); Serial.println("***"); Serial.print("Value of i: "); Serial.println(i); String msg = "";

msg = sendData("AT", 1000, DEBUG);

if (msg.indexOf("OK") >= 0)
{
  Serial.println("A9/A9G Module had turned on.");
  Power_ON = true;
}
delay(1000);

} }

String sendData(String command, const int timeout, boolean debug) { String response = ""; Serial.print("Command Sent: "); Serial.println(command); swSer.println(command);

long int time = millis(); while ((time + timeout) > millis()) { while (swSer.available()) { char c = swSer.read(); response += c; //Serial.print(c); delay(1); } delay(100); } if (debug) { Serial.print("A9G Response: "); Serial.println(response); } return response; }`

chesterrush commented 3 years ago

Could you fix the bug?

deejonur commented 3 years ago

Could you fix the bug?

I stopped working with that module. I could not fix the problem.

chesterrush commented 3 years ago

Have you try to soft restart the modul or the board if it doesn't work?

if (Power_ON == false) //check if it's off
{
Serial.println("Module is OFF");
}
else
{
A9GPOWEROFF()
delay(2000)
A9GPOWERON()
}
int A9GPOWERON()
{
      digitalWrite(A9G_PON, LOW);
      delay(3000);
      digitalWrite(A9G_PON, HIGH);
      delay(5000);
      String msg = String("");
      msg=sendData("AT",1000,DEBUG);
      if( msg.indexOf("ok") >= 0 ){
          Serial.println("GET OK");
          return 1;
      }
      else {
         Serial.println("NOT GET OK");
         return 0;
      }
}

int A9GPOWEROFF()
{
      digitalWrite(A9G_POFF, HIGH);
      delay(3000);
      digitalWrite(A9G_POFF, LOW);
      delay(5000);
      String msg = String("");
      msg=sendData("AT",1000,DEBUG);
      if( msg.indexOf("ok") >= 0 ){
          Serial.println("GET OK");
          return 1;
      }
      else {
          Serial.println("NOT GET OK");
          return 0;
      }
}
deejonur commented 3 years ago

Have you try to soft restart the modul or the board if it doesn't work?

if (Power_ON == false) //check if it's off
{
Serial.println("Module is OFF");
}
else
{
A9GPOWEROFF()
delay(2000)
A9GPOWERON()
}
int A9GPOWERON()
{
      digitalWrite(A9G_PON, LOW);
      delay(3000);
      digitalWrite(A9G_PON, HIGH);
      delay(5000);
      String msg = String("");
      msg=sendData("AT",1000,DEBUG);
      if( msg.indexOf("ok") >= 0 ){
          Serial.println("GET OK");
          return 1;
      }
      else {
         Serial.println("NOT GET OK");
         return 0;
      }
}

int A9GPOWEROFF()
{
      digitalWrite(A9G_POFF, HIGH);
      delay(3000);
      digitalWrite(A9G_POFF, LOW);
      delay(5000);
      String msg = String("");
      msg=sendData("AT",1000,DEBUG);
      if( msg.indexOf("ok") >= 0 ){
          Serial.println("GET OK");
          return 1;
      }
      else {
          Serial.println("NOT GET OK");
          return 0;
      }
}

I had tried so many things at that time. I do not remember now. As I said, I did not choose this module to work with. I am working with Quectel M66 & ESP32-WROOM-32UE now.

leifnel commented 3 years ago

To make it clear, is it true the GPS does not work without a battery?

ayazurrehman786 commented 3 years ago

To make it clear, is it true the GPS does not work without a battery?

Yes, you need to have Lithium 3.7V battery Connected to run A9G GSM/GPS Module.

deejonur commented 3 years ago

To make it clear, is it true the GPS does not work without a battery?

It didn't work for me even if it had a 3.7V battery.

ayazurrehman786 commented 3 years ago

Below code should work, its tested,

` //NodeMCU ESP8266 ESP12S A9G Module

include

include

define DEBUG true

define BAUD_RATE 115200

/***/

define A9G_PON 16 //ESP12 GPIO16 A9/A9G POWON

define A9G_POFF 15 //ESP12 GPIO15 A9/A9G POWOFF

define A9G_WAKE 13 //ESP12 GPIO13 A9/A9G WAKE

define A9G_LOWP 2 //ESP12 GPIO2 A9/A9G ENTER LOW POWER MODULE

void handleInterrupt(); void SendTextMessage(String message, String phonenum); int A9GPOWERON();

/***/

SoftwareSerial swSer(14, 12, false, 1024); //(RX = GPIO14(D5), TX= GPIO12(D6), inverse_logic, buffer size); void setup() { Serial.begin(BAUD_RATE); swSer.begin(BAUD_RATE);

for (char ch = ' '; ch <= 'z'; ch++) { swSer.write(ch); } swSer.println(""); delay(500);

/****/ pinMode(A9G_PON, OUTPUT);//LOW LEVEL ACTIVE pinMode(A9G_POFF, OUTPUT);//HIGH LEVEL ACTIVE pinMode(A9G_LOWP, OUTPUT);//LOW LEVEL ACTIVE

digitalWrite(A9G_PON, HIGH); // Keep A9G OFF(high) initially digitalWrite(A9G_POFF, LOW); digitalWrite(A9G_LOWP, HIGH);

Serial.println("Turning ON A9G..."); Serial.println();

if (A9GPOWERON() == 1) { Serial.println("A9G POWER ON."); Serial.println(); }

// sendData("AT+RST=1", 1000, DEBUG); //Software reset // delay(500); sendData("ATE0", 1000, DEBUG); //GSM Test etisalat.ae sendData("AT+CGSN", 3000, DEBUG); //IMEI No. sendData("AT+CREG?", 3000, DEBUG); sendData("AT+CGATT=1", 3000, DEBUG); sendData("AT+CGDCONT=1,\"IP\",\"mnet\"", 1000, DEBUG); sendData("AT+CGACT=1,1", 3000, DEBUG); //sendData("AT+CSQ", 1000, DEBUG);

}

void loop() { while (swSer.available()) { Serial.write(swSer.read()); // yield(); } while (Serial.available()) { swSer.write(Serial.read()); // yield(); }

}

String sendData(String command, const int timeout, boolean debug) { String response = ""; Serial.print("Command Sent: "); Serial.println(command); swSer.println(command);

long int time = millis(); while ((time + timeout) > millis()) { while (swSer.available()) { char c = swSer.read(); response += c; //Serial.print(c); delay(1); } delay(100); } if (debug) { Serial.print("A9G Response: "); Serial.println(response); } return response; }

int A9GPOWERON() //Send Command to A9G to Turn ON { digitalWrite(A9G_PON, LOW); delay(3000); digitalWrite(A9G_PON, HIGH); delay(5000); String msg = String(""); label: msg = sendData("AT", 2000, DEBUG); if ( msg.indexOf("OK") >= 0 ) { Serial.println("Power ON"); Serial.println(); return 1; } else { Serial.println("Waiting for Power ON..."); Serial.println(); goto label; //If NOT GET OK GOTO label return 0; } }`

ayazurrehman786 commented 3 years ago

To make it clear, is it true the GPS does not work without a battery?

It didn't work for me even if it had a 3.7V battery.

Send me your code, i will check