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 recipient, 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 is AT commands? You can reference on other document)
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 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, computer still communicates modem via serial port interface.
You can check the serial port that connect with modem by go to Device manager program. In below picture, I connected my DCOM 3G to PC and it communicating as serial port (COM 10).
Use a terminal program to send SMS
Download and install RealTerm on https://sourceforge.net/projects/realterm/ A 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. Alter install 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 Change button, then go to Send tab:
Type “AT” command and check “+CR” to tell us that send a CR control character bellow. Click Send ASCII button and wait for “OK” response message.
The other lines are responses returned from the GSM modem
Here are descriptions of what is done:
- Line 1: “AT” is the test command, it sent to modem to test connection. GSM modem sends back the result code is “OK”, that is mean the GSM modem works fine.
- Line 2: “AT+CMGS=1”, this command sent to modem to change operation of modem in SMS text mode (The modem can be work on text mode and PDU mode). GSM modem sends back the result code is “OK”.
- Line 3: AT+CMGW=”” is used to specify the phone number to of message.
- Line 4: Message content
- Line 5: 0x1A to instruct end of batch job and send message.
That are all commands to send a 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.