Pages

Tuesday 25 March 2014

AT+CMGR - AT Command to Read SMS Message

Sometimes we have to read a particular message from preferred store using AT commands and SIM900-TTL GSM Modem. Here is the demonstration to list a particular message from SIM memory using AT commands. AT+CMGR is the command used to list particular message. GSM Modem I used is given here http://www.rhydolabz.com/index.php?main_page=product_info&cPath=184_185&products_id=1080


Step 1: Complete the circuit as shown in figure given below.


Step 2: Connect Arduino board to your computer.
Step 3: Open Arduino IDE.
Step 4: Now upload the below given program to Arduino board.

Some Important Facts :
1. For successfull uploading, wires connected to the RX and TX pins of Arduino board must be             disconnected before uploading the code.     
2. Don't forget to put a SIM having sufficient balance in the SIM900-TTL MODEM.
3. External power supply should be capable of handling 1A output current.

void setup() 
{

  Serial.begin(2400);
  Serial.write("AT+CMGF=1\r");           //set GSM to text mode
  delay(1500);

  Serial.write("AT+CPMS=\"SM\"\r");      //Preferred SMS Message Storage
  delay(1000);
    
  Serial.write("AT+CMGR=1\r");         //list the first message from SIM Memory
  while(1)
  {
    if(Serial.available())
    {
      Serial.write(Serial.read());  
    }   
  }
}

void loop() 
{
  
}

Step 4: Open your Serial Monitor. Change the baud rate to 2400.

Step 5: Press the Reset button on Arduino board.  Now that particular message in the SIM Memory will be displayed in the Serial Monitor (Encircled in black).

6 comments:


  1. Yes, I have been looking for this all day better now than never!

    electronic display boards india

    ReplyDelete
  2. Very knowledgefull....required urgently.....thanks..����

    ReplyDelete
  3. I followed all the steps and getting thefollowing error

    AT+CMGR=1
    AT+CMGF=1

    OK
    AT+CPMS="SM"

    ERROR
    AT+CMGR=1
    AT+CMGF=1

    OK
    AT+CPMS="SM"

    ERROR

    ERROR
    AT+CMGR=1
    AT+CMGF=1

    OK
    AT+CPMS="SM"

    ERROR

    ReplyDelete
  4. it doesn't work. Has anybody tried it?

    ReplyDelete