Go Down

Topic: GSM shild , Replay to sms , need help please (Read 479 times) previous topic - next topic

May 04, 2013, 04:09 pm Last Edit: May 04, 2013, 07:30 pm by mohammadKTaha Reason: 1
hi all ,
i am using arduino to control an  GSM SM100B  , every thing is working perfectly except when i want to send an sms after receive an sms
"replay to message ", i get this Error

Code: [Select]
O K > + C M G S : 2 5 O K + C M E E R R O R : 4

dose any one have any idea about that ?

my code :

Code: [Select]

#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
    char inchar;                //Will hold the incoming character from the Serial Port.
    SoftwareSerial cell(2,3);    //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
    char mobilenumber[] = "0597010129";  // Replace xxxxxxxx with the recipient's mobile number

    void setup() {
    //GSM
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
    Serial.println("Initialize GSM module serial port for communication.");                       
    cell.begin(9600);
    delay(35000); // give time for GSM module to register on network etc.
    Serial.println("delay off");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    delay(200);
    cell.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
    delay(200);
    }



    void loop() {   

     if(cell.available() >0)//If a character comes in, from the cellular module
     {
     inchar=cell.read();
     Serial.println(inchar);
     if (inchar=='#'){ // OK - the start of our command

       delay(10);
       inchar=cell.read();
       Serial.println(inchar); 

         if (inchar=='a'){

           delay(10);
           Serial.println("The folowing SMS : \n");
           inchar=cell.read();
           Serial.println(inchar);

           if (inchar=='0'){ //sequance = #a0

             Serial.println("#a0 was received");

         }
         else if (inchar=='1'){//sequance = #a1

            Serial.println("#a1 was received ");
            sendSms();

         }
     }
     cell.println("AT+CMGD=1,4");// AT command to delete all msgs
     Serial.println(" delete all SMS");
      }
    }//end of  if(cell.available() >0) {...}
    }

    void sendSms(){
    //cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.print("AT+CMGS=");  // now send message...
    cell.print((char)34); // ASCII equivalent of "
    cell.print(mobilenumber);
    cell.println((char)34);  // ASCII equivalent of "
    delay(500); // give the module some thinking time
    cell.print(":D hello m3alleg :D");   // our message to send
    cell.println((char)26);  // ASCII equivalent of Ctrl-Z
    delay(20000);

}


alnath

CME ERROR code 4 "Operation not supported"

Quote
When the error starts with "+CME ERROR", it means that the error is a device specific error code.


http://www.smssolutions.net/tutorials/gsm/gsmerrorcodes/

#2
May 05, 2013, 06:45 pm Last Edit: May 05, 2013, 10:59 pm by mohammadKTaha Reason: 1
thank you very much,  is that means that SM5100B GSM dose not Support replay to SMS ?
what can i do ?

the receive part alone is working perfectly and the send part alone is also working perfectly but they dos not fit together  =(

alnath

Sorry I don't know the SM5100B, but you could use a,other way to send "replies" by software :

put a flag ON when a SMS comes in, then, if the flag is set, send a SMS just as you do when you only want to send a SMS (without having received one before), and put the flag OFF .

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy