electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

sending, receiving, comparing SMS through AT commands


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> sending, receiving, comparing SMS through AT commands
Author Message
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post24 Mar 2007 20:11   

avr at commands


i need to compare the SMS received with predefined stored strings. the phone connected to an Atmel 8535, which reads that SMS through AT commands. was just confused over how to go about implementing it..

can i store the read message from the UDR directly into a string and also have the predefined message in string format. then can just comparing the two strings give the correct result??

also when was trying to send a message from the MC. the program i was trying is as follows:


Code:

#include<90s8535.h>
#include<stdio.h>
#include<delay.h>

unsigned char str1[] = "AT";
unsigned char str2[] = "AT+CMGS=25";
unsigned char str3[] = "079119890202456401000B819078004371F400040C486F772061726520796F753F";

void main(void)
{
   UBRR=0x33;
   UCR=0x18;     
         
        puts(str1);     //AT
          putchar(0x0D);  //Enter
        putchar(0x0A);  //Line feed
        delay_ms(3000);
          puts(str2);     //AT+CMGS=25
        putchar(0x0D);
        putchar(0x0A);
        delay_ms(3000); 
        puts(str3);    //Message in PDU format
          putchar(0x1A);   //Control-z
             
}


is this code correct? do i need to add in anything? or is anything not really required?
really need to get thru this... would be of great help. thanx...
Back to top
budhy



Joined: 21 Oct 2006
Posts: 836
Helped: 185
Location: Indonesia


Post25 Mar 2007 5:33   

strlen string codevision


Code:
#include<90s8535.h>
#include<stdio.h>
#include<delay.h>

unsigned char str2[] = "AT+CMGS=25";
unsigned char str3[] = "079119890202456401000B819078004371F400040C486F772061726520796F753F";

void main(void)
{
   UBRR=0x33;
   UCR=0x18;     
         
        puts(str2);     //AT+CMGS=25
        putchar(0x0D);
        delay_ms(3000);
        puts(str3);    //Message in PDU format
        putchar(0x1A);   //Control-z
        putchar(0x0D);         
}

Make sure your PDU string (str3[]) is absolutely correct!
This is your PDU message after decode, is it right?
Quote:
SMSC#+919820205446
Sender:09870034174
TP_PID:00
TP_DCS:04
TP_DCS-popis:Uncompressed Text
class:0
Alphabet:8bit

ow are you?
Length:72


Please mention the type of your cell phone.
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post25 Mar 2007 6:18   

avr at command


the decoded pdu is:


Quote:
SMSC#+919820205446
Receipient:09870034174
Validity:Not Present
TP_PID:00
TP_DCS:04
TP_DCS-popis:Uncompressed Text
No class
Alphabet:8bit

How are you?
Length:12



am using a sony ericsson T230 phone.




you have removed the Line Feed commands after the Enter commands.. isn't it required to get the prompt from the phone?

and in actual syntax of AT commands we do not press enter after control-z... but here you have?


however, will try the code and see if get results.
Back to top
budhy



Joined: 21 Oct 2006
Posts: 836
Helped: 185
Location: Indonesia


Post25 Mar 2007 6:42   

919820205446


Quote:
SMSC#+919820205446
Receipient:09870034174
Validity:Not Present
TP_PID:00
TP_DCS:04
TP_DCS-popis:Uncompressed Text
No class
Alphabet:8bit

How are you?
Length:12

the PDU string for above message is :
Code:
079119890202456411000B929078004371F40000AA0CC8F71D14969741F977FD07

not
Code:
079119890202456401000B819078004371F400040C486F772061726520796F753F

check it with Codare SMS PDU converter

Quote:
you have removed the Line Feed commands after the Enter commands.. isn't it required to get the prompt from the phone?

Carriage Return (0x0D) is enough
Quote:
and in actual syntax of AT commands we do not press enter after control-z... but here you have?

All AT command is endded with Carriage Return (0x0D)
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post25 Mar 2007 14:54   

sms pdu converter


the above code didnt work.

i guess there is some problem in the system, cos when we send a Dial command, the phone displays random parts of the number to be called, finally not being able to make a call.

But the phone dials properly when connected to the hyperterminal.

so can u figure out where the problem could lie? our microcontroller, our connection, our phone?
we're really stuck... plz help out here....
Back to top
budhy



Joined: 21 Oct 2006
Posts: 836
Helped: 185
Location: Indonesia


Post25 Mar 2007 17:01   

codevision at command for sms


Quote:
i guess there is some problem in the system, cos when we send a Dial command, the phone displays random parts of the number to be called, finally not being able to make a call.
But the phone dials properly when connected to the hyperterminal.

Are you using CVAVR for develop your system? There two kind of string output function on CVAVR :
Code:
void puts(char *str);
void putsf(char flash *str);

the first is for string variable (reside on RAM) and other one for string constant (reside on FLASH). At your case I think you have to use putsf() instead of puts().
Please try it.

Check your C Compiler stdio library documentation
Back to top
micro sem



Joined: 25 Mar 2007
Posts: 9


Post25 Mar 2007 19:48   

inituart() codevision


hi.
i m developing a remote home control system using sms . i m using 8051. can someone tell me how to use text mode sms format
Back to top
txdx2005



Joined: 15 Jul 2006
Posts: 42


Post26 Mar 2007 11:32   

sms through at commands


you can see AT set instuction. it's ok
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post26 Mar 2007 12:05   

ate0 command


hey budhy,

we sorted out the problem, it was on our pcb connections. so when we tested our program on another pcb, it worked just fine.

the above code is proper, we dont need putsf.
also the enter after the control z isnt required.

thanx 4 ur help...
Back to top
budhy



Joined: 21 Oct 2006
Posts: 836
Helped: 185
Location: Indonesia


Post26 Mar 2007 12:15   

pdu sms decode codevision


What kind of AVR C Compilewr do you used?
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post26 Mar 2007 12:21   

at commands in avr codevision


we are using a codevision c compiler.
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post31 Mar 2007 13:19   

at command ate0


can anyone plz help me out in the way to capture the response given by the phone as a result of the AT commands given to it.

for e.g when i send in a "AT".... i want to capture the response "OK"... possibly in a string.

i need to compare the responses with predefined strings to proceed further with my project.... thanx.
Back to top
budhy



Joined: 21 Oct 2006
Posts: 836
Helped: 185
Location: Indonesia


Post31 Mar 2007 17:52   

8051 sms


tanyajajodia mail me :
Quote:
hi budhy,
yet again we are facing problems in the smooth functioning for our project.
we wanted to capture the response given by the phone as a result of the AT commands given to it. we are using atmel 8535 and sony ericsson T230.

for e.g when i send in a "AT".... i want to capture the response "OK"... possibly in a string.

i need to compare the responses with predefined strings to proceed further with my project....

can you plz enlighten us with some solution...

you have always been a great source of help for us.... thanx again....


When we send a character to cellphone, the cellphone will echo back that character to us. ie : when you send ATD 628165417560; the cellphone will echo back that string to us.
This feature make a problem when you capture cellphone response!
Send ATE0 (echo off) command to eliminate it!

Here is the CodeVision code to demonstrate what do you want:
Code:
#include <90s8535.h>
#include <stdio.h>
#include <string.h>

char numb[] ="628165417560";
char messg[]="Hello Indonesia";

signed char sendSMS(char *number, char *message){
char response[10];
     putsf("ATE0\r");      // disable echo
     gets(response,10);    // waiting for "OK"
     putsf("AT+CMGS=\"");  // send number
     puts(number);
     putsf("\"\r");        // " and 0x0D
     gets(response,10);    // waiting for ">"
     puts(message);        // send message
     putchar(0x1A);        // ended with ctrl-Z
     gets(response,10);    // waiting for "OK"
     return strcmpf(response,"OK");
}

void initUART(void){
     ...
     ...
}

void main(void){
     initUART();
     // repeat send message, until OK
     while (!sendSMS(numb,messg));
}
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post03 Apr 2007 12:50   

cvavr read sms


Code:

#asm
.equ __lcd_port=0x15 ;PORTD
#endasm

#include<90s8535.h>
#include<stdio.h>
#include<delay.h> 
#include <lcd.h>

unsigned char str1[] = "ATE0";
unsigned char str2[] = "ATD 09870034174;";
char ch[20];

void main(void)
{     
   lcd_init(16);
   lcd_gotoxy(0,0);
   UBRR=0x33;
   UCR=0x18;     
         
        puts(str1);                 
        putchar(0x0D);
           
          puts(str2);   
          putchar(0x0D);     
          gets(ch,20);
        delay_ms(500);
          lcd_puts(ch);
   delay_ms(5000);
   lcd_clear(); 
     
while(1)
   ;
}
   

We tried using the above program to capture the response from the mobile, but in vain.
Earlier when we had run this program, our AT command string used to get displayed on the lcd. But now, it doesnt even do that.... can anybody clear it out?

Added after 1 minutes:

if we put anything as
Code:
lcd_putsf("Hello");


then it gets displayed, however there should be no gets() function before it.... quite weird!!
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post06 Apr 2007 8:11   

how to read all sms in at+command


hey budhy,
we tried using the ATE0 command as well,,,, but ATE0 itself gets displayed on the LCD!!!!
Back to top
miss_monica



Joined: 19 Sep 2006
Posts: 51


Post09 Apr 2007 15:39   

sendatcommand ate0


hello friends how are you i am also doing this project on connection of mobile with microcontroller i have a 6310 . the at commands work well withh hyperterminal but when i send these commands from the microcontroller there ,it doesnt work. i mean the mobile just echos the command send to it when i have the gnd removed and only tx and rx connected . but when i connect the gnd it doesnt even echo .
i dont even know which pins to connect i mean i have just connected the tx and rx to the 8051 the rest are just open . do i have to connect the rest of the pins in some manner please help
Back to top
murty_ind



Joined: 10 Apr 2007
Posts: 4


Post10 Apr 2007 13:39   

at commands avr


Hi

Iam trying to send /read SMS in PDU format,

If I send a message in PDU Format ,I got replay as “ERROR” with what ever message sent,

iam storing whole hex valus in the string,like following (char buf[]="0791xxxxxxxxxxxxxxxx"),

and my doubt is at the time of sending the message how much message size i have to give in the CMGS CMD
AT+CMGS= ?
whether it is strlen(buff) or number of octols?

thanking u with anticipation

[
Back to top
miss_monica



Joined: 19 Sep 2006
Posts: 51


Post10 Apr 2007 15:46   

nokia 6310i at commands sms


ok i have a dlr -3p cable which has a rs-232 db-9 female connector
it works well on hyperterminal
now the db-9 connecotor i have taken two wires from the rx and tx of the 8051 thru the max 232 and then in the tx and rx of the db-9 (of the dlr-3p)
it should work but when i connect the gnd to pin 5 of the db-9 the controller starts to funtion abnormally plz if anyone has interfaced the 8051 with dlr-3p-- nokia 6310 send me the diagram ,i am sure the programming is not the problem the problem is which of the pins of the db-9 is to be connected to what , thats what i cant figure it , i am sure it has also something to do with rts right? plz answer
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post10 Apr 2007 17:51   

at command avr


murty_ind wrote:

and my doubt is at the time of sending the message how much message size i have to give in the CMGS CMD
AT+CMGS= ?
whether it is strlen(buff) or number of octols?
[


it is the number of octals.... u can find the number of octals by using a pdu convertor....
http://rednaxela.net/pdu.php

Added after 2 minutes:

miss_monica wrote:
, i am sure it has also something to do with rts right? plz answer


you should have the cable from the phone side in "Null Modem"...
ie. short the RTS to CTS and DTR to DSR/CD... all on the phone side..
Back to top
murty_ind



Joined: 10 Apr 2007
Posts: 4


Post11 Apr 2007 5:55   

at command sms avr


Hi
I am successfully sending PDU Format SMS.

But my problem is How to read those SMS?

If I give the CMD “AT+CMGS=4”(for reading all SMS)
It is not displaying any messages.
Is there any procedure to read the SMS?


Thanking u with anticipation
Back to top
Google
AdSense
Google Adsense




Post11 Apr 2007 5:55   

Ads




Back to top
akilleuz



Joined: 02 Apr 2007
Posts: 16


Post11 Apr 2007 14:35   

codevision pdu decode c++


budhy wrote:
Quote:
SMSC#+919820205446
Receipient:09870034174
Validity:Not Present
TP_PID:00
TP_DCS:04
TP_DCS-popis:Uncompressed Text
No class
Alphabet:8bit

How are you?
Length:12

the PDU string for above message is :
Code:
079119890202456411000B929078004371F40000AA0CC8F71D14969741F977FD07

not
Code:
079119890202456401000B819078004371F400040C486F772061726520796F753F

check it with [url=h**p://stud.usv.ro/~amurariu/SMS%20and%20PDU%20format.htm]Codare SMS PDU converter[/url]

Quote:
you have removed the Line Feed commands after the Enter commands.. isn't it required to get the prompt from the phone?

Carriage Return (0x0D) is enough
Quote:
and in actual syntax of AT commands we do not press enter after control-z... but here you have?

All AT command is endded with Carriage Return (0x0D)


Hi

Maybe this is at stupid quistion. But when i want to use the pdu converte it want to know the size of the alphabet. But how do i know that? Or where can i find it?

best regards

AkilleuZ
Back to top
tanyajajodia



Joined: 17 Mar 2007
Posts: 16


Post05 May 2007 9:52   

send sms through at commands


murty_ind wrote:


If I give the CMD “AT+CMGS=4”(for reading all SMS)
It is not displaying any messages.
Is there any procedure to read the SMS?



when you use AT+CMGR... you specify the index location of the message to be read, so when you write AT+CMGR=4, you are reading the message location at index 4.

the command for reading all the messages is
AT+CMGL=4... i.e you are listing all the messages.
Back to top
traxonja



Joined: 06 Apr 2004
Posts: 109
Helped: 1


Post05 May 2007 16:05   

+cmgs:4


For PDU<->TEXT conversion and everything with SMS, you can use this little chip:

http://www.elektronika.ba/projekti/?akc=daj_projekt&idprojekt=9
Back to top
anhtam



Joined: 19 Jun 2007
Posts: 18


Post25 Sep 2007 9:52   

send sms class 0 sony ericsson


hi budhy!
Can you give me the schematic for this code
Back to top
naveensurisetty



Joined: 17 Oct 2007
Posts: 2


Post17 Oct 2007 19:16   

read sms cvavr


Hi all,

This article is very intrestiong. am also experimenting with 8535 controller for sms application. can anybody finished this.

I am looking for receiving and decoding part written in c for codevision AVR compiler.

thanks in advance
Naveen
Back to top
anhtam



Joined: 19 Jun 2007
Posts: 18


Post21 Oct 2007 3:32   

codevisionavr example reading sms text mode


Hi naveensurisetty!
It is written by the codevision AVR compiler software.
Back to top
naveensurisetty



Joined: 17 Oct 2007
Posts: 2


Post22 Oct 2007 5:16   

avr, at command


I am searching for code. I started ground work. yes working with codevision AVR compiler with 90S8535 controller, if anybody did this before (or similar code) please port me reply.

Naveen
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> sending, receiving, comparing SMS through AT commands
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Sending and receiving AT commands on 89c2051 (2)
SENDING AND RECEIVING SMS FROM 89C51 UART (14)
Sending and receiving byte through COM port(RS232) (4)
I need just a small help in AT Commands of sending sms (37)
Problem in Sending sms through PC(hyper terminal) (5)
problem in receiving sms (4)
SIM300S_V6.01 - problem with sending AT commands (3)
Sending Commands to Keyboard from PIC 18F452 (1)
sending SMS coding (1)
Sending Bulk SMS (4)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS