Offline
Newbie
Karma: 0
Posts: 7
|
 |
« on: January 22, 2013, 06:34:17 am » |
I have a problem connecting with the Sony Ericsson K700 arduino. I first connect the K700 to the computer and use the hyper terminal no problem I can perform such commands with the AT command. then i try to connect arduino with serial Software to K700 and upload multple serial test. to test connection #include <SoftwareSerial.h>
SoftwareSerial gsm(2, 3); // RX, TX
void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port gsm.begin(9600); gsm.println("Hello, world?"); }
void loop() // run over and over { if (gsm.available()) Serial.write(gsm.read()); if (Serial.available()) gsm.write(Serial.read()); }problems can't connect k700 to the arduino, as shown below  i try to send AT command and no respon, error this my connection arduino with k700   for connection i use same like this tread http://arduino.cc/forum/index.php/topic,52794.0.htmlPhone Tx (Transmit -pin5) connect to Arduino Rx (Receive); Phone Rx (pin4) connect with Arduino Tx; ground Arduino connect to ground of the phone(pin10). It woks like this but it is probably better to use a voltage divider or resistor to lower the voltage from Arduino’s Tx to around 3V. I use 2kOhm resistor between Arduino Tx and phone Rx and it works fine for K700i. what any setting at phone k700 ? please help me
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #1 on: January 23, 2013, 02:03:22 am » |
hallo,
please help me
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #2 on: January 23, 2013, 03:16:06 am » |
Try use simple serial(0,1 pins) use the sketch from my site power7.net and test it...Tx,Rx test opposite...i think not need resistor...I don't know if gsm library suport cellphones...convert my code...for simply test AT OK...reply me if you solve your problem!You send AT from your sketch?
|
|
|
|
« Last Edit: January 23, 2013, 03:37:57 am by antkan »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #3 on: January 24, 2013, 09:24:38 pm » |
Dear Antkan,
sorry can replay now, acces internet in my home problem.
i can now connect to sonny ericsson K700, step, i no use resistor try and in my program for Ctrl + z , i can't use At command Serial.write(26);//Ctrl-z but i use Serial.write(0x1A); //Ctrl-z CTRL-Z and now i can send sms via K700
Thanks Mr. Antkan
But i now have new problem, i try sketch below,
#include <SoftwareSerial.h>
SoftwareSerial phone(2,3); // phone connected to pins 2,3
const int ledPin = 13; // LED on pin 13 String input; // phones response is saved into this string int state = 0; // current state of the LED
void setup () { // Serial connection Serial.begin(9600); Serial.println("Arduino connected."); delay(200);
// phone connection phone.begin(9600); Serial.println("Ericsson T610 connected."); delay(500); // LED pin init pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW);
// phone init Serial.println("Start of phone init..."); phone.println("AT+CPMS=\"ME\",\"ME\",\"ME\""); // phone memory used for SMS storage delay(2000); phone.println("AT+CNMI=2,3,0,0,0"); // forward all received stuff into terminal window delay(2000); phone.flush(); Serial.println("End of init. Waiting for command SMS...\n"); }
void loop () { while (phone.available() == 0); // waiting for phones response
while (phone.available() > 0) // read incoming data from phone and save it into input string { char aChar = phone.read(); input += aChar; }
// phones (partial) response displayed in serial window Serial.println(input);
// "decoding" received SMS int index1 = input.indexOf("CC2211"); int index2 = input.length() - 2; // if received SMS "LED ON" turn on LED if (input.substring(index1,index2) == "CC2211F47402") { digitalWrite(ledPin, HIGH); state = 1; } // if received SMS "LED OFF" turn off LED else if (input.substring(index1,index2) == "CC2211F4341A01") { digitalWrite(ledPin, LOW); state = 0; } input = ""; // reset input string }
when the K700 recive sms "LED ON" the ledPin = 13 not HIGH, please help me
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #4 on: January 25, 2013, 12:51:31 am » |
You must put some delay after digitalWrite(high,13).....delay(3000) else led on only for 1 msec and you can't see anything....
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #5 on: January 25, 2013, 07:53:40 am » |
Dear Antkan,
this below new edit : #include <SoftwareSerial.h>
SoftwareSerial phone(2,3); // phone connected to pins 2,3
const int ledPin = 13; // LED on pin 13 String input; // phones response is saved into this string int state = 0; // current state of the LED
void setup () { // Serial connection Serial.begin(9600); Serial.println("Arduino connected."); delay(200);
// phone connection phone.begin(9600); Serial.println("Ericsson T610 connected."); delay(500); // LED pin init pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW);
// phone init Serial.println("Start of phone init..."); phone.println("AT+CPMS=\"ME\",\"ME\",\"ME\""); // phone memory used for SMS storage delay(2000); phone.println("AT+CNMI=2,3,0,0,0"); // forward all received stuff into terminal window delay(2000); phone.flush(); Serial.println("End of init. Waiting for command SMS...\n"); }
void loop () { while (phone.available() == 0); // waiting for phones response
while (phone.available() > 0) // read incoming data from phone and save it into input string { char aChar = phone.read(); input += aChar; }
// phones (partial) response displayed in serial window Serial.println(input);
// "decoding" received SMS int index1 = input.indexOf("CC2211"); int index2 = input.length() - 2; // if received SMS "LED ON" turn on LED if (input.substring(index1,index2) == "CC2211F47402") { delay(3000); digitalWrite(ledPin, HIGH); delay(3000); state = 1; } // if received SMS "LED OFF" turn off LED else if (input.substring(index1,index2) == "CC2211F4341A01") { delay(3000); digitalWrite(ledPin, LOW); delay(3000); state = 0; } input = ""; // reset input string }
i send sms "LED ON" ok and led on, but when i send "LED OFF" led not off still on, this new problem Mr.Antkan
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #6 on: January 25, 2013, 10:10:21 am » |
Check pdu converter for wrong....in my project when i send on , send signal IR on for msecs.....and when send off , send signal IR off for msecs....The LED no switch off from sms but when end the delay...Look your code...step by step...line,line....
|
|
|
|
« Last Edit: January 25, 2013, 10:23:55 am by antkan »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #7 on: January 26, 2013, 06:12:58 am » |
Dear Antkan, I try and I still could not , and i try to use the sketch from http://power7.net/ this my modification code //GSM SMS Remote control V 3.0 //Created by Antonis G. Kanaris, January 27, 2012. //I use cellphone Sony Ericsson K700i (work serial communication).
#include <NewSoftSerial.h>
NewSoftSerial phone(2,3); // phone connected to pins 2,3
int ledPin = 13; // LED on pin 13 String readString; String admin="261852583207"; //admin number pdu code example 30123456 -> 03214365
//read http://www.dreamfabric.com/sms/
char c; void delsms(){ phone.println("AT+CMGD=1");//Delete sms } void readsmsAT(){ phone.println("AT+CMGR=1");//Read sms AT command delay(3000); } // phone.println("AT+CMGF=0");//Start send sms with temperature to pdu format //delay(3000); //phone.println("AT+CMGS=16");//Maybe for you is 15 or 17 read http://www.dreamfabric.com/sms/ // delay(3000); // phone.print("0011000C912618525832070000AA02");//pdu sms temp to admin,
//read http://www.dreamfabric.com/sms/ // delay(3000); // phone.write(0x1A);//Ctrl-z // delay(20000);
void setup() { //pinMode(IRledPin,OUTPUT); pinMode(ledPin,OUTPUT); delay(3000);//first time connect cable arduino with phone... Serial.begin(9600); phone.begin(9600); delay(3000); phone.println("AT+CPMS=\"ME\",\"SM\"");//Set memory phone delay(3000); phone.println("ATE=0");//Echo off delay(3000); }
void loop() { readString=0;//format readString... readsmsAT(); // read phone reply if available while(phone.available() > 0) { c=phone.read(),BYTE; readString+=c; } delay(1000); Serial.println(readString);//serial monitor display sms pdu format delay(3000); if (readString.indexOf(admin)>0 && readString.indexOf("36F770C")>0)// admin number and //pdu on1 { //digitalWrite(indicatorPin, HIGH);//only for test digitalWrite(ledPin, HIGH); // pin 13 on delay(5000); //sendsms_temp();//send sms to admin temperature room //digitalWrite(indicatorPin, LOW);//only for test } if (readString.indexOf(admin)>0 && readString.indexOf("44FA33106")>0)// admin number and //pdu OFF1 { digitalWrite(ledPin, LOW); // pin 13 off delay(3000); } // if (readString.length()>40)//delete sms if sms received // { // delsms(); //} delay(10000);//delay start loop again for check new sms...
} then i send sms on1 the ledPin = 13 does not want on, can you show me an example of the right of the code above, I am confused by reading the correct PDU code, and how read
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #8 on: January 27, 2013, 02:21:56 am » |
Maybe you must change the "AT+CMGS=16" to "AT+GMGS=17" because your phone number is 2 more digits from my country 69xx xxx xxx.Check it...or load my code with simple serial and change to 17....You could disable control with admin number for check it if led on...Any number send sms led on...
|
|
|
|
« Last Edit: January 27, 2013, 02:30:21 am by antkan »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #9 on: January 28, 2013, 07:56:52 am » |
Dear Antkan, I still tried to continue, but I am confused reading sms differences in hyperterminal and serial monitor. sms received "LED ON" reading of serial monitor arduino, below  reading of HyperTerminal, below  on serial monitor arduino +CMGR: 0,,25 06912618010000240C91261852583207000031108291231 on HyperTerminal +CMGR: 0,,25 06912618010000240C9126185258320700003110829125352306CC2211F47402 differences nothing "CC2211F47402" this for text "LED ON" why this differences and how to fix ?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #10 on: January 28, 2013, 09:14:43 am » |
Arduino with this sketch could not read sms with inside message.You have test my sketch without NewSoftSerial.h with simple serial (pins 0,1) i used arduino 022 before 1 year...? My work....i control my A/C with sms or led on/off.You have the right connection Tx,Rx pins?
|
|
|
|
« Last Edit: January 29, 2013, 01:10:22 am by antkan »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #11 on: January 29, 2013, 12:52:18 am » |
I think the problem is from power supply.You must use extermal power supply not usb from pc,because the cellphone charge....I use 9Volt 2A...or battery back 2x3.7volt lithium for arduino+cellphone.Also you must use full charged cellphone.Test and this parameter.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #12 on: January 29, 2013, 02:13:35 am » |
I test it again and work....i load my sketch from arduino 0022 software new Arduino software not accept serial,BYTE....without external power supply. I upload my serial monitor... and video youtube.... to my site www.power7.net ...look. 
|
|
|
|
« Last Edit: January 29, 2013, 05:29:02 am by antkan »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #13 on: February 16, 2013, 02:00:33 am » |
Mr. Antkan
I am still confused , can you make simple sketch control led 13 trun on/off via sms for k700 format PDU. I would like to know where my skecth errors. i used arduino 022
thanks
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 2
Posts: 163
|
 |
« Reply #14 on: February 25, 2013, 11:49:22 am » |
First,check cable connections,also you can use the bluetooth connections with bluetooth shield.Another important is DELETE all old sms messages from your phone because read the first sms always.Visit my new update page tutorial there http://www.power7.net/GSM_tutorial.html The sketch is http://power7.net/apk_file/SmsRemoteControl.pde for test it disable with // the IR library for A/C control if you want you can disable the admin function.Also check the PDU converter for on is 26F37.I use this http://rednaxela.net/pdu.php int indicatorPin=13; //Indicator Led pin 13 for test with led. String readString; //String admin="xxxxxxxxxx"; //admin number pdu code example 30123456 -> 03214365
//read http://www.dreamfabric.com/sms/ for pdu sms and www.power7.net
char c; void delsms(){ Serial.println("AT+CMGD=1");//Delete sms possition 1 } void readsmsAT(){ Serial.println("AT+CMGR=1");//Read sms possition 1 AT command delay(3000); } void setup() { //pinMode(IRledPin,OUTPUT); pinMode(indicatorPin,OUTPUT); delay(12000);//first time connect cable arduino with phone... Serial.begin(9600); delay(3000); Serial.println("AT+CPMS=\"ME\",\"SM\"");//Set memory phone for store sms to SIM delay(3000); Serial.println("ATE=0");//Echo off delay(3000); }
void loop() { readString=0;//format readString... readsmsAT();//read sms repeatedly // read phone reply if available while(Serial.available() > 0) { c=Serial.read(),BYTE; readString+=c; } delay(1000); Serial.println(readString);//serial monitor display sms pdu format delay(3000); if (readString.indexOf(admin)>0 && readString.indexOf("36F770C")>0)// if admin number=true and sms pdu on1=true { digitalWrite(indicatorPin, HIGH);//only for test led on //pulsesIR_Toyotomi.SendACCodeOn();//AC Toyotomi on delay(5000); //sendsms_temp();//send sms to admin temperature room digitalWrite(indicatorPin, LOW);//only for test } if (readString.indexOf(admin)>0 && readString.indexOf("44FA33106")>0)// admin number and //pdu OFF1 { //pulsesIR_Toyotomi.SendACCodeOff();//AC Toyotomi off delay(3000); } if (readString.length()>40)//delete sms if sms received { delsms();//delete sms } delay(10000);//delay start loop again for check new sms...
}
I create and java application for cellphone to convert it to modem for control your arduino from web...
|
|
|
|
« Last Edit: February 25, 2013, 12:13:33 pm by power7net »
|
Logged
|
|
|
|
|
|