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.html
Phone 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.
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?
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
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
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....
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 dreamfabric.com 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 dreamfabric.com // delay(3000); // phone.print("0011000C912618525832070000AA02");//pdu sms temp to admin, //read dreamfabric.com // 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
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...
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 ?
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?
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.
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.
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
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...
I use simple serial library with old arduino software 0022.I do not know maybe if you convert my code you can use NewSoftSerial with arduino 1.0 and later.I read is good for multiple connections for example if you want add external GPS or thermometer...now for test it use old software and classical pins 0,1 for receive and send data between arduino and cellphone.
//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);
// 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...
hi my friend
I have problem with sony ericsson k700 sms send code
always have error ambiguous overload for 'operator=' (operand types are 'String' and 'int')
void loop()
{
readString=0;//format readString…
of the sketch code
int indicatorPin=13; //Indicator Led pin 13 for test with led.
String readString;
//String admin="xxxxxxxxxx"; //admin number pdu code example 30123456 -> 03214365
//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);
// 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...