SIMCOM AT Commands

From ElectroDragon
Jump to: navigation, search

Introduction

SIM908 and SIM900 have the auto baudrate detect function, can support baudrate from 1200-115200, so you can use any baudrate in this range, the first data send from SIM IC will be like random error data that can be ignored.

Common AT Commands

Command Description Return Result
AT+CPIN? check sim card status +CPIN:READY Sim card is found
AT+CSQ check signal quality +CSQ:30,0 30 is the quality of signal, max at 31
AT+COPS? check card service provider +COPS:0,0,"CHINAMOBILE" or empty CHINAMOBILE is the service provider
AT+CGMI Check the module maker SIMCOM_Ltd Made by simcom
AT+CGMM Check the module model type SIMCOM_SIM900A SIM900A
AT+CGSN Check the module IMEI, worldwide unique 869988012018905 869988012018905
AT+CNUM Check the number of current sim card, not all kinds of card support this function +CNUM:"","15902020353",129,7,4 phone number 15902020353
AT+ATE1 on/off AT commands return info send either ATE0 or ATE1 -

Calling and DTMF

Command Description Return Result
ATD+number; don't forget the ";" after AT commands, for example "ATD+18576608994;" OK -
ATA answer the incoming phone call OK -
ATH hangoff current phone call OK -
AT+COLP show up the calling number +COLP:"10086",129,"","" -
AT+CLIP sown up the number of incomming call +CLIP:"15124532672",161,"",,"ailin",0, -
AT+VTS=* send DTMF audio. for example, when we call the service provider number and need the press number 1 for operation, you can do AT+VTS=1 - -

SMS

Command Description Return Result
AT+CNMI Set the new message remind, for example AT+CNMI=2,1, +CMTI:"SM",2 when set is on and message box is NOT full, message is stored at position 2
AT+CMGF Set the module message mode, set either at PDU(0) or text mode(1) OK -
AT+CSCS Set TE character set, set AT+CSCS="GSM" for english only message, or set AT+CSCS="UCS2" for other lanuage OK -
AT+CMGR read message, for exmple, AT+CMGR=1 to read message at position 1 - -
AT+CMGS send message, send 180 bytes at GSM mode, or 70 Chinese character at UCS2 mode, AT+CMGS="18576608994" will return ">" and then type message, then end up with hex value 1A( 0X1A, "CTRL+Z"), send 1B to cancel "ESC" and finally return: +CMGS:156, in which 156 has meaning.
AT+CMGS (e.g. Chinese SMS) set AT+CMGR=1; AT+CSMP=17,167,2,25; AT+CSCS="UCS2" now the message can be by Unicode, AT+CMGS="00310035003100320034003500330032003600370032" (number 15124532672) will return ">" and then type message 00530049004D00390030003000414E2D82F1658777ED4FE153D190016D4B8BD5, end with 1A -
AT+CMGD delete message, to delete message at postion 1: AT+CMGD=1 OK -
AT+CPMS inquiry or set message storage settings AT+CPMS? to check how many message can be stored maximally and how many message stored :+CPMS:"SM",1,50, means support 50 sms max and 1 sms are stored now
  • General read SMS steps
AT+CMGF=1
AT+CSCS="GSM"
AT+CNMI=2,1 // set new message remind
AT+CMGR=2 // read message at position 2
AT+CMGD=2 // delete SMS at position 2
  • General send SMS steps
AT+CSCS="GSM"
AT+CMGF=1
AT+CMGS="18576608994"
>
  • Send Chinese sms
AT+CMGF=1
AT+CSMP=17,167,2,25
AT+CSCS="UCS2"
AT+CMGS="00310035003100320034003500330032003600370032"
>

GSM Base Station Location

  • AT+SAPBR=3,1,"Contype","GPRS"
  • AT+SAPBR=3,1,"APN","CMNET"
  • AT+SAPBR=1,1
  • AT+SAPBR=2,1
  • AT+CIPGSMLOC=1,1

More information please see SIm900 official document "GSM location ATC"

GPRS

Command Description Return Result
AT+CGCLASS support type B and CC, - -
AT+CGDCONT set PDP, e.g. AT+CGDCONT=1,"IP","CMNET", sign 1, internet protocol (IP) and connecting port CMNET - -
AT+CGATT attach or disattach GPRS service, AT+CGATT=1 - -
AT+CIPCSGP set CSD or GPRS link mode, AT+CIPCSGP=1,"CMNET", set GPRS link and connecting port CMNET - -
AT+CLPORT set TCP local port, AT+CLPORT="TCP","8888", port at 8888 - -
AT+CIPSTART initiate a connect or setup a UDP port, AT+CIPSTART="TCP","180.120.52.222","8086", connect to 180.120.52.222 at port 8086 CONNECT OK -
AT+CIPSEND send data, module will return ">", send max 1352 bytes and end up with 1A same as sms SENDOK -
AT+CIPSTATUS check module current connection status - -
AT+CIPCLOSE close current TCP/UDP connection, AT+CIPCLOSE=1 OK -
AT+CIPSHUT close mobile scene - -
  • General command steps
AT+CGCLASS="B" 
AT+CGDCONT=1,"IP","CMNET" 
AT+CGATT=1 
AT+CIPCSGP=1,"CMNET" 
AT+CLPORT="TCP","2000" or AT+CLPORT="UDP","3000"
AT+CIPSTART="TCP","180.120.52.222","8086" or AT+CIPSTART="UDP","180.120.52.222","8086"
AT+CIPSEND
>
AT+CIPCLOSE=1
AT+CIPSHUT
  • Working with internet domain, and receive data
AT+CIPMUX=0 // single link mode
AT+CIPRXGET=1 // manually get data, set at 0 to automatically retrieve and display data.
AT+CIPQRCLOSE=1 // speed up remote disconnection?
AT+CIPMODE=0  // not transparent TCPIP mode
AT+CIPSTART=”TCP”,”yixin1111.eicp.net”,8080
AT+CIPSEND
>


GPS

  • GPS Commands

Connect GSM Port to your PC
GSM Baud set to automatically, GPS set to 115200, or use AT+IPR set GSM Baud, AT+CGPSIPR to set GPS Baud

Commands Description Feedback
AT+CGPSPWR=1 power on GPS
AT+CGPSRST=1 Reset and restart the GPS
AT+CGPSIPR=9600 set GPS baudate, default baudrate is 115200
AT+CGPSINF=32 read GPS info e.g1. 32,172042.000,A,2234.482947,N,11353.301804,E,0.00,0.00,130515,,E,A ... OK
AT+CGPSSTATUS? check GPS status e.g1. +CGPSSTATUS: Location Unknown e.g2. +CGPSSTATUS: Location 3D Fix
  • AT+GSV check software version
  • AT+CGPSRST check GPS start status
  • AT+CGPSOUT GPS output port setup
  • AT+CGPSPWR=1 turn on GPS
  • AT+CGPSRST=1 set reset mode to code start, pluse activate GPS, this is a must do
  • GPS data within NEMA PC software, Use NMEA to read GPS status, in code start mode, 10-30seconds to get navigation, and 5 seconds to getvnavigation in warm start mode

Bluetooth Commands

Slave mode

  • 1, AT + BTPOWER = 1 / / open the Bluetooth power supply

Normal return "OK", if the module Bluetooth power has been turned on, it will return ERROR.

  • 2, AT + BTHOST? / / Query module name and address

return: AT + BTHOST? + BTHOST: SIM800C, 38: 1c: 4a: ae: 5e: 56 OK You can also modify the Bluetooth device name using this command

  • 3, the phone open Bluetooth assistant APP, click on "connect device";
  • 4, click "scan new equipment", wait for scanning to SIM800C;
  • 5, click "SIM800C", and confirm pairing;
  • 6, the computer will receive the request of the PC serial port matching information

+ BTPAIRING: "MEIZU MX3", 22: 22: f1: 6a: b7: 12,263153

  • 7, send AT + BTPAIR = 1,1, to allow mobile phone pairing

Back AT + BTPAIR = 1,1 OK

  • 8, after the receipt of APP's successful matching and request link service

+ BTPAIR: 1, "MEIZU MX3", 22: 22: f1: 6a: b7: 12 + BTCONNECTING: "22: 22: f1: 6a: b7: 12", "SPP"

  • 9, confirm the link AT + BTACPT = 1 / / confirmation and APP to establish SPP link

return AT + BTACPT = 1 OK

  • 10, AT + BTSPPSEND / / send data

There are two ways to send data, fixed length and non-fixed length Fixed-length mode: AT + BTSPPSEND = 5 // Send 5 bytes of data After receiving the symbol '>', enter 5 bytes of data, more than 5 bytes will be lost behind the data, only send the first 5 bytes return: AT + BTSPPSEND = 5 > 12345 SEND OK Non-fixed-length mode: AT + BTSPPSEND / / send data commands sent, without length After receiving the symbol '>', enter the data you want to send, such as "1234567890" After sending the data, switch to the hexadecimal send mode, send hexadecimal 1A; AT + BTSPPSEND > 1234567890 SEND OK

  • 11, receive data, received the data sent to the phone module, the module will automatically report the received data, the format is as follows

+ BTSPPDATA: 1,5, electrodragon


Master mode: The SIM800C has only slave mode

  • 1, AT + BTPOWER = 1 / / open the Bluetooth power supply

Normal return "OK", if the module Bluetooth power has been turned on, it will return ERROR.

  • 2, AT + BTHOST? / / Query module name and address

return: AT + BTHOST? + BTHOST: electrodragon, 27: a7: 2c: 90: 62: 60 OK You can also modify the Bluetooth device name using this command

  • 3, AT + BTSCAN = 1,10 / / Bluetooth cable accessories, cable time 10S

return: AT + BTSCAN = 1,10 OK + BTSCAN: 0,1, "MEIZU MX3", 22: 22: 4e: 73: 13: 84, -45 // The retrieved device, device ID: 1 + BTSCAN: 1 // Closing ends Note: Here you need to wait for the return + BTSCAN: 1 to represent the end of the cable.

  • 4, AT + BTPAIR = 0,1 // active request matching set ID: 1 Bluetooth settings

AT + BTPAIR = 0,1 OK + BTPAIRING: "MEIZU MX3", 22: 22: 4e: 73: 13: 84,573342 Note: when the phone will receive the matching request submitted by the module, the phone can be confirmed pairing

  • 5, AT + BTPAIR = 1,1 // response to the connection request

AT + BTPAIR = 1,1 OK + BTPAIR: 1, "MEIZU MX3", 22: 22: 4e: 73: 13: 84

  • 6, AT + BTGETPROF = 1 / / access to paired Bluetooth devices provide services

return: AT + BTGETPROF = 1 AT + BTGETPROF = 1 + BTGETPROF: 10, "PBAP" + BTGETPROF: 1, "A2DP (Source)" + BTGETPROF: 2, "HFP (AG)" + BTGETPROF: 8, "AVRCP (Target)" OK Note: There is no SPP service we need in the service list. To do this, first turn on the Bluetooth serial assistant of the mobile phone, open the Bluetooth assistant and retrieve the service again. return: AT + BTGETPROF = 1 + BTGETPROF: 10, "PBAP" + BTGETPROF: 1, "A2DP (Source)" + BTGETPROF: 2, "HFP (AG)" + BTGETPROF: 8, "AVRCP (Target)" + BTGETPROF: 4, "SPP" / / You can see the new SPP service OK

  • 7, AT + BTCONNECT = 1, 4 // the service that connects the bluetooth apparatus automatically, bluetooth ID: 1, serve 4 "SPP"

return: AT + BTCONNECT = 1,4 OK + BTCONNECT: 1, "MEIZU MX3", 22: 22: 4e: 73: 13: 84, "SPP"

  • 8, AT + BTSPPSEND / / send data

There are two ways to send data, fixed length and non-fixed length Fixed-length mode: AT + BTSPPSEND = 5 // Send 5 bytes of data After receiving the symbol '>', enter 5 bytes of data, more than 5 bytes will be lost behind the data, only send the first 5 bytes return: AT + BTSPPSEND = 5 > 12345 SEND OK Non-fixed-length mode: AT + BTSPPSEND / / send data commands sent, without length After receiving the symbol '>', enter the data you want to send, such as "1234567890" After sending the data, switch to the hexadecimal send mode, send hexadecimal 1A; AT + BTSPPSEND > 1234567890 SEND OK

  • 9, receive data, received the data sent to the phone module, the module will automatically report the received data, the format is as follows

+ BTSPPDATA: 1,5, electrodragon

Other Commands

Basic Command Group Enquery Write Command Parameters Remark and example
AT+CMEE profile AT+CMEE? AT+CMEE=2 1: use only error number code; 2: More verbose details of errors; For #2, you can see for example: +CME ERROR: SIM not inserted (Command: ATD13725585994;)
AT+IPR profile AT+IPR? AT+IPR = 9600 9600, 115200, etc serial port baud rate
AT+CFUN profile AT+FCUN? AT+IPR = 1 0=minimum Phone Functionality, 1= Full Phone Functionality, 4=disable RF circuits Set Phone Functionality

Documents