AI A7 GSM/GPRS/GPS shield board, please help

I purchased this board and am not able to get GSM working. Shield Board

I’m hoping someone has already figured this board out and can help, I’m becoming convinced this board is very non-standard.

Unfortunately it does not come with any documentation, pin usage, libraries, or example code.

I have been successful getting GPS results that are correct when checked on Google maps.

Now I need to send text messages, and eventually emails. But no matter what I try it doesn’t seem like any of the commands are even making it to the board, many attempts just hang up on the first command.

I have worn Google out searching every which way I can think of to find information (including this forum)
I have found and tried several different libraries including the AiThinker_A7-master library from GIThub.
I’ve tried dozens of different code examples, all different approaches, some with libraries some plain code.

Every attempt seems to behave the same way.

I have not been able to find a definitive pin usage definition, some say 0-1, many say 7-8, there have even been a couple different ones I’ve come across. some say 0-1/7-8 for software/hardware serial, some do not

I’ve extensively tried the official included Arduino <GSM.h> library but it has compiler problems as discussed in these forums. My IDE version is 1.8.5 and it sounds like that may be a problem for this library.

I have also tried a separate power supply in addition to the IDE’s USB connection, as a youtube video I watched said this was critical.

I would post code, but I’ve tried so many different sketches (as found, and with attempts to modify) I’m thinking it’s not all a code problem.

Any help will be greatly appreciated

I'm sorry, I completely failed to mention I do have a SIM card and it is fully activated.
It's a Things Mobile SIM and it shows up as fully activated in my account dashboard.

I've reached out to them as well and even had them get back to me today for a question on the PIN number (yes on a Saturday!)

I've just sent them a link to this forum topic, hopefully some of the help they can provide will get posted here.

UPDATE:: Found some documentation

WIKI — https://makerfabs.com/wiki/index.php?title=GPRS_GSM_GPS_Shield_(AI-_A7)

I am now getting responses from the GSM module, but unfortunately I’m still not able to send a message. I’m getting a +CMS ERROR:500 after setting the phone number, message, and CTL-Z [(char)26]

Here’s the sketch…

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 8);
#include<stdio.h>
#include<string.h>
#define DEBUG true
 
void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
  delay(1000);
  int pon=3;
  int poff=9;
  int lowp=2;
  pinMode(pon, OUTPUT);
  pinMode(poff, OUTPUT);
  pinMode(lowp, OUTPUT);
  digitalWrite(poff, LOW);
  digitalWrite(lowp, HIGH);   
  digitalWrite(pon, HIGH);
  delay(3000); 
  digitalWrite(pon, LOW);
  delay(1000); 
  baudrate();
  //Serial.println(sendData("AT+GPS=1 ",1000,DEBUG));
   sendData("AT+CMGF=1",1000,DEBUG);
  Serial.println("After 3s, test begin!!");
  delay(3000);
}

void loop()
{
  boardTest();
  delay(5000);
}

void boardTest()
  {
   Serial.println("SMS Start");
   Serial.println((char)26);

//   sendData("AT+CPIN=\"1503\"",2000,DEBUG);
   sendData("AT+CPIN?",2000,DEBUG);
   sendData("AT+CMGF=1",1000,DEBUG);
   sendData("AT+CMGF?",3000,DEBUG);
   sendData("AT+CREG?",3000,DEBUG);
   sendData("AT+CMGS=12563129195",3000,DEBUG);
   sendData("hello from Arduino",3000,DEBUG);
//   sendData("\x1a",3000,DEBUG);
//   sendData("\x0D",3000,DEBUG);
//   sendData("\x0a",3000,DEBUG);
   sendData("CTLZ",3000,DEBUG);
   delay(3000);
   sendData("AT+CMGF=0",3000,DEBUG);
   delay(10000);

  Serial.println("SMS End");
  }


void baudrate()
{
      int i=0;
      for(i=0;i<10;i++)
      {
           String msg = String("");
           msg=sendData("AT",1000,DEBUG);
           if( msg.indexOf("ok") >= 0 ){
              return;
           }
      }
}

String sendData(String command, const int timeout, boolean debug)
{
    int done = 0;
    String response = "";  
    if(command=="CTLZ")   mySerial.println((char)26); else mySerial.println(command); 
    long int time = millis();   
    while( (time+timeout) > millis())
    {
      while(mySerial.available())
      {       
        char c = mySerial.read(); 
        response+=c;
      }  
    }    
    if(debug)
    {
      Serial.print(response);
    }    
    return response;
}

And here’s the serial monitor capture of the results…

SMS Start

AT+CPIN?

+CPIN:READY

OK
AT+CMGF=1

OK
AT+CMGF?

+CMGF: 1

OK
AT+CREG?

+CREG: 1,5

OK
AT+CMGS=12563129195

> hello from Arduino


+CMS ERROR:500
AT+CMGF=0

OK
SMS End

Can anyone see what I’m doing wrong?

I should have pointed out the CTL-Z is being sent from the sendData method:

sendData(String command, const int timeout, boolean debug)

if(command=="CTLZ")   mySerial.println((char)26); else mySerial.println(command);

All other commands were being sent as strings, so I felt this was the cleanest way

Does anyone know what I’m doing wrong?

#include <SoftwareSerial.h>

SoftwareSerial CelluarSerial(7, 8);
#include<stdio.h>
#include<string.h>
#define DEBUG true
 
void setup()
{
  Serial.begin(9600);
  CelluarSerial.begin(9600);
  delay(1000);
  int pon=3;
  int poff=9;
  int lowp=2;
  pinMode(pon, OUTPUT);
  pinMode(poff, OUTPUT);
  pinMode(lowp, OUTPUT);

  //power cycle the board - off
  
  digitalWrite(poff, HIGH);
  digitalWrite(lowp, LOW);   
  digitalWrite(pon, LOW);
  delay(5000);
  
  //power cycle the board - on
  
  digitalWrite(poff, LOW);
  digitalWrite(lowp, LOW);   
  digitalWrite(pon, HIGH);
  delay(1000); 
  digitalWrite(pon, LOW);
  baudrate();
  sendData("AT+CMGF=1",1000,DEBUG);
  Serial.println("After 5s, test begin!!");
  delay(5000);
}

void loop()
{
  boardTest();
  delay(5000);
}

void boardTest()
  {
   Serial.println("SMS Start");
   Serial.println((char)26);

//   sendData("AT+CPIN=\"1503\"",2000,DEBUG);
   sendData("AT+CPIN?",200,DEBUG);
   sendData("AT+CMGF=1",100,DEBUG);
   sendData("AT+CMGF?",300,DEBUG);
   sendData("AT+CREG?",300,DEBUG);
   sendData("AT+CMGS=+0012563129195;",100,DEBUG);
   sendData("hello from Arduino",100,DEBUG);
//   sendData("\x1a",300,DEBUG);
//   sendData("\x0D",300,DEBUG);
//   sendData("\x0a",300,DEBUG);
   sendData("CTLZ",300,DEBUG);
   delay(3000);
   sendData("AT+CMGF=0",300,DEBUG);
   delay(10000);

  Serial.println("SMS End");
  }


void baudrate()
{
      int i=0;
      for(i=0;i<100;i++)
      {
           String msg = String("");
           msg=sendData("AT",1000,DEBUG);
           Serial.println(msg);
           Serial.print("Counter: ");
           Serial.println(i);
           Serial.println(msg);
//           if( msg.indexOf("ok") >= 0 ){
           if(msg.indexOf("+CIEV: service,  1") >= 0 )
           {
            String c2i = (String)msg[18];
            int res= c2i.toInt();
            Serial.print("message value: ");
            Serial.println(res);
              if(res > 0) return;
           }
           delay(300);
      }
}

String sendData(String command, const int timeout, boolean debug)
{
    int done = 0;
    String response = "";  
    if(command=="CTLZ")   CelluarSerial.println((byte)26); else CelluarSerial.println(command); 
    long int time = millis();   
    while( (time+timeout) > millis())
    {
      while(CelluarSerial.available())
      {       
        char c = CelluarSerial.read(); 
        response+=c;
      }  
    }    
    if(debug)
    {
      Serial.print(response);
    }    
    return response;
}

I also read somewhere that I need an external power supply in addition to the USB connection, is this true?

yo estoy en el mismo problema ayuda por favor ya intente de todo como menciona el usuario anterior hasta intente utilizar software serial ara programar y nada ayuda por favor a alguien le funciono alguna vez un proyecto con este modulo asi como muestran en youtuve

Francisco16789:
yo estoy en el mismo problema ayuda por favor ya intente de todo como menciona el usuario anterior hasta intente utilizar software serial ara programar y nada ayuda por favor a alguien le funciono alguna vez un proyecto con este modulo asi como muestran en youtuve

Francisco16789,

Thank you for posting, I understand you are having the same problems I am having.

I "may" have come across some example code that will help. I plan on trying it out tonight.

it really looks promising, but I've been fooled before so I'd rather be sure it's helpful before posting the link. If it works out I will definitely post a link!

The code on the website I mentioned above didn't work either.

Out of frustration I tried sending a text to the Arduino from my phone and it worked

I'm communicating with the A7 board, the board is processing commands, and receives SMS messages just fine.

The only thing that makes sense at this point is that the actual send command in my code is wrong.

  • Wrong phone number format?

  • "AT+CMGS="+1xxxxxxxxxx""
    "AT+CMGS=+1xxxxxxxxxx"
    "AT+CMGS="xxxxxxxxxx""
    "AT+CMGS=xxxxxxxxxx"
    CTRL-Z

  • const byte bCTLZ = (byte)26;

  • CellularSerial.println(bCTLZ)

CellularSerial.println(0x1A)
CellularSerial.println("\x1A")

[/li]

[/list]

The whole CTRL-Z thing seems most likely because I've tried every combination of formats for the phone number and "+1xxxxxxxxxx" matches the incoming number format

Here is the serial monitor results with the incoming text message:

i⸮⸮iO⸮⸮⸮⸮;⸮⸮ ⸮E⸮⸮⸮⸮;⸮⸮ ⸮ꕕ⸮⸮⸮;⸮⸮ ⸮⸮t⸮.⸮⸮AT

OK

+CTZV:18/10/03,10:08:36,+01
After 3s, test begin!!

+CIEV: service,  1
+CIEV: roam, 1

+CREG: 5
AT+CMGF=1

OK
AT+CPIN?

+CPIN:READY

OK

+CIEV: "MESSAGE",1


+CMT: "+1xxxxxxxxxx",,"2018/10/03,05:08:37+05"
Hello to Arduino


AT+CNUM

+CNUM: "","+882360004036935",145

And my sketch here:

#include <SoftwareSerial.h>
#include <SoftwareSerial.h>

SoftwareSerial CellularSerial(7, 8);
#include<stdio.h>
#include<string.h>
#define DEBUG true

void setup()
{
  Serial.begin(9600);
  CellularSerial.begin(19200);
  delay(10000);
  int pon=3;
  int poff=9;
  int lowp=2;
  pinMode(pon, OUTPUT);
  pinMode(poff, OUTPUT);
  pinMode(lowp, OUTPUT);
  digitalWrite(poff, LOW);
  digitalWrite(lowp, HIGH);   
  digitalWrite(pon, HIGH);
  delay(3000); 
  digitalWrite(pon, LOW);
  sendData("AT ",1000,DEBUG);
  baudrate();
  Serial.println("After 3s, test begin!!");
  delay(3000);
  sendData("AT+CMGF=1",1000,DEBUG);
}

void loop()
{
//  Serial.println("Start of incoming message check");
//  Serial.println("===============================");
//      String input = "";
//      while(CellularSerial.available()>0)
//      {       
//        input = Serial.readString();
//      }  
//  Serial.print(input);
//  
//  Serial.println("=============================");
//  Serial.println("End of incoming message check");

//  sendData("AT+CMGF=1",1000,DEBUG);
  sendData("AT+CPIN?",1000,DEBUG);
  sendData("AT+CNUM",1000,DEBUG);
  sendData("AT+CMGF?",1000,DEBUG);
  sendData("AT+CREG?",1000,DEBUG);
  sendData("AT+CMGS=\"+12563129195\"",1000,DEBUG);
  //delay(3000);
  sendData("hello from Arduino",1000,DEBUG);
  sendData("0x1A",1000,DEBUG);
  //sendData("AT+CMGS?",1000,DEBUG);
   delay(10000);
//  sendData("AT+CMGF=0",1000,DEBUG);
//   delay(10000);
}
void baudrate()
{
      int i=0;
      for(i=0;i<10;i++)
      {
           String msg = String("");
           msg=sendData("AT",2000,DEBUG);
           if( msg.indexOf("OK") >= 0 ){
              return;
           }
      }
}

String sendData(String command, const int timeout, boolean debug)
{
    String response = "";    
    if(command=="0x1A")
    {
      CellularSerial.println(0x1A); 
      //CellularSerial.println(0x0D);
    } 
    else CellularSerial.println(command);
    long int time = millis();   
    while( (time+timeout) > millis())
    {
      while(CellularSerial.available())
      {       
        char c = CellularSerial.read(); 
        response+=c;
      }  
    }    
    if(debug)
    {
      Serial.print(response);
    }    
    return response;
}

This discussion is moving to the “Programming Questions” area of the forum here: https://forum.arduino.cc/index.php?topic=571590.0