[SMS] Sony Ericsson PDU

This post has been moved and improved HERE

///////////OLD STUFF/////////

Summary

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.

PINOUT HERE

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.

Also, this link here tells you the this and that about PDU coding.

Now the implementation in your Arduino sketch would be as described in the bottom of this page.

T68i Setup

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. Please tell us what great things you are going to do with them. This code as already been above >32km in ‘space’ twice. (see other project)


/*
Copyright (C) 2010 Daniel Richman (/ Tim Zaman)

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 > 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;

void setup(){

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

}

void loop(){

while (count < timesToSend){
send_sms(“testabcABC123.,-00testabYES”);

count++;
}
}

void hexdump_byte(unsigned char byte)
{
Serial.print(hexdump_a(byte), BYTE);
Serial.print(hexdump_b(byte), BYTE);
}

void send_sms(char *data)
{
size_t data_length, x;
char c, l;
long i;
long n;

data_length = strlen(data);
i = data_length * 7;

/* Round i up to a multiple of 8 */
if (i & 0x07) i = (i & ~0x07) + 0x08;

/* Calculate the number of message octets */
i = i / 8;

Serial.println(“AT+CMGF=0”);
delay(1500);
Serial.print(“AT+CMGS=”);
delay(1500);
Serial.println(i + 14);
delay(1500);

/* here goes the number is a weird format..
for instance 31-653587749 is warped around to be
13-56537834F9 */
Serial.print(“0011000B911356537847F80000AA”);
hexdump_byte(data_length & 0xFF);

/* from sms_example_v2.c ALIEN Project Daniel Richman */
l = 0;
n = 0;

for (x = 0; x < data_length; x++)
{
if (data[x] == ‘$’) data[x] = 0x02;

n |= (data[x] & 0x7F) <= 8 )
{
hexdump_byte(n & 0xFF);
l -= 8;
n >>= 8;
}
}

if (l != 0)
{
hexdump_byte(n & 0xFF);
}

Serial.println(0x1A, BYTE);
}

Previous use in a schematic:

HoHoHo I schematic

Advertisements

8 responses

13 06 2011
Joko

is possible to recieve data from sms and read to arduino??

13 06 2011
Tim Zaman

Please go to the new website. http://www.timzaman.com

30 03 2011
The Cageybee

Hi again. I just tried to get the code working but have run into a couple of problems.

The definition for last_four() is missing. Going from the comments I tried:
#define last_four(byte) (byte << 4)
but that didn't work.

Also, at the end of line 65 there's a close bracket which has no corresponding open bracket. Should it be a semi-colon instead?

Regards
The Cageybee

30 03 2011
Tim Zaman

/* 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 < 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 sendint count = 0; void setup(){

Serial.begin(9600); // the GPRS baud rate } void loop(){

while (count < timesToSend){ send_sms(“testabcABC123.,-00testabYES”);

count++; }} void hexdump_byte(unsigned char byte){ Serial.print(hexdump_a(byte), BYTE); Serial.print(hexdump_b(byte), BYTE);} void send_sms(char *data){ size_t data_length, x; char c, l; long i; long n;

data_length = strlen(data); i = data_length * 7;

/* Round i up to a multiple of 8 */ if (i & 0x07) i = (i & ~0x07) + 0x08;

/* Calculate the number of message octets */ i = i / 8;

Serial.println(“AT+CMGF=0”); delay(1500); Serial.print(“AT+CMGS=”); delay(1500); Serial.println(i + 14); delay(1500); Serial.print(“0011000B911356537837F80000AA”); hexdump_byte(data_length & 0xFF);

/* from sms_example_v2.c ALIEN Project Daniel Richman */ l = 0; n = 0;

for (x = 0; x < data_length; x++) { if (data[x] == ‘$’) data[x] = 0x02;

n |= (data[x] & 0x7F) << l; l += 7; if (l >= 8) { hexdump_byte(n & 0xFF); l -= 8; n >>= 8; } }

if (l != 0) { hexdump_byte(n & 0xFF); }

Serial.println(0x1A, BYTE);}

30 03 2011
Tim Zaman

check your -email, the entire website is going to be updated in a few form, including downloads and the whole shabam.

28 03 2011
The Cageybee

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

28 03 2011
Tim Zaman

i’d love to host them but its really fairly impossible since i do not have my own webserver..

22 02 2011
Claes Nordquist

Wonderful!
I shall give this a try this evening…and get back to you if i have something to share!
-Thanks a bunch!
/Claes

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: