GSM, SMS & GPRS Command Guide
The practical cellular protocol reference for the AI-Thinker A7: deciphering boot strings, sending and parsing SMS text messages, placing voice calls, and opening TCP/IP sockets.
BLUF: The 4 Pre-Flight Checks Before Transmitting
Never attempt to send an SMS or open a GPRS connection without verifying network registration first. Send AT (→ OK), AT+CPIN? (→ +CPIN: READY), AT+CSQ (→ RSSI ≥ 10), and AT+CREG? (→ +CREG: 1,1 or 1,5). If CREG is 0 or 2, the module is still searching for cell towers.
1. Power-On Initialization & Boot Messages
Following a successful 2.5-second PWR_KEY pulse, the A7's internal RTOS boots and emits the following status lines on U_TXD:
^CINIT: 2, 32, 41891
^CINIT: 1, 0, 0
^CINIT: 8, 2048, 1
^CINIT: 16, 0, 1638450
+CTZV:26/10/02,22:30:00,+03
+CIEV: service, 1
+CIEV: roam, 0
+CREG: 1
^CINIT: Subsystem hardware initialization vectors. Wait until these finish before sending commands.+CTZV: Network time and time zone sync received from the local base station.+CIEV: service, 1: Cellular radio service acquired.+CREG: 1: Registered on home cellular network.
2. Sending & Receiving SMS Text Messages
Sending an SMS in Text Mode:
Always switch the module to Text Mode (AT+CMGF=1) rather than PDU hex mode:
// Step 1: Set SMS to Text Mode
AT+CMGF=1
OK
// Step 2: Specify destination number (international format with +)
AT+CMGS="+1234567890"
> Vehicle Alert: Lat: 37.1234, Lon: -115.5678 [Send Ctrl+Z (ASCII 0x1A)]
// Step 3: Module confirms transmission with message reference number
+CMGS: 142
OK
Automated Incoming SMS Display:
Configure New Message Indications (AT+CNMI) so incoming text messages are pushed directly to your microcontroller's UART without needing to poll:
AT+CNMI=2,2,0,0,0
OK
// When an SMS arrives, the A7 automatically prints:
+CMT: "+1234567890",,"2026/10/02,22:45:10+03"
Hello Arduino! What is your current GPS location?
AT+CMGD=1,4 (deletes all messages) during system startup to keep storage clear.
3. Placing & Receiving Voice Telephone Calls
Dialing a Number:
ATD+1234567890; → OK
Crucial: The trailing semicolon ; is mandatory! Without it, the module dials a 2G CSD data call and immediately returns NO CARRIER.
Answering & Hanging Up:
When the phone rings: RING
• Answer call: ATA
• Reject / Terminate call: ATH
Audio Routing (AT+SNFS):
AT+SNFS=0: Routes audio to the 3.5mm Headset Jack (Earphone + Mic).
AT+SNFS=1: Routes audio to Header P2 Loudspeaker / Mic Pins (REC+/REC- and MIC+/MIC-).
AT+CLVL=7: Sets receiver volume (range 0 to 7).
4. GPRS Data & Direct TCP/IP Sockets
The A7 contains an onboard TCP/IP stack. Your microcontroller does not need to run PPP or LWIP; you can open raw TCP sockets directly:
// 1. Configure GPRS APN (Replace with your carrier APN)
AT+CSTT="hologram","",""
OK
// 2. Bring up GPRS wireless connection
AT+CIICR
OK
// 3. Verify assigned local IP address
AT+CIFSR
10.142.78.210
// 4. Open TCP connection to remote server
AT+CIPSTART="TCP","httpbin.org",80
OK
CONNECT OK
// 5. Send HTTP GET request
AT+CIPSEND
> GET /get?lat=37.1234&lon=-115.5678 HTTP/1.1
Host: httpbin.org
User-Agent: AI-Thinker-A7
Connection: close
[Send Ctrl+Z (0x1A)]
// Server responds:
HTTP/1.1 200 OK
Content-Type: application/json
...
CLOSED
// 6. Shut down IP stack
AT+CIPCLOSE
OK
AT+CIPSHUT
SHUT OK