Written by Mai Vĩnh Thông (MVT) from Casewhere team *

If you want to send advertising SMS or spam SMS to a lot of recipients, I will show you in this article how to do that through a GSM modem or DCOM 3G using AT commands without using any third party library. (What are AT commands? You can refer to other documents.)

Connect DCOM 3G to PC

To send SMS messages, first place a valid SIM card into DCOM 3G or GSM modem, which is then connected to a computer. There are several ways to connect a GSM modem to a computer. For example, they can be connected through a serial cable, a USB cable etc. No matter what way you use, the computer still communicates with the modem via the serial port interface.

You can check the serial port that connects with the modem by going to the Device manager program. In the below picture, I connected my DCOM 3G to PC and it is communicating as a serial port (COM 10).

Use a terminal program to send SMS

Download and install RealTerm on https://sourceforge.net/projects/realterm/. RealTerm’s function is like this: It sends the characters you typed to the GSM modem. It then displays the response it receives from the GSM modem on the screen. After installing RealTerm, run it and go to Port tab:

Select Baud is 9600, the port is 10 (corresponding with serial port of GSM modem) then click the Change button, then go to Send tab:

Type “AT” command and check “+CR” to tell us that send a CR control character below. Click the Send ASCII button and wait for “OK” response message.

The other lines are responses returned from the GSM modem

AT
OK
AT+CMGF=1
OK
AT+CMGS="+8409xxxxxxx"
>Hello word
0x1A

Here are descriptions of what is done:

  • Line 1: “AT” is the test command, it is sent to the modem to test the connection. GSM modem sends back the result code “OK”, which means the GSM modem works fine.
  • Line 2: “AT+CMGF=1”, this command is sent to the modem to change the operation of the modem to SMS text mode (The modem can work in text mode and PDU mode). GSM modem sends back the result code “OK”.
  • Line 3: AT+CMGS=”” is used to specify the phone number of the message.
  • Line 4: Message content
  • Line 5: 0x1A to instruct end of batch job and send message.

Those are all the commands to send an SMS message. If you want to collect them and send SMS automatically, you can write the source code for connecting to and sending AT commands to the GSM modem, just like what a terminal program does.

-Mai Vinh Thong-