Send a SMS through a GSM Modem from a TMDSEVM3530 Evaluation Module using AT Commands
Romanian flag

      In general, there are two ways to send SMS messages from a computer / embedded system to a mobile phone:

  1. Connect a mobile phone or GSM/GPRS modem to a computer/embedded system. Then use the computer/embedded system and AT commands to instruct the mobile phone or GSM/GPRS modem to send SMS messages.
  2. Connect the computer/embedded system to the SMS center (SMSC) or SMS gateway of a wireless carrier or SMS service provider. Then send SMS messages using a protocol/interface supported by the SMSC or SMS gateway.

      For this application we used the first way to send SMS using AT commands. But before starting, we would like to explain a little bit about AT commands.
      AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands. There are two types of AT commands:

  1. Basic commands are AT commands that do not start with a "+". For example, D (Dial), A (Answer), H (Hook control), and O (Return to online data state). These are the basic commands.
  2. Extended commands are AT commands that start with a "+". All GSM AT commands are extended commands. For example, +CMGS (Send SMS message), +CMGL (List SMS messages), and +CMGR (Read SMS messages) are extended commands.

How applications works:
      Connect the modem with the board at the UART1 of the board, then push Connect button.
      If the connection is established you will get the “message modem is connected “ and if the modem was registered in network you will get also the message “Network Ok”. If you are unable to register the modem into the GSM network send the PIN number.
      Now you can type the number  and message and send it by pressing “Send SMS” button.

The code behind user interface:
      When the user push the button “Connect” the parameters of serial communication are set. After that, the command “at” is sent to verify if the modem is connected. If the answer of the modem is “OK” connection was established.
      Then we check if the modem is registered on network by sending at command  "at+creg?".  If the answer is  “0,1” then modem is registered, if the answer  “0,0” no network is available.
      For sending messages we need to concatenate at command “at+cmgs=”  with phone number taken from editbox “Phone Number” . The result is a string like this: “at+cmgs= Phone Number ". This string is sent to the modem.
      After that, the modem it is going to wait for the text message which is taken from editbox “Message”. This string will be also sent to the modem. The chain of commands are: AT+CMGS=”[number]”\r[text]Control-Z - it returns OK or ERROR. In C we have Control-Z = chr(26).

Other useful commands to set the modem:

  1. AT+CPIN?\r : checks if SIM has the pin code. It answers are: +CPIN: READY or +CPIN: SIM PIN if we need to insert the pin number to the GSM card.
  2. AT+CMGF=1\r: set the device to operate in SMS text mode (0=PDU mode and 1=text mode). This command returns OK.

 

There are 2 programs, bouth builded in Visual Studio 2008 environment based on MFC Smart Device Application template and tested on: OMAP3530 EVM board (base on Pocket PC 2003 SDK) and a standard PC.
Download the program code source for: OMAP3530 EVM board and x86 PC (the application for the PC is more flexible, see figure from below).

    OMAP3530 EVM      PC

Application GUI for: OMAP 3530 and PC

Back
Main Frame (acces to all the site)
Course of Intelligent Embedded Systems
"Gheorghe Asachi" Technical University of Iasi
Faculty of Electronics, Telecommunications and Information Technology
Associate Professor Dan Marius Dobrea