[SMS] Sony Ericsson PDU

For nothing have I had more requests than this piece of code. It’s use is obvious; forcing a turned on Sony Ericsson that supports a real serial interface to send a sms, receive, read, call etc. The hardest part in this is sending an SMS through real serial with f.e. an Arduino using this Sony Ericsson cellphone. This is because the info within the sms has to be coded in PDU. All other stuff you can just write, but the info has to be coded in a crappy fashion. Sadly, i lost most of the bookmarks i had on this.

Hooking it up

Datacable pins

Pin 4

RX (connect to your TX)

Pin 5

TX (connect to your RX)

Pin 10

GND

Pin 11

Vcc (3V)

Also, the phone wants 3V. You can give it 5V, but it doesnt like that a lot, so just either tune it down to 3V (pot. divider?) or just put a resistor in there in series so that the current stays low.

You are going to need a Data Cable just get it for $2. I got 2 for $3 on eBay, they worked fine. With mine, some chips were in the USB exit, this was great because i could just cut the cable and use the correct pins using the above linked pinout!

Also get The Phone, i have two t68i’s, i got one for $5 on eBay, another for $7. I actually say someone selling 5 for €15 on ebay once, but eh, yeah.

Reading Textmessages

Code

Dont forget to turn off your phone’s pincode and request for pincode. Also, this code works fine when the phone is ‘keyboard-locked’

Please notify me or comment here if you use the code. Any flaws of this code can be posted in the comment below. The code is intended for personal use. Don’t forget to either comment on the code, or donate me a cup of coffee for writing this!

/*

/*

Copyright (C) 2010 Daniel Richman (/Timbobel)

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

For a full copy of the GNU General Public License,

see .

*/

/* From hexdump.h ALIEN Project Daniel Richman */

#define num_to_char(number) ((number) < 10 ?

('0'+(number)):

(('A'-10)+(number)))

/* To select the 4 bits we do this */

#define first_four(byte) (0x0F & (byte))

/* Last four: Shift left to get to a number &lt; 16 */#define last_four(byte) ((0xF0 & (byte)) >> 4)

/* The MSB goes first. */

#define hexdump_a(byte) num_to_char( last_four(byte))

#define hexdump_b(byte) num_to_char(first_four(byte))

/*

*/

int timesToSend =1;// Numbers of SMS to send

int count =0;

//next is just the setup; he loops that once.

void setup(){

//Hook up your phone to the serial connection (Rx to Tx and Tx to Rx). If you dont have a

//serial connetion free, just use a library like "nss"(newsoftwareserial) which is good.

Serial.begin(9600);// the GPRS baud rate

}

//then next is the loop. timesToSend=1 so it sends an textmessage only once with the information "hello world"

79 Responses

Hello great post! I have some question :
– the code posted converts all the text to pdu format before sending it?
– in order to use this daily on a se k700i should I use 1k resistors to all wires connected to arduino uno? I don’t want to fry the phone nor the ardunio uno!
– Can I send IR commands from arduino using k700i built in infrared?
Thanks a lot

i have sonyericsson K700 and I want to connect with a remote control arduino via sms. Data pin out is the same as the T68i

the system works like this:
on when the sensor arduino digital pin 4 high arduino send SMS to the number specified by the content of status sms “pin 3 lives”
and then we send sms to arduino to the content “turn on pin 5″ the arduino pin 5 on the condition of high,
if the condition pin 5 already is high and arduino send back sms with the content “pin 5 high”.
as well as the turn off.
we send sms to arduino to the content “turn off pin 5″ the arduino pin 5 on the condition of low,
if the condition pin 5 already is low and arduino send back sms with the content “pin 5 low”.

This project will use my own and I will send a little donation to your. you can contact me via email. please help me .thank you very much

Hello Tim, thanks a lot for the code and explanation, but I have a simple question:
Your phone number (3165687738) have the international phone code (+3165687738) or not (+xx3165687738)?
Xcuseme for orrible english.
Thank you

Hi Tim,
i do the same thing with SonyErricson T230, but i guess i need level shifter since phone comunicate with 3v3 and Arduino with 5v. I send AT commands with USB to serial using well-known PL2303, but i can’t send AT commands with Arduino. Any suggestion? Thank you!

Hello Tim.
Thanks for your post, but I have a question.
I have a Sony Ericsson T290 and I connect the pin 4 (RX with TX), pin 5 (TX with RX), pin 10 (GND) and pin 11 (3V). The development card is a chipKit Max32 with 3 port for communication, and I use the first port.
I don’t know if I need a RS232 interface or just connect directly.
Sorry for my english, I hope you understand me.

So i.e if my 8digit hp number is 12345678 i won’t need to add an F into it right ? so will be 21436587, changed the number ad detached but still the same. Anyway i knew it did not work because the t68i is not reacting to the AT command sended and to double confirm i check the sent msg folder in the t68i, there is no sended msg.

Was wondering if i need initialize the pin of the TX and RX ? and did you used newsoftwareserial while doing this ? I am also curious which TX RX pin you used on the Arduino mega 1280.

Still trying to find out what has gone wrong . Would be glad if you could point it out.

Hi Tim, sorry trouble you again, i got everything connected up as per your instruction on Arduino 0020 with no error. I am using Arduino mega 1280 and T68I. But no sms nor anything is happening at the phone beside the phone is charging by itself upon connection to the board. What could be the problem ? Please kindly help out thank you.

How can you know that it doesnt work? Because i get frequent textmessages by people using this code, but not changing the cellphone number in there, because now it still include smy number as i see your code.
Also, you can’t monitor the code with the serial monitor, you have to fully detach that or it will interfere. you can only use a logic analyzer to see what its doing. For the rest, i guess it should work then! put you have to change the cellphonenumber in there. ” 1356537837F8 ” is actually my number; 3165687738. That F is in there, i believe, because my cellphonenumber has an uneven amount of digits

HI, TIM….i want to know if your sending part is work or not?can i get the coding please?gps 1@2 is compulsory or not ?hope you are reply my question as soon as possible because i have to complete my final project before end of this year.tanks so much..

it’s logic. i told you, you have to put it in PDU format, and you have to know how that works in order to convert the phone number. Please, if you’re new to electronics and programming, you’re better off starting with more basic projects, before you dive into this one 🙂

.,hello..i have read your post but can you tell me how to interface it with an analog input like a sensor?..I want that when the arduino receive an input from a sensor (Sharp IR sensor) connected to the arduino then sends the value via the sony ericsson phone to another phone?..im practically using it as a data logger which sends the data detected through sms..is it possible?…here is my code for the sensor..

Well.. 5V is actually too much for the phone. I believe ideally it wants something like 3V. Though, if you are not using it for weeks on end straight, 5V wont kill it. To be even more sure of that, i put some resistors in between that make sure some load is taken of the phone. Not sure if that’s really helpinh though, but still, i’m never out of spare resistors.

The library you are referring to is either “SoftwareSerial” or better, “NewSoftwareSerial” (or NSS). The latter is a lot better, it uses interrupts. Though, if you use this library you can’t use the modern servo library anymore.
NSS is very easy to use, very reliable up to 4800 baud in my experience. But generally you don’t really need it. Otherwise, try using a Arduino Mega.

Well.. 5V is actually too much for the phone. I believe ideally it wants something like 3V. Though, if you are not using it for weeks on end straight, 5V wont kill it. To be even more sure of that, i put some resistors in between that make sure some load is taken of the phone. Not sure if that’s really helpinh though, but still, i’m never out of spare resistors.

As the T68 has a real serial connection does this mean it can be directly connected to a PC just like the arduino? I ask as all the cables I’ve seen have a interface chip.
I’ve not tried it yet, but will…… wish me luck?

PS if the RX is connected can SMS be read from the T68 (with the correct code)?

i don’t think you need the red cable for anything. i do recommend that you use softwareserial; the NewSoftwareSerial “nss” library for arduino; then, you hook the rx and tx of the phone up to for instance pins 2 and 3 on the arduino. that should make things less prone to errors. then run the code. and try calling first through your arduino; just send a ATD command. if that works, the rest’ll work too!

The bold part you can ignore, just some standard settings. If you want an answer you really have to dive into C++ and PDU first. otherwise just ignore it. If you execute the code above, it will send a textmessage to me. I actually had quite a few textmessages from over the worls of people who are trying my code; with my cellphone nr still in their code 🙂

hello!
I am a boy from Romania and my problem is: I try to put your code on the Arduino and I connected with a Sony Ericsson T230 and it did not work, then I tried another Sony Ericsson T610 and just did not work! how do you make your code work with one of my phone? no bonding opportunity?

Hi John. It depends on wether or not your phone actually handles PDU. It is possible that your phone can’t work with the arduino; some phones have a virtual serial interface, if that’s the case you can’t use it with arduino. Also, check out if you can get it working with HyperTerminal first (serial interface from your computer). If that doesn’t work you can stop right there; also this is a good way to check if your connections are good.

Hello Tim, I’José Luis from Spain. I’n trying to run this sketch for a Phone Siemens M55, but I have problems with some characters of the program like “<” etc. I’ll be very happy if you post a link to the code or if you send the sketch by e-mail. I want to make a remote control with arduino and a legacy phone.

Hi Tim Zaman, job well done! Your wireless system saves a lot of money. I am really interested on this kind of project. I tried your setup also connecting the wires to my PIC16F877A but the phone seems cant communicate to my microcontroller. I tried everything first on hyperterminal and simulations and there’s no single problem. Any help on the hardware part?

I’d be happy to buy you plenty of coffee if you could please comment the code more so we can understand it’s operation more. Also, it seems as though this should be easy enough to reverse – having the Arduino receive messages as well. Have you attempted this?

OK i’ve heavily commented the code now; you should understand clearly i think :).
If you just want to call someone with this code (use other AT command) you don’t even need the PDU format. And even if you did need the PDU code for (for example reading textmessages) then you can just use this code. But i don’t think its difficult reading textmessages. And yes, i already managed to read textmessages using AT commands. But i don’t know how to know when a message has been received (just havent looked into that). I have some exams this week so i wont be posting any more code this week.

A couple of Q’s.
Firstly, could we have the code as a download if possible as code always seems to get a bit screwed up after it’s been through the html ringer. For instance, line 70. I didn’t know a smiley was valid arduino code. LOL. What’s that supposed to be anyway? Should it be:
0 ;
Also, where do I enter the phone number for the phone I want to send the sms to?
One last thing, what’s the data on line 60? Confused!
Cheers,
The Cageybee

Oh, i am also very interested in that code. I have succeeded to send predefined messages for Arduino with a T610 connected, but to get encode/decode working would definitely be nicer.
(I thought that T610 should have text mode, but i haven’t been able to use it.)

The thing i am building is just for my own use, and i will not make any money on it. I can make a small donation for the code.

That is correct. The phone runs ~3v though. But i have experienced in my lazyness that it accepts 5V serial as well, although i have occasionally just placed a 10kOhm resistor in between in series just to lower the power through the phone.

Hi, nice work there.
Im trying to make my arduino recieve and send SMS but with no success. I can send sms when connected to a computer but not to arduino. Im using a Sonyercisson T700 and i believe that its the same +AT commands that Ti68.
Im trying to find information about it but its kind of hard, i dont have very much experience of programming but i think i can do it.

Im wondering how you send the PDU message to arduino, when i try it my mobile doesn’t respond in any way. Would be nice if i could get a hint how you have solved it.

That’s because the T700 uses a virtual serial connection. It seems real through the computer, but its just emulated. You have to use an older version. Just pick up a t68i for $5 from ebay as i did once, that one is old enough, and really works very well.

No, good old 1280. But any chip with a serial interface will work with this code. Anything that can handle c++, that means it includes at least the 328, 1280, 2560. So any arduino will do, even the voltages doesnt matter, 3v3 or 5v will both work. Did use this successfully with a seeduino 3v3 arduino; arduino uno, arduino 328, arduino mega.