How to Use the AT Command to Send SMS from a Modem

Mar 12, 2023 | Resource

If you have a modem that supports SMS messaging, you can use the AT command to send SMS messages from your computer or terminal. The AT command is a standard command language used by modems to communicate with computers or other devices. In this blog post, we will go over how to use the AT command to send SMS messages from a modem.

Step 1: Connect the Modem

First, connect the modem to your computer or device. You can do this by using a USB cable or a serial cable, depending on the type of modem you have. Once the modem is connected, you can use a terminal program to communicate with the modem.

Step 2: Enter Command Mode

To enter command mode, you need to send the AT command to the modem. The modem will respond with an “OK” message if it is ready to receive commands. Here’s an example of how to enter command mode:

AT
OK

Step 3: Set the SMS Message Format

Before sending an SMS message, you need to set the SMS message format to “text mode.” To do this, send the following command:

AT+CMGF=1
OK

Step 4: Set the Destination Number

To set the destination number, you need to send the following command, replacing “destination_number” with the phone number you want to send the SMS message to:

 
AT+CMGS="destination_number"

After entering this command, the modem will wait for you to enter the SMS message.

Step 5: Enter the SMS Message

Once the modem is waiting for you to enter the SMS message, you can type the message you want to send. When you’re done typing the message, press “Ctrl-Z” to send the message.

Here’s an example of how to send an SMS message:

AT
OK
AT+CMGF=1
OK
AT+CMGS="1234567890"
> This is a test message.
> Ctrl-Z
+CMGS: 123

OK

In this example, we sent an SMS message to the phone number “1234567890” with the message “This is a test message.”

Step 6: Check the Message Status

After sending the SMS message, you can check the message status by sending the following command:

AT+CMSS?

The modem will respond with the status of the last SMS message sent.

Conclusion

In this blog post, we’ve gone over how to use the AT command to send SMS messages from a modem. Remember, you need to connect the modem to your computer or device, enter command mode, set the SMS message format, set the destination number, enter the SMS message, and check the message status. With these steps, you should be able to send SMS messages from your modem using the AT command.