Go Down

Topic: GPS vs Ai Thinker A7 module (Read 33785 times) previous topic - next topic


Hi guys. Your discussion is helping us a lot. Thanks to all of you. Well, so far we are good with the connections between A7 module and Arduino Uno. How about that GPS pin in module? How we connect this? So that we might be  able to get a GPS access from the module Or we may start GPS communication between arduino and A7 module..

Thanks in advance.  :smiley:
You can connect it to arduino RX pin with baud rate of 9600.
Please note that this module uses 3.3 volt, reading those on arduino UNO, Nano, or any other 5 volt variant will produce random characters.


You have finally find it as i see.

First you send an AT+GPS=1 command and then an
AT+GPSRD=1 command


you may notice that if you open and close the gps many times, it stops responding
so if we say that you do
.... (more code here)

and you do this again and again. you will notice that the AT+GPS stops working (lets say after 30-50 openings and closings).

This is one problem.

The second one and here please give me some help if you can.
I see that even if the AT+GPSRD=1 gives OK, it is not reliable to keep working if you don't get a response that has NMEA data in it, so after the AT+GPSRD=1 you should expect in the reply the string "+GPSRD:"

But as it seems, i cant get the "+GPSRD:" in a response every time i execute the AT+GPSRD=1, some times i get only the OK (but as i told you before, this is not OK, since i can't get a reliable location then, i use the NeoGPS library to get a valid's location parsed data)

And my third problem.

I can't open the AGPS
whenever i sent AT+AGPS=1, i get an error.
I don't know how this works, i've already tried to contact AIthinker but nothing there, i got no response to my emails till now.

from my knowledge, other chips, need to have a connection to a server for AGPS to work (since it needs to download the data from a server) but the manual of A7 doesn't note anything like this.

If you have managed to open AGPS i would be grateful to hear your solution.


Now what i think you should do in case of receiving a call or an sms while you work .
See "ATS0 automatic answering" chapter 2.3 in the manual, i believe that i believe that the ATS0=0 is the answer, but i haven't tested this yet. If this does not work, i believe that you should manage your code to deal with situations like receiving an sms or a call and close it before you do anything else.


for the following, i would suggest you to work with a library, if you start to parce the NMEA data on your own, it is normal to have an error on the location you get, since the gps still syncs. Even in case of a library you will get an error at first points you will get, this will be reduces if you keep GPS open. The solution to this is to work with AGPS, with it you will get your first location allot faster and more accurate. In case you search it and have a solution on how to work with it mistery please remember me :)

I have A7 module, and it is working, but it gives me wrong GPS data so I needed to use offset to get it on track.
for init you need to
power module up
Print AT wait some time for OK response
wait for 10 sec while reading serial to check if it is all ok
If all ok
send "AT+GPS=1" to module

and then data on GPS TX will start showing up


Hello Guys,

Can anyone help me starting with an A7 module? I tried to do a simple test, connecting to 5V, GND, a TTL to usb serial, but modul seems to do nothing when I tried to star it by pressing power butom more than 2 secs. What am I doing wrong?




Hi, trying and trying, had life signals, by connecting RST to PWR pin....


Hello Guys,
 I noticed the power suply for GPS antenna is only 1.8Vdc. A common 3.3V antenna will work? Is ther a workaround to increase antenna suply voltage? Regards!


May 26, 2017, 09:03 pm Last Edit: May 26, 2017, 09:27 pm by FrankCA
I have recently started using the Elecrow A7 shield, and related to this post re. GPS, I found that the Elecrow shield does not connect the A7 module's GPS_TXD pin (pin 37) to anything. See here for Eagle files.

It may be possible that the GPS_TXD data is somehow available through the UART port but given the poor documentation and lack of support for the A7 I may have missed it. I have a query pending with Elecrow and will post any responses here.

Edit: ok so the trick is in slink21's post #16 - should have tried that before posting!
This sequence enables GPS data out of the UART port at 115200 baud.


This sequence enables GPS data out of the UART port at 115200 baud.
yeap, this will work.

If anyone succeeded to open the AGPS, please help.



I have used AT+GPSRD=1 and it freezes the device

If you type AT+GPSRD=? the possible values are from 0 to 3600 it looks like that are the seconds to send the GPS read automatically

Any idea ?


AT+AGPS=1 same error like other people said

Any idea ?


Hi @PieterE

I've just bought the same module as you.

Would you mind sharing your cabling and code for both SMS and GPS?

There was no guide coming up with the A7 module :-(

Thank you


I made the AGPS work
this is the code follow the AT commands and replace the APN with your own

A7command("AT+GPSRD=0","OK","yy",GF,1, NULL);
A7command("AT+CGATT=1", "OK", "yy", 20000, 3, NULL);
A7command("AT+CGDCONT=1,\"IP\",\"" + APN + "\"", "OK", "yy", 20000, 2, NULL); //bring up wireless connection with APN     
A7command("AT+CGACT=1,1", "OK", "yy", 20000, 2, NULL);
A7command("AT+AGPS=1", "OK", "yy", 20000, 3, NULL);


Could you please share the details about level shifter and suggest some one for arduino UNO?



your library sounds elegant but I struggle using it as the GPRS+GPS A7 module has multiple TX & RX pins but the one we are interested in are:

U_TXD --> used for AT commands
U_RXD --> used for AT commands

GPS_TXD --> used to get GPS infos

Where do I connect GPS_TXD to and how do I get the information coming from this pin? There is a lot of answer in this thread but none answer this question.

I've got this model : WHDTS A7 GSM+GPRS+GPS

and I could only get the SMS feature to work, the example provided by the seller is only for the Arduino Mega and it does not work on the UNO.


Where do I connect GPS_TXD to and how do I get the information coming from this pin?
You must connect it to an Arduino pin that has a hardware serial port or a software serial port.

For example, you might connect GPS_TXD to Serial pin 0 or the Serial1 receive pin.  This depends on which Arduino you are using.

Here is a description of how to choose a serial port, ordered from best to worst.  SoftwareSerial is the worst.

Then you pass that serial port variable to the gps.available method:

    if (gps.available( gpsPort )) {
        fix = gps.read();

This NeoGPS method parses GPS data from that port and returns true when a complete fix structure is ready.  That structure contains all GPS fields received during that update interval (usually one second).
Really, I used to be /dev.  :(


Hi all, i am newbies on arduino and i want make some tool's for my thesis, hope somebody can help me to solved my problem, and here the feature hope i can to created :

- when i send sms to number on module a7 example : "GIVE ME POSITION"

and then the a7 module can send current or last position to my number with a link that can be opened by google map or other map.

- when i send sms to number on module a7 example : "TRUN OFF THE LIGHT"

and then relay will trun off the light or lamp.

here my tools :

- Arduino Uno
- relay 2 channel
and some other stuff like, breadboard cable jumper male,female.

and here the config :

Ai A7 ------ Arduino Uno
U_TXD ==> PIN 10
U_RXD ==> PIN 11
GND    ==> GND

power arduino uno use with usb cable
power ai a7 with external power (adaptor 9v) and here is my a7-module

i've been looking couple days for module a7 but i stil have not found how to use this module
i was try some example code from other forum but still not work and i try to follow the code from this forum on thread #10 about how to use gps with a7 module.

and these last code i try but gps data still not showing, i follow these code from this thread #10
i am really sorry if there any mistake or wrong setting to make this tools, hopefully somebody can help me out and thank you in advance for your help.

Code: [Select]
#include <NMEAGPS.h>

//#define A7board Serial  // Best would be to connect to the Serial pins 0 & 1
//      or
//#include <AltSoftSerial.h>
//AltSoftSerial A7board; //Next best, but you must use pins 8 & 9!  This is very efficient.
//      or

#include <NeoSWSerial.h>
NeoSWSerial A7board( 10, 11 ); // 2nd best on whatever two pins you want.  Almost as efficient.
// DO NOT USE SoftwareSerial!

gps_fix fix;

state_t state = WAITING;
uint32_t stateTime;
const uint32_t CHECK_LOCATION_TIME = 5000; // ms

void echoA7chars()
  while (A7board.available())
    Serial.write( A7board.read() ); // just echo what we are receiving

void ignoreA7chars()
  while (A7board.available())
    A7board.read(); // ignore what we are receiving

void setup()
  Serial.begin( 115200 );
  A7board.begin( 115200 );

void loop()
  switch (state) {

    case WAITING:

      if (millis() - stateTime >= CHECK_LOCATION_TIME) {

        // Turn GPS data on
        A7board.println( F("AT+GPS=1") );

        stateTime = millis();
        state     = GPS_ON_WAIT;

    case GPS_ON_WAIT:

      // Wait for the GPS to turn on and acquire a fix
      if (millis() - stateTime >= 5000) { // 5 seconds

        //  Request GPS data
        A7board.println( F("AT+GPSRD=1") );
        Serial.print( F("Waiting for GPS fix...") );

        stateTime = millis();
        state     = GPS_READING;

    case GPS_READING:
      while (gps.available( A7board )) { // parse the NMEA data
        fix = gps.read(); // this structure now contains all the GPS fields

        if (fix.valid.location) {

          // Now that we have a fix, turn GPS mode off
          A7board.println(  F("AT+GPSRD=0") );

          stateTime = millis();
          state     = GPS_READING_WAIT;

      if (millis() - stateTime > 1000) {
        Serial.print( '.' ); // if still waiting for fix, print a dot.
        stateTime = millis();


      // Wait for the GPS data to stop
      if (millis() - stateTime >= 1000) {

        // Turn GPS power off
        A7board.println(  F("AT+GPS=0") );

        stateTime = millis();
        state     = GPS_OFF_WAIT;

    case GPS_OFF_WAIT:

      // Wait for the GPS to power off
      if (millis() - stateTime >= 1000) {

        // Show the location we will send via SMS
        Serial.print( F("loc: ") );
        Serial.print( fix.latitude(), 6 ); // use the latitude field of the fix structure
        Serial.print( F(", ") );
        Serial.println( fix.longitude(), 6 ); // use the longitude field of the fix structure

        // Send SMS with location values ?
        //A7board.print( SMS commands? );
        //A7board.print( F("lat=") );
        //A7board.print( fix.latitude(), 6 ); // use the latitude field of the fix structure
        //  ...

        stateTime = millis();
        state     = SENDING_SMS;
    case SENDING_SMS:

      if (millis() - stateTime >= 2000) {
        stateTime = millis();
        state     = WAITING; // start over


Go Up