How to send and receive SMS using computer and gsm modem

Write-up by Dennis Chang

Sponsored Links





Short Message Service (SMS) or TXT messaging is a technologies that enables users to send and receive text messages via mobile phones. Apart for personal usage, SMS can also be utilized for company purpose, such as sending products’ promotions to customers, receiving customers’ feedback, informing clients about upcoming events, and even a lot more sophisticated tasks like hosting SMS survey or contest.

In order to perform these organization operations, there is a need to have a answer that supports sending/receiving of SMS via computers. Such a answer can be achieved by utilizing a gsm modem that connect to the computer, and a relevant software that can communicate with the gsm modem.

To communicate with the gsm modem, one would want to transmit standard AT commands via serial port. In this write-up, I will show the most basic AT commands required for sending and receiving of SMS in text mode.

1. Set preferred message format (+CMGF)

There are two message formats supported: text mode and PDU mode. In this article, I shall illustrate the easier text mode.

To set the preferred message format as text mode:AT+CMGF=1<CR>

Achievable response from the gsm modem: OK

2. Send SMS (+CMGS)

To send an SMS in text mode:AT+CMGS=<da><CR><text to be sent><Ctrl-Z>

where <da> is destination address, the recipient’s number you want to send your sms to<CR> is carriage return<text to be sent> is the text message you want to send<Ctrl-Z> is the character 0x1A, or pressing Ctrl key and Z key together

For example, to send the message “How are you?” to the number “12345678″, you key in:AT+CMGS=”12345678″<CR>

The gsm modem will response with the character “>”. Then you key in your text:>How are you?<Ctrl-Z>

The gsm modem will respond with the following if effective:+CMGS:<mr>OK

<mr> is the message reference, which is a number from to 255 returned by the gsm modem. This number begins with and is incremented by 1 for each outgoing message.

3. Receive SMS (+CMGR)

When a new sms arrived, the gsm modem would send the following byte stream:AT+CMTI: “SM”,1

To read the message, the pc/software requirements to send the command:AT+CMGR=1<CR>

The gsm modem will respond with some thing comparable to the following:+CMGR: “REC UNREAD”,”12345678″, “08/10/01 18:20:35+00″,<CR><LF>How are you?OK

The first part is the command +CMGR, the second part is the status of the message (in this case it is UNREAD), the third portion is the sender’s mobile number, the forth portion is the base station time-stamp, followed by the the carriage return and line feed characters, the message content, and finally the “OK” terminating character.

This write-up aims to provide an introductory guide to how to send/obtain sms using computer. The AT commands and packing of PDU mode are much far more complex and will not be discussed in this article.

About the Author

Dennis Chang is the founder of Lexel Technologies Pte Ltd, a software business based in Singapore. Dennis holds a Master of Science in Communication Software & Networks, and a Bachelor (Hons) in Electrical & Electronic Engineering.

Prior to founding his organization, Dennis had vast experience working in the personal computer security, smart card and military simulation industries.

Both comments and pings are currently closed.

Comments are closed.