Basics: Project 085f
Project name: Ai Thinker A6 GSM GPRS module – GPRS application and GSM initialization
Tags: Arduino, A6 GSM GPRS module, GSM GPRS module, A6, Ai Thinker, GPRS, GPRS application, GSM initialization
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. Ai Thinker A6 GSM GPRS module 1 pc
2. Arduino IDE ( you can download it from here )
3. Jumper cables F-F, F-M
4. Micro USB cable 1 pc
5. Micro SIM card 1 pc (unlocked)
6. GSM GPRS antenna 1 pc
7. 5 VDC 2A power wall adapter 1pc
8. Arduino Nano 1 pc
We will learn about GPRS application and GSM initialization with Arduino Nano and the Ai Thinker A6 GSM GPRS module.
Understanding the GPRS and the EDGE
The below mentioned information about GPRS and EDGE has been taken from https://en.wikipedia.org/:
General Packet Radio Service (GPRS) is a packet oriented mobile data standard on the 2G and 3G cellular communication network’s global system for mobile communications (GSM). GPRS is typically sold according to the total volume of data transferred during the billing cycle, in contrast with circuit switched data, which is usually billed per minute of connection time, or sometimes by one-third minute increments. Usage above the GPRS bundled data cap may be charged per MB of data, speed limited, or disallowed.
GPRS is a best-effort service, implying variable throughput and latency that depend on the number of other users sharing the service concurrently, as opposed to circuit switching, where a certain quality of service (QoS) is guaranteed during the connection. In 2G systems, GPRS provides data rates of 56–114 kbit/sec. 2G cellular technology combined with GPRS is sometimes described as 2.5G, that is, a technology between the second (2G) and third (3G) generations of mobile telephony. It provides moderate-speed data transfer, by using unused time division multiple access (TDMA) channels in, for example, the GSM system.
The GPRS core network allows 2G, 3G and WCDMA mobile networks to transmit IP packets to external networks such as the Internet. The GPRS system is an integrated part of the GSM network switching subsystem.
GPRS makes the following services possible:
- SMS messaging and broadcasting
- “Always on” internet access
- Multimedia messaging service (MMS)
- Push-to-talk over cellular (PoC)
- Instant messaging and presence—wireless village
- Internet applications for smart devices through wireless application protocol (WAP)
- Point-to-point (P2P) service: inter-networking with the Internet (IP)
- Point-to-multipoint (P2M) service: point-to-multipoint multicast and point-to-multipoint group calls
If SMS over GPRS is used, an SMS transmission speed of about 30 SMS messages per minute may be achieved. This is much faster than using the ordinary SMS over GSM, whose SMS transmission speed is about 6 to 10 SMS messages per minute.
GPRS supports the following protocols:
- Internet Protocol (IP). In practice, built-in mobile browsers use IPv4 before IPv6 is widespread.
- Point-to-Point Protocol (PPP) is typically not supported by mobile phone operators but if a cellular phone is used as a modem for a connected computer, PPP may be used to tunnel IP to the phone. This allows an IP address to be dynamically assigned (using IPCP rather than DHCP) to the mobile equipment.
- X.25 connections are typically used for applications like wireless payment terminals, although it has been removed from the standard. X.25 can still be supported over PPP, or even over IP, but this requires either a network-based router to perform encapsulation or software built into the end-device/terminal; e.g., user equipment (UE).
When TCP/IP is used, each phone can have one or more IP addresses allocated. GPRS will store and forward the IP packets to the phone even during handover. The TCP restores any packets lost (e.g. due to a radio noise induced pause).
GSM module or GPRS modules are similar to modems, but there’s one difference: the modem is an external piece of equipment, whereas the GSM module or GPRS module can be integrated within an electrical or electronic equipment. It is an embedded piece of hardware. A GSM mobile, on the other hand, is a complete embedded system in itself. It comes with embedded processors dedicated to provide a functional interface between the user and the mobile network.
Enhanced Data rates for GSM Evolution (EDGE) (also known as Enhanced GPRS (EGPRS), IMT Single Carrier (IMT-SC), or Enhanced Data rates for Global Evolution) is a digital mobile phone technology that allows improved data transmission rates as a backward-compatible extension of GSM. EDGE is considered a pre-3G radio technology and is part of ITU’s 3G definition.
Understanding the Arduino Nano
You can read more about it here.
Understanding the A6 GSM GPRS module
You can read more about it here.
You can find A6 datasheet, manuals, AT commands, schematics here.
Signals and connections of the A6 GSM GPRS module
A6 GPS/GPRS IC pinout:
EN – module power control enable pin (can control power switch, default high level enable)
VCC_IN – External power supply (3.4V-4.2V ) maximum power supply current 2A
PWR – used for turning module ON/OFF programmatically. For doing this you must pull it HIGH for a moment (less than 500 ms or around).
INT – used to control the module to enter low-power mode, high exit low level access, in this mode the standby current <1mA ( in this mode the serial port cannot be used)
GND – ground pin. this module has 2 ground pins
U_RXD – serial port for AT commands (receive pin)
U_TXD – serial port for AT commands (transmit pin)
H_TXD – firmware update pin (transmit pin), pin power level 2.8V
H_RXD – firmware update pin (receive pin), pin power level 2.8V
R232_TX – RS232 level control (transmit pin)
R232_RX – RS232 level control (receive pin)
MIC- – microphone –
MIC+ – microphone+
REC- – loudspeaker –
REC+ – loudspeaker +
Step by Step instruction
A GPRS connection is established by reference to its access point name (APN). The APN defines the services such as wireless application protocol (WAP) access, short message service (SMS), multimedia messaging service (MMS), and for Internet communication services such as email and World Wide Web access.
In order to set up a GPRS connection for a wireless modem, a user must specify an APN, optionally a user name and password, and very rarely an IP address, provided by the network operator.
AT+CGATT PS attach or detach. This command is used to attach the GPRS Mobile Termination (MT) to, or detach the MT from, the Packet Domain service. AT+CGATT= 0 – detached, AT+CGATT=1 – attached.
AT+CGDCONT Define PDP Context.This command be used to defined PDP context. AT+CGDCONT=1,”IP”,”APN”, where “APN”-(Access Point Name) a string parameter which is a logical name that is used to select the GGSN or the external packet data network.
AT+CGACT PDP context activate or deactivate.This command is used to activate or deactivate the specified PDP context. AT+CGACT=1 – activated, AT+CGACT=0 – deactivated. Internet connection is available after successful PDP activation
AT+CRC Cellular result codes. This command is to control whether or not the extended format of incoming call indication or GPRS network
request for PDP context activation or notification for VBS/VGCS calls is used. When enabled, an incoming call is indicated to the terminal with unsolicited result code +CRING: instead of the normal RING.
AT+CRC=mode, where mode – 0 disables extended format (default), 1 enables extended format.
AT+CGQMIN Quality of Service Profile (Minimum acceptable). This command allows the terminal (PC) to specify a minimum acceptable profile which is checked by the GPRS Mobile Termination (cell phone) against the negotiated profile returned in the Activate PDP Context Accept message.
AT+CGPADDR? This command returns a list of PDP addresses for the specified context identifiers.
AT+CGAUTO The set command disables or enables an automatic positive response (auto-answer) to the receipt of a Request PDP Context Activation message from the network. It also provides control over the use of the
V.25ter basic commands ‘S0’, ‘A and ‘H’ for handling network requests for PDP context activation. The setting does not affect the issuing of the unsolicited result code RING or +CRING . AT+ CGAUTO =n, where n – 0 turn off automatic response for Packet Domain only; 1 turn on automatic response for Packet Domain only; 2 modem compatibility mode, Packet Domain only; 3 modem compatibility mode, Packet Domain and circuit switched calls (default). For n= 0 Packet DomainS network requests are manually accepted or rejected by the +CGANS command. For n= 1 Packet Domain network requests are automatically accepted according to the description above. For n= 2, automatic acceptance of Packet Domain network requests is controlled by the ‘S0’ command. Manual control uses the ‘A’ and ‘H’ commands, respectively, to accept and reject Packet Domain requests. (+CGANS may also be used.) Incoming circuit switched calls can be neither manually nor automatically answered. For n= 3, automatic acceptance of both Packet Domain network requests and incoming circuit switched calls is controlled by the ‘S0’ command. Manual control uses the ‘A’ and ‘H’ commands, respectively, to accept and reject Packet Domain requests. (+CGANS may also be used.) Circuit switched calls are handled
as described elsewhere in this specification.
AT+CGQREQ Quality of Service Profile (Requested). This command used to set the parameters of the QoS when GPRS Mobile Termination send the PDP context message for activation.
AT+CGREG GPRS network registration status. This command used to set and show the register information of GPRS Mobile Termination and the position information of the GPRS Mobile Termination.
ATD99**1# Request GPRS service. Login the server, the IP of it be provided by DHCP of GGSN. This command causes the GPRS Mobile Termination to perform whatever actions are necessary to establish communication between the terminal (PC) and the external PDN.
AT+CGSMS Select service for MO SMS messages. The set command is used to specify the service or service preference that the GPRS Mobile Termination will use to send MO SMS messages. AT+ CGSMS=service, where service – a numeric parameter which indicates the service or service preference to be used: 0 Packet Domain, 1 circuit switched, 2 Packet Domain preferred (use circuit switched if GPRS not available), 3 circuit switched preferred (use Packet Domain if circuit switched not available)
AT+CGANS PDP Manual response to a NW REQ for PDP context
activation. This command requests the GPRS Mobile Termination to respond to a network request for Packet Domain PDP context activation which has been signaled to the terminal (PC) by the RING or +CRING: unsolicited result code.
AT+CGEREP Packet Domain event reporting. This command is to enables or disables sending of unsolicited result codes, +CGEV: XXX from GPRS Mobile Termination to terminal (PC) in the case of certain events occurring in the Packet Domain GPRS Mobile Termination or the network.
AT+CGDATA Enter data state. This command causes the GPRS Mobile Termination to perform whatever actions are necessary to establish communication between the terminal (PC) and the network using one or more Packet Domain PDP types. This may include performing a PS attach and one or more PDP context activations.
AT+CGCLASS GPRS mobile station class.The set command is used to set the GPRS Mobile Termination to operate according to the specified mode of operation.
AT+CIPSTART This command is to start up TCP or UDP connection. For example, AT+CIPSTART=TCP,acoptex.com,80 or AT+CIPSTART=TCP,126.96.36.199,80, where 80 is remote server port, you can use the domain name or IP address.
AT+CIPSEND This command is used to send data through the TCP or UDP connection that has been established already. Ctrl+Z is used as a termination symbol. There are at most 1024 bytes that can be sent at a time. Type “AT+ CIPSEND“, then when you see response “>” type data for send, then CTRL+Z or end with 0X1A to send.
AT+CIPCLOSE This command only close TCP or UDP connection at the status of TCP/UDP CONNECTING or CONNECT OK, Otherwise response error. After close the connection, the status is IP CLOSE.
AT+CIPSHUT This command disconnects the wireless connection, except at the status of IP INITIAL. You can close moving scene by AT+CIPSHUT. After closed, the status is IP INITIAL.
AT+CSTT This command starts task and Set APN, USER ID, PASSWORD. AT+ CSTT=APN,USER_ID,PASSWORD. You need to know a GPRS access point name, a GPRS user name and a GPRS password.
AT+CIICR Bring up wireless connection with GPRS. This command only activate moving scene at the status of IP START, after operate this command, the state changed to IP CONFIG. If module accept the activate operation, the state changed to IP IND; after module accept the operation, if activate successfully, the state changed to IP GPRSACT, response OK, otherwise
AT+CIFSR This command is to get local IP address. This command only at the status of activated the moving scene: IP GPRSACT, TCP/UDP CONNECTING, CONNECT OK, IP CLOSE can get local IP Address by AT+CIFSR, otherwise response ERROR.
AT+CIPSTATUS This command query current connection status.Referred to AT+CIPSTART.
AT+CIPATS This command set auto sending timer.AT+CIPATS=mode, time, where mode – a numerical parameter which indicates whether set timer when sending data : 0 not set timer when sending data, 1 set timer when sending data; time – a numerical parameter which indicates the seconds after which the data will be sent. If you set mode to 0, no timer is allowed to set, timer value range: 1~65536.
AT+CIPSCONT This command saves TCP/IP application context which consist of following AT command parameters. When system is rebooted, the parameters will be loaded automatically.
AT+CDNSGIP This command query the IP address of given domain name. For example, AT+ CDNSGIP=acoptex.com
GSM INITIALIZATION COMMANDS:
AT+COPN This command reads operator names.
AT+COPS This command used to select the operator.
AT+CREG? This command be used to query the network registration status.
AT+CSQ This command used to query the quality of the signal.Value range is 0-31, 31 is the best.
AT+CCID This command reads SIM information to confirm whether the SIM is plugged
AT+CAUDIO This command used open (1) or close (0) audio, used during a call
AT+CRSL This command is used to set/get the sound level of the ringer on incoming calls.Value range is 0-15, 15 is the best.
AT+CDTMF Play DTMF tones but don’t send DTMF tones to a remote subscriber.
AT+ SNFS=0 Adjust to earphone mode(AT+SNFS=1 is microphone mode)
Uploading the sketch to the Arduino Nano
- Do wiring.
- Attach GSM GPRS antenna to A6 GSM GPRS module.
- Insert a active unlocked SIM card to SIM card slot of A6 GSM GPRS module.The workings of the SIM card socket can take some getting used to. To unlock the latch, push the top part of the assembly towards micro USB connector, and then lift it up. Place the SIM card into the bottom part of the socket with the SIM’s notch pointing away from the micro USB connector. Then fold the arm back into the body of the socket, and gently push it forward towards the “LOCK” position.
- We power up A6 GSM GPRS module with external power supply 5VDC 2A through micro USB port.
- Open Arduino IDE.
- Plug your Adruino Nano board into your PC and select the correct board and com port
- By default this module respond on 9600 bps.
- Verify and upload sketch to your Adruino Nano.
- Open up Arduino IDE Serial monitor and set your baud to 9600 baud and select Both NL&CR.
We have learnt about GPRS application and GSM initialization with Arduino Nano and the Ai Thinker A6 GSM GPRS module.
Thank you for reading and supporting us.
- SoftwareSerial library included in Arduino IDE. The library has the following known limitations:If using multiple software serial ports, only one can receive data at a time.Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).On Arduino or Genuino 101 the current maximum RX speed is 57600bpsOn Arduino or Genuino 101 RX doesn’t work on Pin 13 The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn’t work on Pin 13. You can read about it here.
- See attachments on the beginning of this project description