help regarding sim300 receive sms+arduino uno

Status
Not open for further replies.

kunal123

Advanced Member level 4
Joined
Jan 24, 2011
Messages
105
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
mumbai
Activity points
1,961
hi,
can anyone suggest sample source code to display received sms by sim300 on serial port using arduino, please reply me asap.

thanks
 

hi ,
it is simple you will have receive buffer register right you can use that and display the text. use at+cmgr with index to read the data using gsm module


regards
bala krishna
 

ya correct, but i unable to get new message notification, the AT+CNMI is command for new message notification but how i can use this command
 

ya correct, but i unable to get new message notification, the AT+CNMI is command for new message notification but how i can use this command


hi kunal,
This is the simple example for receiving and read SMS.I hope that it will help you,


void switchModule(){
digitalWrite(onModulePin,HIGH);
delay(2000);
digitalWrite(onModulePin,LOW);
}

void setup(){

Serial.begin(115200); // UART baud rate
delay(2000);
pinMode(led, OUTPUT);
pinMode(onModulePin, OUTPUT);
switchModule(); // switches the module ON

for (int i=0;i < 5;i++){
delay(5000);
}

Serial.println("AT+CMGF=1"); // sets the SMS mode to text
delay(1000);
}

void loop(){


Serial.println("AT+CMGR=1"); //Reads the first SMS
Serial.flush();
for (x=0;x < 255;x++){
data[x]='\0';
}
x=0;
do{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
if(data[x-1]==0x0D&&data[x-2]=='"'){
x=0;
}
}while(!(data[x-1]=='K'&&data[x-2]=='O'));

data[x-3]='\0'; //finish the string before the OK

Serial.println(data); //shows the message

delay(5000);

}
 
hi sathshya,
u suggested code is not worked for me, i tryed on hyper terminal as follows
at
OK
at+csq
+CSQ: 99,99

OK
at+creg=1
OK
at+cmgf
+CREG: 1
=1
OK
at+cmgf=1
OK

+CMTI: "SM",21
at+cmgr=21
+CMGR: "REC UNREAD","+917738995895",,"12/10/05,17:14:24+22"
Hi

OK
if i send another message from cell phone to sim300 gsm module, module give me responce as
+CMTI: "SM",22
then read message at sim memory location 22

i have to do like above sequence
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…