Skip to content

Instantly share code, notes, and snippets.

@n-west
Created January 27, 2013 00:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-west/4645594 to your computer and use it in GitHub Desktop.
Save n-west/4645594 to your computer and use it in GitHub Desktop.
Where to buy
Home > Support > FAQ > Article Detail
How to send an SMS with AT-commands?
4/02/2009
AT commands can be used to collect information from the modem device or the network and can help you troubleshoot modem specific issues.
To send an AT command to your Option modem device, open a terminal window (for example Hyperterminal on Windows XP). Type the AT command and press enter to send it to the modem device. If the characters that you type do not appear on your screen, the "echo" might be off. To enable this echo, type the following AT command: ATE1 For more information on how to use a terminal with our device, please refer to the article “How to send AT-commands to the device? How to use HyperTerminal?”
Preparation and Registration
Power on the modem device and check your registration status with the following AT commands:
- Check if the PIN code is enabled (PIN status) by entering the following AT command: AT+CPIN?
You can receive one of the following answers (for the complete list of answers, please refer to the ETSI 3GPP spec 27.007 for more information):
+CPIN: SIM PIN (you need to enter the PIN code to enable the card)
+CPIN: READY (the PIN is entered and the card is registered to the network)
To enter the PIN code, the following command can be used: AT+CIN=xxxx (where xxxx is the PIN code of your SIM card)
- To check if you are registered to the network, different AT commands are available.
When registered, you can check to which network by issuing the following AT command:
AT+COPS? (shows network provider you are registered to)
Checking the Service Center Address
Before sending or receiving an SMS, you first have to make sure the service center address (SCA) is set correctly. Normally, this is done automatically if the SCA is available on the SIM card.
- To check the SCA, you can use the following AT command: AT+CSCA?
- To enter or change the SCA, the following command can be used: AT+CSCA="+9911111111"
(+99 is the country code, 11111111 is a fictive SCA number)
Sending an SMS
To send an SMS, AT commands need to be entered in the following order:
- at+cmgf=1 (send SMS in text mode)
- at+cmgs="+9955555555" (Destination number; replace +99 with the country code of the country you want to send the SMS to, 55555555 needs to be replaced with the destination number)
When a prompt > appears enter the text you wish to send as a message, for example:
> Test sending SMS message
press CTRL+Z keys to send the message
When the SMS is sent correctly, a response will appear on the screen:
+CMGS: xx (xx=reference number)
Receiving an SMS
To receive an SMS, the following AT commands need to be entered:
- AT+CNMI=1,1 (this will allow the index of a new incoming SMS to be displayed)
An incoming SMS is indicated with: +CMTI: "SM", x (x= a counter)
- AT+CMGL (this command shows a list of all received unread SMS messages)
Example: +CMGL: x,"REC UNREAD","+329955555555"
Reply to Test sending SMS message
- AT+CMGR=x (Message on location “x” will be read)
Example: +CMGL: x,"REC UNREAD","+329955555555"
reply to Test sending SMS message
- AT+CNMI=1,2 (this will display incoming messages on arrival (unsolicited))
For more information on AT commands used for SMS activities, please also refer to the ETSI 3GPP 27.005 specification. This one can be found at http://www.3gpp.org/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment