3G Modem SMS Tutorial

If you want to use a 3G modem in your application to send and receive SMS messages we, of course, think that our Diafaan SMS Server is your best option.

However if you want to implement it yourself, we put together a small tutorial with the basics of using a 3G modem. If you know how to use a serial port from your application, it is a matter of just sending the proper commands to the modem. Not that hard really.

Online SMS PDU tools

Online SMS PDU decoder
Online SMS message analyzer

3G Modem AT Commands for SMS

General SMS Commands
AT+CMGF - Set SMS Text Mode or SMS PDU Mode
AT+CMGD - Delete a Received Message

PDU Mode SMS Commands
AT+CMGL - List Received Messages

Text Mode SMS Commands
AT+CMGS - Send SMS Message
AT+CMGL - List Received Messages

SMS with a 3G Modem

All 3G modems work by sending commands to a serial port. Traditionally, 3G modems had a physical RS232 serial port connector but newer models mostly use a USB connector or a network TCP/IP connector. USB and network models are supplied with drivers that create a virtual serial port on the computer. The software can use this virtual serial port just as it was a physical serial port.

All you have to do to use a 3G modem from your own software is open the serial port, send the modem commands and process the response from the modem. USB modems or newer 3G modems typically use a baudrate of 115200, older 3G modems or mobile phones often only work with a baudrate of 9600.

example

Set the 3G modem to Text Mode SMS, send a message to the device itself, list all received messages and remove the message from the 3G modem.

AT+CMGF=1
OK
AT+CMGS="+31628870634"
> This is the text message.→
+CMGS: 45
OK
AT+CMGL="ALL"
+CMGL: 1,"REC UNREAD","+31628870634",,"11/01/09,10:50:12+04"
This is the text message.
OK
AT+CMGD=1
OK