A9G GSM/GPRS+GPS Module Wiki - DFRobot

Introduction

A9G is a complete quad-band GSM/GPRS+GPS module based on the RDA8955 chip. The cost reduction of the core chip provides users with a cost-effective IoT solution. Integrating protocol stacks such as GSM/GPRS inside, this module supports the basic phone voice call/SMS, serial to GPRS and GPS data transmission functions, which can be used in a wide range of applications, such as IoT, vehicle-mounted equipment, remote localization, electric power environment monitoring.

Only one mobile phone card or Internet of Things card is needed to enable the device to have information transmission functions such as GPRS/GPS/ SMS/voice call, A9G could also work with other devices by AT command. Besides, the module comes with 29 GPIOs and integrated SDK that could greatly facilitate private redevelopment.

Specification

Board Overview

Board Overview

Tutorial

Requirements

This module adopts Micro SIM card.

Micro SIM card

Connection Diagram

The module uses AT firmware. Connect the module to USB-TTL via 4 wires and debug it on a computer: VUSB→5V; GND→GND; TX1→RX; RX1→TX.

Connection Diagram

AT Command Operation

1. Module Software Reset and Power off

AT+RST=X //X=1 software reset,X=2 power off

Example:

AT+RST=1 //Software reset
Init...
+CREG: 2
+CTZV:18/03/30,06:59:43,+08
+CREG: 1
+CTZV:18/03/30,06:59:44,+08
OK
A9/A9G
V02.00.20180327RC
Ai_Thinker_Co.LTD
READY

2. Phone Call Receive

Command: ATDxxxxx;//xxx represents phone number

Calling Example:

ATD10086
OK
+CIEV: "CALL",1
+CIEV: "SOUNDER",1    //ring
+CIEV: "SOUNDER",0    //hang up
+CIEV: "CALL",0
BUSY//BUSY

Phone Call Receiving:

( If you want to use the call reminder function, please use AT+CLIP=1; Please note that this function must be provided with your SIM card.)
RING
RING

SMS Setup

Command:

AT+CPMS="SM","SM","SM" //Set message storage unit
AT+CMGF=0/1 //Set format, 1 for txt, 0 for pud
AT+CMGR=x //Read message content, x for the serial number of the message
AT+CMGL=4/"ALL" //Check message list, if it is PUD format, send AT+CMGL=4, if txt, send AT+CMGL="ALL"
AT+CMGD=1 //Delete message. If AT+CMGD=1,4 , delete all messages.

Example:

AT+CPMS="SM","SM","SM"    //Set message storage unit, and you can also check message capacity 
+CPMS: 0,50,0,50,0,50
OK

AT+CMGF=1        //Set to txt format reading
OK
+CIEV: "MESSAGE",1    //Receive message, including phone number, time and content 
+CMT: "+86xxxxxxxxxxx",,"2017/10/09,09:14:52+08"
111
+CIEV: "MESSAGE",1
+CMT: "+86xxxxxxxxxxx",,"2017/10/09,09:16:25+08"
222
AT+CMGF=0        //Set to pud format receiving
OK

+CIEV: "MESSAGE",1    //Receive message in pud, including phone number, time and content 
+CMT: ,23
0891683110602305F0240D91687186935218F500007101909061452303B3D90C

+CIEV: "MESSAGE",1
+CMT: ,23
0891683110602305F0240D91687186935218F500007101909071202303341A0D
AT+CMGL=4        //List all messages->  pud format, parameter should be 4 when using this command 
+CMGL: 1,1,,23
0891683110602305F0240D91687186935218F500007101909041252303B1580C
+CMGL: 2,1,,23
0891683110602305F0240D91687186935218F50000710190906152230332990C
+CMGL: 3,1,,23
0891683110602305F0240D91687186935218F500007101909061452303B3D90C
+CMGL: 4,1,,23
0891683110602305F0240D91687186935218F500007101909071202303341A0D
OK
AT+CMGF=1        //Set to txt format reading 
OK
AT+CMGL="ALL"    //List all messages->  txt format, parameter should be "ALl" when using this command 
+CMGL: 1,"REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:14:52+08"
111
+CMGL: 2,"REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:16:25+08"
222
+CMGL: 3,"REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:16:54+08"
333
+CMGL: 4,"REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:17:02+08"
444
OK
AT+CMGR=1        //Read the first message 
+CMGR: "REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:14:52+08"
111
OK
AT+CMGR=2        //Read the second message 
+CMGR: "REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:16:25+08"
222
OK
AT+CMGR=3        //Read the third message 
+CMGR: "REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:16:54+08"
333
AT+CMGD=1        //Delete the first message 
OK
AT+CMGD=2        //Delete the second message. Note: After deleting the first message, the second message will not automatically run to the position of the first one, but still occupy the place of the second message. When all the messages are deleted and a new message is received, then it will be automatically arranged to the position of the first message.
OK
AT+CMGD=3        //Delete the third message
OK
AT+CPMS="SM","SM","SM"    //Check message capacity 
+CPMS: 1,50,1,50,1,50
OK
AT+CMGL="ALL"    //After deleting 3 messages, check the message list, there will be only 1 message
+CMGL: 4,"REC READ","+86xxxxxxxxxxx",,"2017/10/09,09:17:02+08"
444
OK
AT+CMGD=1,4        //Delete all messages
OK
AT+CMGF=1    //Send in text 
AT+CMGS="xxxxxxxxxxx(phone number)"   //Return >, then input the txt content to be sent, send data, then please cancel "Send a new line", and tick "HEX" option, finally send 0x1a.

4. Base Station Location (Including Simplified Commands)

Command:

AT+CREG? //Query the registration status of the network
At+LOCATION=X(Simplified Version)

Note: when using base station location function, please first operate AT+CGATT=1; AT+CGDCONT=1,"IP","cmnet" ;AT+CGACT=1,1; the three commands can only be executed after the network attachment and activation are completed.

Example:

Original Command

AT+CREG=1   //When =1, check network status, default to 1 when module powered on. 
OK
AT+CREG?
+CREG: 1,1     
AT+CREG=2   //When =2, base station location 
OK
AT+CREG?    
+CREG: 2,1,"xxxx","xxxx",2  //The parameters should be in hexadecimal. The first char string is LAC, the second one is CI. 
Please find a suitable website for base station location by yourself.
Simplified Command->Use AT+LOCATION=1 independently, do not need to set AT+CREG=2,
AT+LOCATION=1(return:<latitude>,<longitude>OK)
xx.xxxxx,xxx.xxxxxx(fixed 6 digits after the decimal point)
OK  
Directly return latitude and longitude without conversion
->at+location This command needs to be executed with network connected to your computer since it has to get location information. And the time it spends will rely on the quality of network. Besides that, if the attachment activation is not done manually, it will be done automatically and the time will be longer.So if you want to get reliable and fast result, please first use at+cgatt=1; at+cgdcont=1,"IP","cmnet" ;at+cgact=1,1; to complete attachment activation and make sure there is always good network connected.

5. Get Time from Base Station

Command: AT+CCLK?

Command Analysis: this command is processed internally. When the moddule is initialized, and get time from base station, the time will be saved into RTC register of the chip, and it can be read by using AT+CCLK?.

Note: Unicom card may cannot get correct time.

Example:

AT+CCLK ?
+CCLK: "17/10/07,02:50:55+08"    //The time is zero time zone, 2:50:55 on October 7, 2017. +08 is the time zone. We are in east eight zone, so the local time is 10:50:55

OK

6. HTTP

Command:

AT+HTTPGET= //Univeral resource identifier, domin name or IP address
AT+HTTPPOST=,, // : the type of network file and the content type of webpage coding
// : body text

Example:

AT+CGATT=1  //Attach network, this command is necessary if the Internet is needed.
+CGATT:1
OK

AT+CGDCONT=1,"IP","CMNET" //Set PDP parameter
OK

AT+CGACT=1,1 //Activate PDP, can access to Internet when activated properly 
OK

AT+HTTPGET="https://www.dfrobot.com"    //Connect to the site and request site resources
OK
Accept server responded information 

GPS Location

Command:

AT+GPS=1 //Turn on GPS
AT+GPS=0 //Turn off GPS
AT+GPS? //Check GPS status
AT+GPSRD=N, //N is a number, represents a NEMA message is output from AT serial every N seconds
AT+LOCATION=X //X=1 get base station address, X=2 get GPS address

Note: After the GPS is turned on, the module's GPS_ TXD will output positioning information by default at 9600 baud rate, which does not affect the baud rate of the whole module. For example, the working baud rate of A9G module is 115200. Send AT command to turn on GPS. At this time, GPS_ TXD will output information at 9600 baud rate, and the AT serial port is still 115200.

In addition, please note that the positioning information will output GNGGA GNRMC instead of GPGGA and GPRMC. The module uses a hybrid positioning system, including GPS, BDS and GNNS (Global Navigation System). The composition of the output information header, for example, GPGGA should be divided into GP + GGA-> positioning system + output data type. GP is GPS positioning system, GGA is output information of time, position and number of satellites. Similarly, GNGGA is GN + GGA-> positioning system + output data type. GN is global navigation system, GGA is output information of time, position and number of satellites. Other instructions are as follows.

At last, the module set to GPS + BDS mixed mode output by default, then the output information is the data beginning with GN. If it is set to separate mode, then it should be the data output of the beginning of this mode. For example, if it is set to GPS mode, the output information is GPGGA.

Example:

AT+GPS=1        //Enable GPS function
OK

AT+GPSRD=N        //Output a NEMA message from AT serial every N seconds 
+GPSRD:
$GNGGA,000840.261,2236.3719,N,11350.4081,E,0,0,,153.2,M,-3.2,M,,*4F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$BDGSA,A,1,,,,,,,,,,,,,,,*0F

$GPGSV,1,1,00*79
$BDGSV,1,1,00*68

$GNRMC,000840.261,V,2236.3719,N,11350.4081,E,0.000,0.00,060180,,,N*5C
$GNVTG,0.00,T,,M,0.000,N,0.000,K,N*2C

AT+LOCATION = 2                //Obtain the address information of GPS. The premise is that GPs can see the satellite, otherwise it will return GPS not fix now 

8. GPS Expansive Commands

Command:

AT+GPSMD=1 GPS mode (Do not support independent BD mode, BD system only covers Asia now)
AT+GPSMD=2 GPS+BD mode
The module is set to GPS + BDS mixed mode output by default, then the output information is the data beginning with GN. If it is set to separate mode, then it should be the data output of the beginning of this mode. For example, if it is set to GPS mode, the output information is GPGGA.

Example:

AT+GPS=1      Turn on GPS
AT+GPSMD=x    x=1 or 2, select mode, default to GPS+BDS mode
At+GPSRD=x    x represents output a NEMA message from AT serial every x seconds

9. GPS Low Power Mode

Command:

AT+GPSLP=x //GPS Low power setting, x can be set to 0,1,2
AT+GPSLP=0 //Normal mode ---- The current is tested to be about 0.063A
AT+GPSLP=1 //Serial port Low power mode
AT+GPSLP=2 //GPS Low power mode ---- The current is tested to be about 0.034A
//The default mode of GPS module is normal mode. When setting GPS mode, it may take time to take effect.

Example:

AT+GPS=1    //Turn on GPS
AT+GPSRD=10     //Output a NEMA message every 10 seconds
AT+GPSLP=2      //Set GPS mode to low power mode

10. AGPS

Command:

AT+AGPS=1, turn on AGPS, meanwhile it will turn on GPS. Turn off GPS first when using this function.
AT+AGPS=0, Turn off AGPS,
AT+AGPS? , Check AGPS status
AT+GPSRD=N,N represents output a NEMA message from AT serial every N seconds

Note: AGPS is an auxiliary positioning function for speeding up the positioning time of GPS. It is recommended to attach and activate the network before using it. Therefore, please attach and activate the network via command first. Note that after turning on the GPS, the module's GPRS_ RXD will output positioning information at 9600 baud rate by default (because the GPS chip is connected to the GPRS module for communication, so the module GPRS_ RXD is actually the TXD pin of GPS chip), but it does not affect the baud rate of the whole module. For example, the working baud rate of a9g module is 115200. When sending AT command to turn on GPS, GPRS_TXD will output positioning information by default at 9600 baud rate, BUT the AT serial port is still 115200.

Example:

AT+CGATT=1  //Attach network, this command is necessary if the Internet is needed. 
+CGATT:1
OK
AT+CGATT=1  //Attach network, this command is necessary if the Internet is needed. 
+CGATT:1
OK
AT+CGDCONT=1,"IP","CMNET" //Set PDP parameter
OK
AT+CGACT=1,1 //Activate PDP, can accross to Internet when activated properly.
OK
AT+GPS=0
OK

AT+AGPS=1
+AGPS:GPD OK
+AGPS:OK
OK

AT+GPSRD=N
OK
+GPSRD:
$GNGGA,050041.129,2236.1052,N,11350.2770,E,0,0,,3.2,M,-3.2,M,,*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$BDGSA,A,1,,,,,,,,,,,,,,,*0F
$GPGSV,4,1,14,05,59,296,,02,53,008,,06,37,068,,19,35,142,*74
$GPGSV,4,2,14,13,32,180,,12,28,252,,20,20,255,,25,15,288,*7F
$GPGSV,4,3,14,17,14,145,,29,11,323,,09,10,040,,15,08,205,*76
$GPGSV,4,4,14,30,03,112,,193,,,*75
$BDGSV,1,1,00*68

11. GPS Indicator Status

Command:

AT+GPNT=x //Set the status of GPS indicator, x=0 or x=1;
AT+GPNT=0 //GPS LED in flashing status
AT+GPNT=1 //GPS LED in On status

Example:

AT+GPNT=?   //Query values that are suitable for x
+GPNT: (0:led flash,1:led notice)
OK
AT+GPNT=0    //Set GPS indicator status
OK

12. Set Module Low Power Mode

Command:

AT+SLEEP=x //Set low power mode for the module, x can be set to 0,1,2
AT+SLEEP=0 //Turn off low power mode --- Current for entering low power mode is 00.213A
AT+SLEEP=1 //Enter GPIO low power mode. Pin GPIO25 pulls down to enter module low power mode, and pulls up to exit low power mode. GPIO25 is default to High.
AT+SLEEP=2 //Serial low power mode, can be woken up by serial port.(Please note that this function still needs to be optimized)

Note: after entering serial low power mode, the serial port can receive and transmit data, and the module will change mode between low power and normal modes. In GPIO Low power mode, when received data, message or phone call, the serial port cannot be woken up. Low power mode will be exited when pulling up the pin GPIO25. GPIO26 can be used to check whether there is message coming in low power period.(In GPIO low power mode, connect pin GPIO26 with an oscilloscope, detect the level of pin GPIO26 to determine whether there is data received.)
AT+SLEEP=1  //GPIO Low Power Mode
OK
//After successfully send the command, connect pin GPIO25 to GND, then it will not work if you continue sending AT commands
AT+SLEEP=2  //Serial low power mode
OK
//In this mode, the current consumption of the module will decrease, but it can still send data 
AT
OK
//When the module sent data, it will auto exit low power mode, then the current consumption will increase.

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents