10. How to Send SMS
Messages from a Computer / PC?
general, there are two ways to send SMS messages from a computer / PC
to a mobile phone:
a mobile phone or GSM/GPRS modem to a computer / PC. Then use the
computer / PC and AT commands to instruct the mobile phone or
GSM/GPRS modem to send SMS messages.
the computer / PC to the SMS center (SMSC) or SMS gateway of a
wireless carrier or SMS service provider. Then send SMS messages
using a protocol / interface supported by the SMSC or SMS gateway.
you do not want to develop SMS software or applications but just want
to use your computer / PC to send text messages, you may want to read
our Quick Guide for Non-Developers.
10.1. The 1st Way:
Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS
SMS specification has defined a way for a computer to send SMS
messages through a mobile phone or GSM/GPRS modem. A GSM/GPRS modem
is a wireless modem that works with GSM/GPRS wireless networks. A
wireless modem is similar to a dial-up modem. The main difference is
that a wireless modem transmits data through a wireless network
whereas a dial-up modem transmits data through a copper telephone
line. More information about GSM/GPRS modems will be provided in the
section "Introduction to GSM /
GPRS Wireless Modems". Most mobile phones can be used as a
wireless modem. However, some mobile phones have certain limitations
comparing to GSM/GPRS modems. This will be discussed in the section
"Which is Better: Mobile Phone
or GSM / GPRS Modem" later.
send SMS messages, first place a valid SIM card from a wireless
carrier into a mobile phone or GSM/GPRS modem, which is then
connected to a computer. There are several ways to connect a mobile
phone or GSM/GPRS modem to a computer. For example, they can be
connected through a serial cable, a USB cable, a Bluetooth link or an
infrared link. The actual way to use depends on the capability of the
mobile phone or GSM/GPRS modem. For example, if a mobile phone does
not support Bluetooth, it cannot connect to the computer through a
connecting a mobile phone or GSM/GPRS modem to a computer, you can
control the mobile phone or GSM/GPRS modem by sending instructions to
it. The instructions used for controlling the mobile phone or
GSM/GPRS modem are called AT commands. (AT commands are also used to
control dial-up modems for wired telephone system.) Dial-up modems,
mobile phones and GSM/GPRS modems support a common set of standard AT
commands. In addition to this common set of standard AT commands,
mobile phones and GSM/GPRS modems support an extended set of AT
commands. One use of the extended AT commands is to control the
sending and receiving of SMS messages.
following table lists the AT commands that are related to the writing
and sending of SMS messages:
message from storage
message to memory
messages to send
way to send AT commands to a mobile phone or GSM/GPRS modem is to use
a terminal program. A terminal program's function is like this: It
sends the characters you typed to the mobile phone or GSM/GPRS modem.
It then displays the response it receives from the mobile phone or
GSM/GPRS modem on the screen. The terminal program on Microsoft
Windows is called HyperTerminal. More details about the use of
Microsoft HyperTerminal can be found in the "How
to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone
or GSM/GPRS Modem" section of this SMS tutorial.
shows a simple example that demonstrates how to use AT commands and
the HyperTerminal program of Microsoft Windows to send an SMS text
message. The lines in bold type are the command lines that should be
entered in HyperTerminal. The other lines are responses returned from
the GSM / GPRS modem or mobile phone.
A simple demo of SMS text messaging.
is a description of what is done in the above example:
1: "AT" is sent to the
GSM / GPRS modem to test the connection. The GSM / GPRS modem sends
back the result code "OK" (line 2), which means the
connection between the HyperTerminal program and the GSM / GPRS
modem works fine.
3: The AT command +CMGF is used to instruct the GSM / GPRS modem to
operate in SMS text mode. The result code "OK" is returned
(line 4), which indicates the command line "AT+CMGF=1" has
been executed successfully. If the result code "ERROR" is
returned, it is likely that the GSM / GPRS modem does not support
the SMS text mode. To confirm, type "AT+CMGF=?" in the
HyperTerminal program. If the response is "+CMGF: (0,1)"
(0=PDU mode and 1=text mode), then SMS text mode is supported. If
the response is "+CMGF: (0)", then SMS text mode is not
5 and 6: The AT command +CMGW is used to write an SMS text message
to the message storage of the GSM / GPRS modem. "+85291234567"
is the recipient mobile phone number. After typing the recipient
mobile phone number, you should press the Enter button of the
keyboard. The GSM / GPRS modem will then return a prompt ">
" and you can start typing the SMS text message "A simple
demo of SMS text messaging.". When finished, press Ctrl+z of
7: "+CMGW: 1" tells us that the index assigned to the SMS
text message is 1. It indicates the location of the SMS text message
in the message storage.
9: The result code "OK" indicates the execution of the AT
command +CMGW is successful.
10: The AT command +CMSS is used to send the SMS text message from
the message storage of the GSM / GPRS modem. "1" is the
index of the SMS text message obtained from line 7.
11: "+CMSS: 20" tells us that the reference number
assigned to the SMS text message is 20.
13: The result code "OK" indicates the execution of the AT
command +CMSS is successful.
send SMS messages from an application, you have to write the source
code for connecting to and sending AT commands to the mobile phone or
GSM/GPRS modem, just like what a terminal program does. You can write
the source code in C, C++, Java, Visual Basic, Delphi or other
programming languages you like. However, writing your own code has a
have to learn how to use AT commands.
have to learn how to compose the bits and bytes of an SMS message.
For example, to specify the character encoding (e.g. 7-bit encoding
and 16-bit Unicode encoding) of an SMS message, you need to know
which bits in the message header should be modified and what value
should be assigned.
SMS messages with a mobile phone or GSM/GPRS modem has a drawback --
the SMS transmission speed is low. As your SMS messaging application
becomes more popular, it has to handle a larger amount of SMS
traffic and finally the mobile phone or GSM/GPRS modem will not be
able to take the load. To obtain a high SMS transmission speed, a
direct connection to an SMSC or SMS gateway of a wireless carrier or
SMS service provider is needed. However, AT commands are not used
for communicating with an SMS center or SMS gateway. This means your
have to make a big change to your SMS messaging application in order
to move from a wireless-modem-based solution to a SMSC-based
most cases, instead of writing your own code for interacting with the
mobile phone or GSM/GPRS modem via AT commands, a better solution is
to use a high-level SMS messaging API (Application programming
interface) / SDK (Software development kit) / library. The API / SDK
/ library encapsulates the low-level details. So, an SMS application
developer does not need to know AT commands and the composition of
SMS messages in the bit-level. Some SMS messaging APIs / SDKs /
libraries support SMSC protocols in addition to AT commands. To move
from a wireless-modem-based SMS solution to a SMSC-based SMS
solution, usually you just need to modify a configuration file /
property file or make a few changes to your SMS messaging
application's source code.
links to some open source and free SMS messaging libraries can be
found in the article "Free
Libraries/Tools for Sending/Receiving SMS with a Computer".
way to hide the low-level AT command layer is to place an SMS gateway
between the SMS messaging application and the mobile phone or
GSM/GPRS modem. (This has been described in the section "What
is an SMS Gateway?" earlier.) Simple protocols such as HTTP
/ HTTPS can then be used for sending SMS messages in the application.
If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating
with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API /
SDK / library can be very helpful to you since it encapsulates the
SMSC protocol's details.
a list of supported / unsupported mobile phones or wireless modems is
provided on the web site of an SMS messaging API / SDK / library or
an SMS gateway software package. Remember to check the list if you
are going to use an SMS messaging API / SDK / library or an SMS
gateway software package.
Drawback of Sending SMS Messages through a Mobile Phone or GSM/GPRS
Modem -- Low SMS Sending Rate
a mobile phone or GSM/GPRS modem to send SMS messages has a major
drawback, that is the SMS sending rate is too low. Only 6-10 SMS
messages can be sent per minute (when the "SMS over GSM"
mode is used). The performance is not affected by the connection
between the computer and the mobile phone or GSM/GPRS modem (i.e. the
SMS sending rate is about the same no matter the mobile phone or
GSM/GPRS modem is connected to the computer through a serial cable,
USB cable, Bluetooth link or infrared link) and does not depend on
whether a mobile phone or GSM/GPRS modem is used (i.e. the SMS
sending rate is about the same no matter a mobile phone or a GSM/GPRS
modem is used). The determining factor for the SMS sending rate is
the wireless network.
Feedback Form (ExpandCollapse