Pages: [1]   Go Down
Author Topic: Control water pump through sms using a old sony phone interfaced with arduino  (Read 648 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 3 times.)
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46062
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: 114
Posts: 8919
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

Pages: [1]   Go Up
Jump to: