Go Down

Topic: How to send a sms with a Sony Ericsson phone (Read 1 time) previous topic - next topic

HULK

As the forum has moved it seems as i can not continue to reply on my old post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290601471/all

Kristof, to read a sms kindly test below code.

Code: [Select]

char incomingByte;


void setup() {

   Serial.begin(9600);
   delay(500);
   
   //Set memory to read sms from, ME = phone memory
   Serial.println("AT+CPMS=\"ME\""); 

}


void loop() {
 
     delay(3000);
     //Read received message
     Serial.println("AT+CMGR=1");
 
     delay(3000);
     //Delete all read messages
     Serial.println("AT+CMGD=1");
   
     // read phone reply if available
     if (Serial.available() > 0) { 
       incomingByte = Serial.read(), BYTE;
       // say what you got:
       Serial.println(incomingByte);
     }
 

}



kristof

#1
Feb 08, 2011, 03:27 pm Last Edit: Feb 08, 2011, 03:31 pm by kristof Reason: 1
Hello Hulk

Thanks for the post. There where some problems with my account on the new forum. But now it works. I didn't have the chance testing your code. I ordered a new data cable, but I didn't received it yet. The other data cable is in use in another project.
Here is my code you asked for.
Code: [Select]

#include <NewSoftSerial.h>

NewSoftSerial mySerial(2, 3);//(rxpin, txpin ) green from usb is Rx, white from usb is Tx. So green form usb ( from phone ) is connected with pin 3, white with pin 2.
//use a voltage diveder, the T68i use 3.3V.
int sensPin=0; // analog pin 0 gebruikt om licht sensor in te lezen
int val = 0;// analoge waarde wordt weggeschreven in val
int runonce = 0;// geheugen om maar 1 maal een sms te sturen. Men moet dus de mic resetten wil men het programma terug laten lopen om een sms te sturen
int detect1=0;
int detect2=0;
void setup()  
{
 
 Serial.begin(9600);
 Serial.println("Send SMS with T68");
 // set the data rate for the NewSoftSerial port
 mySerial.begin(9600);
 pinMode(13, OUTPUT);// pin 13 geeft aan wanneer de brander in nood gegaan is


 

}

void loop()                     // run over and over again
{

 if (mySerial.available()) {
     Serial.print((char)mySerial.read());
 }
 if (Serial.available()) {
     mySerial.print((char)Serial.read());
 }
val = analogRead(sensPin);
//Serial.println(val);// gebruik dit om de lichtsensor af te regelen op de brander

if ((val>260)&&(detect2==1))
{
runonce=1;  
}


 

if((val>260)&&(detect1==0))
{
 delay(8000);
 detect2=1;
 
}
else
{
  detect2=0;
}




if ( (val > 260)&&(runonce==1) )
{
  runonce=0;
  digitalWrite(13, HIGH);
  //Serial.println("send sms");//test zenden sms
 
 mySerial.println("ati");
 delay(3000);
 mySerial.println("AT+CMGF=0"); // Set PDU mode
 delay(3000);
 mySerial.println("AT+CMGS=31"); // Number of octets
 delay(3000);
 mySerial.print("0011000B912374276628F50000AA134279D84D2ECB41D524F558B40699CCA213"); // Sends "Brander UITGEVALLEN" to "+32477266825"
 delay(3000);
 byte ctrlz = 26;
 mySerial.print(ctrlz);
 delay(3000);
 detect1=1;
 detect2=0;
 
}

}

FieRRy

Excuse me! I am a beginner and would like to see the source code to send an sms with Sony Ericsson T230 by Arduino
I put, Rx = 8, and TX = 10
I searched on Google and I found this site and do not quite understand! waiting for a reply as soon as possible!

fe4r


As the forum has moved it seems as i can not continue to reply on my old post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290601471/all

Kristof, to read a sms kindly test below code.

Code: [Select]

char incomingByte;


void setup() {

   Serial.begin(9600);
   delay(500);
   
   //Set memory to read sms from, ME = phone memory
   Serial.println("AT+CPMS=\"ME\""); 

}


void loop() {
 
     delay(3000);
     //Read received message
     Serial.println("AT+CMGR=1");
 
     delay(3000);
     //Delete all read messages
     Serial.println("AT+CMGD=1");
   
     // read phone reply if available
     if (Serial.available() > 0) { 
       incomingByte = Serial.read(), BYTE;
       // say what you got:
       Serial.println(incomingByte);
     }
 

}







I'm trying read messages with a T68i too and i'm using the code that Hulk sent above.

So, in the Serial Monitor i get:

AT+CPMS="ME"
AT+CMGR=1
A
AT+CMGR=1
T
AT+CMGR=1
+
AT+CMGR=1
C
AT+CMGR=1
P
AT+CMGR=1
M
AT+CMGR=1
S
AT+CMGR=1
=
AT+CMGR=1
"
AT+CMGR=1
M


Some one knows, why is it going on?

thanks

Go Up