Pages: [1]   Go Down
Author Topic: Control water pump through sms using a old sony phone interfaced with arduino  (Read 817 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

void setup() {

  Serial.begin(9600);
  delay(3000);
  Serial.println("AT+CPMS=\"ME\"");  // AT commands for sony T610
  delay(3000);
  Serial.println("ATE=0");  // ECHO off
  delay(3000);
  Serial.println("AT+CMGF=1");    //text format
  delay(3000);
  Serial.println("AT+CMGR=1");   //read text message from the location 1 of the phone
  delay(3000);
 
 
 
 
  if (Serial.available() > 0) {
    /* Now i cant understand how to assign that
    data string received in the form of text message to a memory
    locaton on arduino and compare with another string and
    then do the appropriate action.*/
   
   /* I want to compare the received message with string "ON" and "OFF"
    and if the message contains ON then set a digital pin high for 30 minutes max and
    if off is received then set that digital pin Low
 
*/
}
 
 
  void loop() {
 
   
  }

* testing.pde (0.85 KB - downloaded 5 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Embedding your questions in the comments is a good way to get ignored. I'd recommend that you not do that again.

I'd recommend that you learn how to read serial data, how to save it an an array, and how to parse that data, before you worry about what to do with a value received from the phone.

http://jhaskellsblog.blogspot.com/2011/05/serial-comm-fundamentals-on-arduino.html
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is some simple on/off test code Use the # post tool bar to use the code tags.

Code:
// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

int ledPin = 13;
String readString;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  Serial.println("serial on/off test 0021"); // so I can keep track
}

void loop() {

  while (Serial.available()) {
    delay(1); 
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    if (readString == "on")     
    {
      digitalWrite(ledPin, HIGH);
    }
    if (readString == "off")
    {
      digitalWrite(ledPin, LOW);
    }

    readString="";
  }
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Full Member
***
Karma: 2
Posts: 175
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I make this for control led with serial communication with sony ericsson k700....
Code:
//Remote control GSM V 1.0
 
 int ledPin=13;
 String readString;
 char c;
 
  void setup() {
 
  pinMode(ledPin,OUTPUT);
  delay(12000);
  Serial.begin(9600);
  delay(3000);
  Serial.println("AT+CPMS=\"ME\",\"SM\"");//Set memory phone
  delay(5000);
  Serial.println("ATE=0");//Echo off
  delay(3000);
  readsms:
  Serial.println("AT+CMGR=1");//Read sms
  delay(5000);
 
}
 
  void loop() {
 
     delay(100);
 
  // read phone reply if available
if (Serial.available() > 0) {
 
                c=Serial.read(),BYTE;
                readString+=c;

               Serial.println(readString);
              if (readString.indexOf("96xxxxxxxx")>0 &&(readString.indexOf("34F670C")>0)//admin and pdu "on"
              {
                 digitalWrite(ledPin,HIGH);
                 goto delsms;                 
              }
              if (readString.indexOf("96xxxxxxxx")>0 &&(readString.indexOf("44FA33106")>0)
              {
                 digitalWrite(ledPin,LOW);
                 goto delsms;
              }
             
}

  }
  delsms:
  Serial.println("AT+CMGD=1");//Delete sms
  delay(120000);
  goto readsms;
Logged

Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i dont understand this ......please clarify...this code line
readString.indexOf("96xxxxxxxx")>0 &&(readString.indexOf("44FA33106")>0)..
may be 96xxxxxxx in the no.
and hex code..... "44fa33106" meant?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

okk i got it.....
34F670C meant ON1
and same manner for OFF1..
thanks for the help
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi
please help me..
i used sony ericsson k810i + arduino uno but thats not work..
at commands work with hyper terminal
please help
my code :
Quote
//Remote control GSM V 1.0
 
 int ledPin=13;
 String readString;
 char c;
 
  void delsms(){
    Serial.println("AT+CMGD=1");//Delete sms possition 1
    }
 
 
  void setup() {
 
  pinMode(ledPin,OUTPUT);
  delay(12000);
  Serial.begin(9600);
  delay(3000);
  Serial.println("AT+CPMS=\"ME\",\"SM\"");//Set memory phone
  delay(5000);
  Serial.println("ATE=0");//Echo off
  delay(3000);
  readsms:
  Serial.println("AT+CMGR=1");//Read sms
  delay(5000);
 }
    void loop() {
 
     delay(100);
 
     // read phone reply if available
   if (Serial.available() > 0) {
 
                c=Serial.read(),BYTE;
                readString+=c;

               Serial.println(readString);
              if (readString.indexOf("9377404499")>0 &&(readString.indexOf("34F670C")>0))//admin and pdu "on"
              {
                 digitalWrite(ledPin,HIGH);
                 delsms;                 
              }
              if (readString.indexOf("9377404499")>0 &&(readString.indexOf("44FA33106")>0))
              {
                 digitalWrite(ledPin,LOW);
                 delsms;
              }
         
   }
  }
 
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12549
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i used sony ericsson k810i + arduino uno but thats not work..

"Not work" doesn't give us any idea what you want it to do or what it's actually doing.

Your sketch seems to be writing AT commands to the hardware serial port, and reading responses from the same port. Usually this port would be used for communication with the PC so that you can see what is going on. Trying to connect more than one device to a given serial port is asking for trouble. How is the Arduino connected to the modem and to the PC?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi thanks for repply
sony ericsson k810i rx tx is connected to pins 0 and 1..i use pin 13 for output..
i wanna switch pin 13 to ON(with ON1) and OFF (with OFF1)..
every thing work correct but when send sms to k810i nothing heppend..
i tested it with usb power and 12V 1.5A power adaptor
arduinu connected to pc with usb and pins 0 1 connected to k810i but when i wanna send sms i plug out usb..
thanks for help
Logged

Pages: [1]   Go Up
Jump to: