loading

Hi! A while ago I wanted to remotely access my arduino to control the I/O pins, I really liked the arduino GSM shield because it would allow me to control my arduino from anywhere in the world. However such a shield does unfortunately not come cheap. I found some guides on the internet on how to send an sms with an arduino and a sony ericsson phone but i couldn't find one to read an incoming sms and that's exactly what i wanted. That way i would be able to control my arduino and its I/O pins from anywhere in the world! It took me some time but i figured out a way! And the best part: an old sony ericsson doesn't cost near that much as an expensive GSM shield! I even found one just laying around at home! It is however a bit more complicated but if you follow my steps bellow you should be fine ;-) Let's get started!

Step 1: How It Works

Oke obviously the arduino and the cellphone will need to communicate that's why we'll put the phone in PDU mode in the setup of the program. PDU is relative easy way to communicate with an older sony ericsson cellphone (see supported models in the next step). In PDU mode, all SMS messages are represented as binary strings encoded in hexadecimal characters like 31020B911326880736F40000A900. This may sound scary but relax it isn't! Such a binary string has lots of info in it but we only want to know two things:

  1. the message sender (phone number): this way not everyone can control your arduino!
  2. the message itself

Imagine you've got this long PDU coded sms message of 90 characters. If you know (and you know, i figured it out for you) where to find the phone number and message in that string you can get them out! Let's say the phone number is 0478368477 and the message 0BC8329BFD06DDDF723619 (=Hello World). The code will work like this:

extracting information from string

if(number = "0478368477"){

if(message = "0BC8329BFD06DDDF723619"){

//an action

}

}

if the number extracted from the PDU coded sms message equals the preprogrammed number and the message says hello world in PDU code, an action will be performed. An action being whatever you want ;-)

Step 2: Get a Suitable Cellphone!

Unfortunately the hack does not work with every sony ericsson. I did some research and found a list with models that should be compatible:

F series: F500, F500i

P series: P800, P802, P900, P908

S series: S700, S700i

R series: R520, R520m, R520mc, R600, R600s, R600sc

T series : T39, T39m, T39mc, T62u, T65s, T66, T68, T68i, T68m, T68mc, T68ie, T100, T102, T105, T106, T200, T202, T226, T226s,T230, T238, T250, T300, T302, T306, T310, T312, T316, T600, T610, T616, T628, T630, T650i

K series: K300, K300i, K310, K320i, K500, K510i , K530, K700, K700i, K750i

Reported not to work: K550i

W Series: W200, W300, W550, W580, W600, W610, W660, W700, W710, W800, W810, W830, W850, W880, W900, W910

Z Series: Z200, Z250, Z310, Z320, Z500, Z520, Z525, Z530, Z550, Z558, Z600, Z608, Z610, Z710, Z750, Z800, Z1010

You're probably wondering why exactly these models, well they all support something called PDU to communicate and have the right connectors to work easy with arduino (See pictures). This hack may work with other cellphone's who have PDU mode and serial data communication you'll just have to try it out. You'll also need a external power supply for your arduino to complete this instructable! The phone connected to your arduino should also have a sim card, you can't receive a sms without a sim card.. ;-)

Update: I've seen some stuff about pdu on older nokia phones on the internet, you can give it a try if you have one but i can't make any promises. Good luck!

Step 3: Prepare Your Arduino

Because the serial buffer of the arduino has a 64 byte limit and a sms in PDU mode is a larger we'll need to increase the size of the serial buffer. The procedure bellow will ad an extra arduino in your arduino software with a larger buffersize.

The solution is to create a complete copy of the arduino core code (it's really not that big and disk space is cheap), modify the buffer size in the new core code and then to create a new board which is listed in the Arduino IDE which uses this new core directory. The steps to follow are as follows..

The whole of the Arduino core code is located in a directory similar to

C:\Program Files\arduino-1.0.5\hardware\arduino\cores\arduino Make a complete copy of this directory and save it to

C:\Program Files\arduino-1.0.5\hardware\arduino\cores\arduino_256_serialbuf The hard coded buffer size is stored in a file called HardwareSerial.cpp

Here is the standard definition located near the top of the file

#define SERIAL_BUFFER_SIZE 64 Edit the HardwareSerial.cpp file in the new directory and modify the buffer size

#define SERIAL_BUFFER_SIZE 256 Now we need to add an option to the boards.txt file to use this new directory. The boards.txt file should be in a directory similar to

C:\Program Files\arduino-1.0.5\hardware\arduino Below is part of the boards.txt file. The first section is for the standard Arduino Uno. You need to add a section below it which will display in the Arduino IDE as Arduino Uno (256 Serial Buffer). You can see the core directory is referenced to our new directory with the modified file (uno256.build.core=arduino_256_serialbuf)

##############################################################

uno.name=Arduino Uno uno.upload.protocol=arduino uno.upload.maximum_size=32256 uno.upload.speed=115200 uno.bootloader.low_fuses=0xff uno.bootloader.high_fuses=0xde uno.bootloader.extended_fuses=0x05 uno.bootloader.path=optiboot uno.bootloader.file=optiboot_atmega328.hex uno.bootloader.unlock_bits=0x3F uno.bootloader.lock_bits=0x0F uno.build.mcu=atmega328p uno.build.f_cpu=16000000L uno.build.core=arduino uno.build.variant=standard

##############################################################

uno256.name=Arduino Uno (256 Serial Buffer) uno256.upload.protocol=arduino uno256.upload.maximum_size=32256 uno256.upload.speed=115200 uno256.bootloader.low_fuses=0xff uno256.bootloader.high_fuses=0xde uno256.bootloader.extended_fuses=0x05 uno256.bootloader.path=optiboot uno256.bootloader.file=optiboot_atmega328.hex uno256.bootloader.unlock_bits=0x3F uno256.bootloader.lock_bits=0x0F uno256.build.mcu=atmega328p uno256.build.f_cpu=16000000L uno256.build.core=arduino_256_serialbuf uno256.build.variant=standard

##############################################################

That's all you need to do. Now when you want a larger serial buffer (for a specific board) you just choose this as the board in the Arduino IDE and compile as normal. If you want to hack any other settings in the Arduino core, this is also an excellent way to do it without modifying the original source.

Step 4: Determine the Right Terminals and Connect Them!

The first picture above represents the contacts on your sony ericsson, each of them has a specific function:

  1. ATMS: audio to mobile
  2. AFMS/RTS: audio from mobile
  3. CTS/ONREQ: CTS/Mobile station on request.
  4. data in: data to mobile (Rx) (Tx for K300i)
  5. data out: data from mobile (Tx) (Rx for K300i)
  6. ACC in: Accessory control to mobile
  7. ACC out: Accessory control from mobile
  8. AGND: audio signal ground flash: flash memory voltage + service
  9. flash: flash memory voltage + service
  10. DGND: digital ground
  11. VCC: for battery charging + External accessory powering

We are interested in 3 contacts (four if you want to charge the cell of your arduino using the 5V terminal) the numbers 4, 5, 10 and the optional 11. I suggest you get a data cable. I didn't have one but i found on amazon.

if you want to use the 5V terminal of the arduino to power your phone so the battery doesn't get empty you'll need to determine how much voltage your phone requires to charge (look it up of check out the charger) and dial the 5V of you're arduino down using a voltage divider if necessary.

For the people with a data cable: there is a small chip in the usb end of the cable that prevents us from communicating with the phone so you'll have to cut the cable! If you cut is you'll see four cables inside: white, black, green and red. Strip the cables and use a multimeter to determine which one is the data in, the data out, the ground and the Vcc using the first picture above. Then connect the ground wire to the ground of the arduino, the data out wire to the Rx of the arduino, the data in wire to the Tx of the arduino and you're good to go.

Step 5: Do a Test!

If you load the code below to you're arduino it should dial to 1234 as in the picture above if not check if you didn't make any mistakes in previous steps. You can't load anything to the arduino wiht the Tx and Rx of the board connected to the phone, you'll get an out of sync error. You'll need to disconnect the Tx and Rx connections from your arduino, load the code, reconnect the wires, unhook the arduino from your PC, connect another power supply (you'll need another power supply for your arduino the USB port interferes with the communication to the phone) and reset the arduino. Your phone should start dialing 1234 after a few seconds.

The code:

void setup(){
Serial.begin(9600);

Serial.println("AT+CMGF=0"); //puts the phone in pdu mode

delay(3000); //processing time

Serial.println("ATD1234;+ENTER");

}

void loop(){

}

Think about it: you could enter your number and let the phone dial you if a sensor is activated by example! A temperature sensor, a movement sensor, a water sensor... You name it!

Step 6: Get to Know an Online PDU Encoder

Again this may sound a bit scary and complicated but trust me, it is fairly easy. I Have been using:

http://www.twit88.com/home/utility/sms-pdu-encode-...

The encoder allows you to see how your number looks like in PDU (the numbers get mixed up) and how a message looks like in PDU. Lets start, we'll be using the second part of the page on the link above.

  1. Fill in 0 in the SMSC area (we don't need this)
  2. Fill in the number of the cellphone you'll be using to send a message to the sonny ericsson connected to the arduino in the receiver area, we'll use that number to prevent anyone else from accessing your arduino. Don't forget to set your country code in front of your number.
  3. Set the Alphabet Size on 7 if it isn't already
  4. Lets start with filling in Hello world
  5. Press convert

I Filled in +32123456789 as receiver (+32, that's right i'm from belgium) and the result was:

0011000B912321436587F90000AA0BC8329BFD06DDDF723619

Notice can't find the number you filled in as receiver in the PDU string but... This part of the string: 2321436587F9 happens to have all the numbers but just mixed up.. It's not a happy accident trust me, find the part of the string that "matches" your number and write it down, the first two numbers (2 & 3 in my case) represent the country code you can leave them away, we won't need them (that leaves 21436587F9 in my case). We'll be using this in step7.

Now we already have the first part of the information we wanted (the number) but we of course also want the message part. I can now already tell you that 0BC8329BFD06DDDF723619. Finding out what your message part is is easy. Just fill something else in where you earlier filled in Hello world en see what part that changes. I want to control some relays so let's fill in light on and light off, you'll see the part at the end of the PDU string change, the part that changes is your message part! Result for light on: 08CCF4194D07BDDD. Result for light of: 09CCF4194D07BDCD66. You'll see that the message part is right behind the double A' in my case. You can use this method to translate anything you want to PDU and use it later in your program.

Step 7: Get to Know the Program

The encoder in step 6 is great but a real sms message in PDU code looks different, it's allot longer but the message part en the number part is the same and that's what we really need after all. A real message in PDU looks like this:

07912374151616F6040B912321436587F90000414080818403800BC8329BFD06DDDF723619

notice the underlined parts in the PDU string the first part is the number determined earlier and the second part is the message saying Hello world. The program will simply get those parts out using the substring command.

For the program to work you'll need to fill in your number (the one you should have wrote down in step 6) where the X's are (see picture above). The program works in a way the arduino will only listen if the message comes of the number you fill in where the X's are.

In the first picture above you'll see a part if(data= "+CMGR: 1,") if this occurs it means a message is being read for a second time (+CMGR: 0, means unread message) and because we delete every message after an action has been performed (see picture 2) it means an useless message has been sent. For example Liht on instead of Light on.

Download the program over here: download from dropbox (arduino - sonny ericsson gsm shield hack)

Step 8: Do Something Cool

is just a test setup i quickly put together and a you can see it works without a problem (I know I have bad filming skills).

I'm planning on building a contact box using these relays, I chose the 12V relays so i can feed them of the Vin of the arduino (I've got a 12V powersupply) and use the 5V for charging the phone so the battery never gets empty.

Step 9: Help! It Doesn't Work!

Oke let's do some troubleshooting, I'll discuss some possible problems.

Scenario 1: the phone doesn't even test dial in step 5

make sure you got the right connection, measuring them out with a multimeter is really handy! Make sure your phone supports PDU, search the internet for the pinout of the connectors of your phone and look for a possible fault. Are you using an external power supply? Feeding the arduino of a PC with usb will disturb the communication between the sony ericsson and the arduino.

Scenario 2: the phone succeeded the test dial in step 5 but doesn't work with final program.

Make sure you filled in you're PDU converted number in the program (in place of the X's). Did you disconnect the phone of the arduino for uploading the program? Did you make sure there weren't anny spaces behing your message part in the PDU encoder (step 6)? Did you send the message with the right phone? (the arduino will only listen to the preprogrammed PDU encoded number) Did you use the arduino with enlarged serial buffer (step3)?

Scenario 3: the phone succeeded the test dial in step 5, i'm sure I've done everything right and is still doesn't work.

I've wrote a little program to read a PDU string using a lcd screen (the phone is using you're serial communication) so you can read the PDU string yourself. Check if the substring commands don't need any changes for extracting the information. In my country the number is located from char 24 to 34 in the PDU string (=substring(24,34)). Maybe it's located somewhere else for your country. Do the same for the message part. notice I've been using a lcd screen with a I2C bus if you don't have any you'll need the modify the code lightly. I must say i highly doubt this problem occurring but i wanted to be complete and sure so I included it.

download the program for reading a PDU string with a lcd screen here: download from dropbox (read serial with I2C lcd)

Step 10: Some Thoughts

By this step you should be able to let an old sony ericsson cellphone read an sms, and let the phone call you using the ATD command of step 5. Participating in the remote control contest so if you like my instructable please give me a vote, I'd really appreciate it . Like I said before I'm from belgium so if made some huge writing errors let me know ;-)

I've been using the sony ericsson as a GSM-shield for weeks, sometimes I've let it run for a week and I've never had any problems. In my opinion it seems to be a good substitute for an expensive GSM-shield.

If you want you can access every function in your phone using the AT commands, it's great but it takes some getting used to. You'll need to do some research on internet though. Remember you cant use the serial connection to your computer and to your phone at the same time, is used a small lcd screen to display the serial communication between the arduino and the phone. Good luck!

Step 11: Sequal

You can also use this setup to send a message:

learn how to send an sms in pdu mode

<p>Great instructable! But could you make another one on how to show images\text on phone LCD?</p>
<p>You may add the t290i too :)</p>
<p>Hi Hemling,</p><p>I have T290i also, unfortunately it doesn't work on receiving or sending message. (step 5 is ok, i can do test dial using the phone)</p><p> did you follow all the steps or are there something missing from the steps?</p><p>I use arduino uno.</p><p>Please share what you did.</p><p>Thanks</p>
<p>very nice tutorial, it helped me to connect my T230 to arduino.</p><p>But T230 works in text mode :-)</p><p>Here's sample program (working) for sending, reading sms and making a call.</p><p>Not sure how to check if phone is charged or if it has connection with gsm provider..</p><p><a href="http://www.vsx.pl/arduino-i-sony-ericsson-t230-wysylanie-i-odbior-sms-dzwonienie-arduino-t230-sms-call-interface-rx-tx/" rel="nofollow">http://www.vsx.pl/arduino-i-sony-ericsson-t230-wys...</a></p>
<p>Hello! Now checked, you can add a list of model k300i.</p>
<p>Great, thanks!</p>
<p>You're welcome! But K550i connect, unfortunately, could not ... And directly soldered contacts, and through the plug ... but nothing succeeded.</p>
<p>Strange, any idea why? I updated the list.</p>
<p>The only logical explanation - UART missing (this is just an assumption). The reason for this assumption - direct USB connection to the PC. Remember, there were data cables with chips - adapters? And these are the phones that he demanded, can communicate with Arduino. But k550i is connected to the PC directly. I think so.</p>
<p>Hi! i have arduino leonardo and i dont know how to convert it into 256 buffer size<br>i've found this file:<br>HardwareSerial.cpp</p><p>but here is no line like this:<br>#define SERIAL_BUFFER_SIZE 64<br>so how can i change it to 256 ? <br><br>Plz help, i have everything to finish this project but first i have to change buffer size...</p>
<p>Hi! To be honoust i'd just buy an arduino uno, i haven't heard much good about the arduino leonardo.. You can find many cheap clones on sites like ebay and aliexpress. </p>
<p>Hi! After reading this article, specially find supported phone models (k550i), connect to the last four contacts (ground, rx and tx, +5v). Where is the rx, where the tx of data, I can not understand, trying to connect, and so therefore, tried to send commands to the code from your example, did not work, tried transhipped commands using Arduino, the answer is no ...</p><p>Here's a sketch that redirects the command in two directions:</p><p>#include &lt;SoftwareSerial.h&gt;</p><p>SoftwareSerial NSerial(8, 9); // RX | TX</p><p>long arduinoSpeed = 9600;</p><p>long phoneSpeed = 9600;</p><p>void setup()</p><p>{</p><p> Serial.begin(arduinoSpeed);</p><p> NSerial.begin(phoneSpeed);</p><p>}</p><p>void loop()</p><p>{</p><p> if (NSerial.available()) Serial.write(NSerial.read());</p><p> if (Serial.available()) NSerial.write(Serial.read());</p><p>}</p><p>The phone does not respond even to a command &quot;AT&quot;, however, via bluetooth telephone can be controlled, and it is responsible. Please help!</p>
<p>It's probably the software serial, I remember (it's been a while) trying the same thing but also without succes. </p>
<p>I tried, and directly through Serial.println send, with the same result.</p><p>But the solution to the problem should be!</p>
<p>Thanks michvw for reply : </p>
<p>After searching and studying about AT Commands I have found out this solution:</p><p><strong>void setup(){</strong></p><p><strong>Serial.begin(9600);</strong></p><p><strong>Serial.println(&quot;AT+CMGF=0&quot;); //puts the phone in pdu mode</strong></p><p><strong>delay(3000); //processing time</strong></p><p><strong>Serial.println(&quot;ATDXXXXXXXXXX;+ENTER&quot;);</strong></p><p><strong>}</strong></p><p><strong>void loop(){</strong></p><p><strong>}</strong></p><p><strong>XXX</strong>... is the other side phone number. It can be 10 or 12 digits according to your international or inside the country call.</p><p>I hope this will help you <b>michvw. </b>May be, you can create another instructable using this code with sensor. e.g heat sensor, PIR sensor ...etc. I need a kind of sensor that I want to protect my garden if the weather heat is going to under zero. For example, If it is +3 celcius during the winter, alarm will call my telephone. Thank you very much.</p>
Thank you for your research, have you tested the code?<br>I might write an similar instructable the comming weeks.<br>
<p>Tested. It dials.</p>
<p>Updated the instructable with the modified code for the test dial, thank you verry much!</p>
<p>I thank you. By the way, I managed to develop the and test the project which I wanted you write here. My project is about &quot; catching the intruder who enters someone's home or office, and catching a possible fire in the buildings. </p><p>For that reason, I don't need such kind of project now. Thanks.</p>
<p>Sir Plz ans can i done this project with my Arduino mega 2560.. if Yes Then what changes i need</p>
<p>shouldn't be a problem just follow the steps, in step 3 you'll need to modify the arduino mega 2560 core instead of the arduino uno core of course. Have fun!</p>
<p>Very usefull and smart instruction. Thank you very much. I'm very interested this section of your instruction:</p><p>&quot;The code:</p><p><em>void setup(){<br>Serial.begin(9600);</em></p><p><em>Serial.println(&quot;AT+CMGF=0&quot;); //puts the phone in pdu mode</em></p><p><em>delay(3000); //processing time</em></p><p><em>Serial.println(&quot;ATD1234&quot;);</em></p><p><em>}</em></p><p><em>void loop(){</em></p><p><em>}</em></p><p>Think about it: you could enter your number and let the phone dial you if a sensor is activated by example! A temperature sensor, a movement sensor, a water sensor... You name it!&quot;</p><p>of your instruction. Everything is okey, SonyEricsson K700i dials the other phone only for 3 seconds. For that reason, before ringing the other phone, SonyEricsson K700i stops the dialing. How can I fix this problem? Thanks a lot. </p>
<p>Hi,</p><p>I've been having the same problem, it's good code for testing however. I've been wanting to get the bug out but i haven't found the time. I found online that this might be better: ATD 1234; (note the semi-colon). </p><p>The source: <a href="http://developer.nokia.com/community/wiki/AT_Commands" rel="nofollow">http://developer.nokia.com/community/wiki/AT_Comma...</a> , note it's a nokia site, so this instructable should work on some nokia's to. </p><p>Let me know if you have any success will you? Thanks!</p>
<p>PLEASE HELP SAME ONE TELLE ME</p><p>i cant turn on or off the led / using sms from +21650016075 to +21621509433</p><p>can you uplode me the cod because i cant use the PDU mode please help</p>
<p>Are you saying that you're unable to put your phone in PDU mode?</p>
<p>yes - i covert the number using PDU mode - i put it in arduino but no switch on or off - </p><p>this is my cod - </p><p>//made by Michvw &amp; published at www.instructables.com</p><p>//make sure your using board: Arduino Uno(256Serial Buffer)!</p><p>//used for communication with sony ericsson</p><p>String Data;</p><p>//other parameters:</p><p>int relayPin = 13;</p><p>void setup()</p><p>{ </p><p> //setup communication with sony ericsson</p><p> Serial.begin(9600);</p><p> Serial.println(&quot;AT+CMGF=0&quot;); //sets the phone in PDU mode</p><p> delay(3000); //processing time</p><p> Serial.println(&quot;AT+CPMS=\&quot;ME\&quot;&quot;); //selecting the right sms memory ( \&quot; = &quot; in a string! )</p><p> delay(3000); //processing time sony ericsson</p><p> //setup other stuff</p><p> pinMode(relayPin, OUTPUT);</p><p>}</p><p>void loop(){</p><p> Serial.println(&quot;AT+CMGR=1&quot;); // = read the sms on index 1 (= oldest sms in the memory)</p><p> delay(3000); //processing time sony ericsson</p><p> while(Serial.available() &gt; 0){</p><p> char character = Serial.read(); // Receive a single character from the software serial port</p><p> Data.concat(character); // Add the received character to the receive buffer</p><p> if(character == '\n' || character == '\r'){</p><p> Data =&quot;&quot;;</p><p> }</p><p> //these 3 lines will delete the sms if you send a bad sms to the arduino. example: liht on instead of light on</p><p> if(Data == &quot;+CMGR: 1,&quot;){ //if this occurs it means the sms is being read a second time wich means no action was performed.</p><p> Serial.println(&quot;AT+CMGD=1&quot;); // deletes sms on index 1 </p><p> delay(3000); //processing time sony ericsson</p><p> }</p><p> if(Data.length() &gt; 55){</p><p> String temp = Data.substring(24,34); //position senders phone number</p><p> if(temp == &quot;56006170F5&quot;){ //ENTER THE NUMBER YOU FOUND IN STEP6 HERE!!! IT SHOULD BE 10 CHARACTERS LONG, THE ARDUINO WILL ONLY CONTROL THE MESSAGE IF THE NUMBER OF THE SENDER IS CORRECT! SO ONLY YOU CAN CONTROL IT </p><p> String input = Data.substring(52, Data.length()); //content sms message</p><p> checkinput(input);</p><p> }</p><p> }</p><p> }</p><p>}</p><p>void checkinput(String input){</p><p> if(input == &quot;08ECF4194D07BDDD&quot;){ // = light on</p><p> digitalWrite(relayPin, HIGH);</p><p> Serial.println(&quot;AT+CMGD=1&quot;); // deletes sms on index 1, action was performed so we don't need it anymore </p><p> delay(3000); //processing time sony ericsson</p><p> }</p><p> if(input == &quot;ECF4194D07BDCD66&quot;){ // = light off</p><p> digitalWrite(relayPin, LOW);</p><p> Serial.println(&quot;AT+CMGD=1&quot;); // deletes sms on index 1, action was performed so we don't need it anymore</p><p> delay(3000); //processing time sony ericsson </p><p> }</p><p>}</p>
<p>Hmmm, i can't spot a fault.. You should try to read the PDU strings the phone sends using a lcd screen (there's some code for it in my instructable).. First try sending: Serial.println(&quot;AT+CMGF=0&quot;); the phone should answer OK if it doesn't your phone doesn't support PDU. If it does support PDU try reading out the PDU string the phone sends out when recieving a sms (the example code in my instructable with the lcd is build for this) en see what is says. Good luck!</p>
the phone os sony Ericsson t610 . so i like to help me a bout sms received from number +21650016075 . help me to found 10 number in pdu mode
The 10 digit number you used seems to be correct..
<p>i used 10 digit - 56006170F5 - for reciver number is +21650016075 is it a correct or not please help me </p>
<p>Yes it is!! try read the previous comments, i already provided you with the answer there..</p>
The 10 digit number you used seems to be correct..
<p>why you dont like to help me / please help me to found a 10 digit from this sender +21650016075 / pelease </p>
<p>Hi michvw, great instructable! thank you very much, im trying it but im having troubles in step 3, at the step of the code, i modified all the libraries and codes, but in the Arduino IDE instead of displaying &quot;Arduino Uno (256 Serial Buffer)&quot; it displays &quot;Arduino Uno (256 Serial Buffer) uno256.upload.protocol=arduino uno256.upload.maximum_size=32256 uno256.upload.speed=115200...&quot; like the code added in the boards.txt . And at the moment of verifying the code it tells me that the board cant be recognized. Do you have any suggestions why is this happening? Thanks again :)</p>
<p>Hi,</p><p>thanks! I don't really know what went wrong there, i never had a problem over there. I can only guess you did something wrong, i suggest you just simply try it again. If you still don't have any luck try googling for another method to increase the buffer. I remember there being multiple solutions. Good luck!</p>
<p>Great Job! </p><p>I tried your test code on my Telekom branded Sony Ericsson T68i, it starts calling my number a few seconds, then it break up. The response over serial is #NO CARRIER... Do you have any suggestions on this? </p>
<p>Thanks!</p><p>Are you using a valid simcard? Are you connected to a carrier? I didn't encounter such a problem so my guess is it's not a problem in the code. Maybe you can try using another simcard and/or try dialing another number. Good luck!</p>
<p>Hi and thank you for your reply!</p><p>Yes, i&acute;ve tried calling the number without the arduino connected to the phone and that works fine. I&acute;ve also tried several numbers but same problem here. </p><p>Sometimes, after the calling break up, the T68 shows again calling the number entered in the code, but this second time i think the number is mixed up. (It only shows up for a few milliseconds). </p><p>I will test another sim-card if i get one. </p><p>All I need is &quot;light on&quot; if a predefined number is calling the Phone and i wanted to use your code as a starting point. </p><p>When I send &quot;AT+CLIP=1&quot; to the T68 and someone is calling the phone, the serialLCD is correctly showing me the callers number. My problem here is that i&acute;m totally newbie, my arduino arrived this week... and i&acute;ve got a lot of errors trying to get that callers number into a variable to work with in the arduino. Maybe someone is so nice to give me a hint on this. </p><p>Again, many thanks to you</p>
<p>Sound like a fun and perfectly possible project!</p><p>Don't worry about being a total newbie, writing arduino code is easy. I'd leave the calling for what it is since your goal is to read a callers number. It's a good idea to use my code for reading a sms to get started. I modified my code a bit to what i think should be what you need. I didn't test it because i don't have my T68 at hands for the moment. Here it is:</p><p>void loop(){</p><p> Serial.println(&quot;AT+CLIP=1&quot;); // = read the number of the calling (in the loop so it keeps checking even if nobody is calling</p><p> delay(3000); //processing time sony ericsson</p><p> while(Serial.available() &gt; 0){</p><p> char character = Serial.read(); // Receive a single character from the software serial port</p><p> Data.concat(character); // Add the received character to the receive buffer</p><p> if(character == '\n' || character == '\r'){ //not sure if these two lines will be anny good, test it out!</p><p> Data =&quot;&quot;; </p><p> }</p><p> if(Data.length() == 32){ //FILL IN THE LENGTH OF YOUR PHONENUMBER (the one you read out on your LCD</p><p> if(Data == &quot;XXXXXXXXXX&quot;){ //FILL IN YOUR PHONENUMBER</p><p> performaction();</p><p> }</p><p> }</p><p> }</p><p>}</p><p>void performaction(){</p><p> digitalWrite(relayPin, HIGH);</p><p> Serial.println(&quot;XXXX&quot;); //look for the PDU code to push end the call (that way you'll know when you're arduino performed the code)</p><p> delay(3000); //processing time sony ericsson</p><p> }</p><p>Note that this code will only allow you to put the light on (if the code works). You can modify it if you want it to put the light out as well, if you need any help just ask. Good luck</p>
<p>Great support! </p><p>again plenty test calls later i ended up with this:</p><p>// include the library code:</p><p>#include &lt;LiquidCrystal.h&gt;</p><p>// initialize the library with the numbers of the interface pins</p><p>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);</p><p>//used for communication with sony ericsson</p><p>String Data;</p><p>//other parameters:</p><p>int relayPin = 13;</p><p>void setup(){</p><p> // set up the LCD's number of columns and rows: </p><p> lcd.begin(16, 2);</p><p> // initialize the serial communications:</p><p> Serial.begin(9600);</p><p> Serial.println(&quot;AT+CMGF=0&quot;); //sets the phone in PDU mode</p><p> delay(3000); //processing time</p><p> Serial.println(&quot;AT+CLIP=1&quot;); //calling line identification </p><p> delay(3000); //processing time sony ericsson</p><p> //setup other stuff</p><p> pinMode(relayPin, OUTPUT); </p><p>//16x2 LCD with new lines <a href="http://forum.arduino.cc/index.php?topic=44097.5;wap2" rel="nofollow">http://forum.arduino.cc/index.php?topic=44097.5;wa...</a></p><p> int charcount;</p><p> boolean secondline;</p><p> if (Serial.available()) {</p><p> delay(200);</p><p> lcd.clear();</p><p> charcount = 0;</p><p> secondline = false;</p><p> while (Serial.available() &gt; 0) {</p><p> if (charcount &gt; 15 &amp;&amp; secondline == false ) {</p><p> lcd.setCursor(0,1);</p><p> secondline = true;</p><p> }</p><p> lcd.write(Serial.read());</p><p> charcount++;</p><p> }</p><p> }</p><p>}</p><p>void loop()</p><p>{</p><p> while(Serial.available() &gt; 0){</p><p> char character = Serial.read(); // Receive a single character from the software serial port</p><p> Data.concat(character); // Add the received character to the receive buffer</p><p> }</p><p> if(Data.length() &gt; 30){ //will exceed if someones calling</p><p> String temp = Data.substring(18,30); </p><p> if(temp == &quot;XXXXXXXXXXXX&quot;){ //FILL IN YOUR PHONENUMBER</p><p> performaction();</p><p> lcd.clear();</p><p>// prints the number on the screen</p><p>lcd.print(&quot;CLIP&quot;);</p><p> lcd.print(temp);</p><p> delay(100);</p><p> }</p><p> }</p><p>}</p><p>void performaction(){</p><p> digitalWrite(relayPin, HIGH); //light on</p><p> Serial.println(&quot;AT+CHUP&quot;); //action performed -&gt; hang-up</p><p> delay(3000); //processing time sony ericsson</p><p> // delay(10000); //auto light off after 10seconds</p><p> // digitalWrite(relayPin, LOW);</p><p>}</p>
<p>Does this code work continuous? Or do you have to reset the board everytime you make a new call? I'm a bit confused because you have allot of code in the setup of the program (this part only gets excecuted once by the arduino). Nice progress!</p>
<p>no, you have to restart the arduino.</p><p>that is one of the problems i&acute;m &quot;working&quot; on... </p><p>if i put the CLIP command in the loop,</p><p>i&acute;m not able to fetch the phone number out of the string. </p><p>Again and again many thank, you gave me a great tut to start with.</p>
<p>This should help you to get a bit further, good luck:</p><p>//made by Michvw &amp; published at www.instructables.com</p><p>// include the library code:</p><p>#include &lt;LiquidCrystal.h&gt;</p><p>// initialize the library with the numbers of the interface pins</p><p>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);</p><p>//used for communication with sony ericsson</p><p>String Data;</p><p>//other parameters:</p><p>int relayPin = 13;</p><p>boolean secondline = false;</p><p>void setup()</p><p>{ </p><p> // set up the LCD's number of columns and rows:</p><p> lcd.begin(16, 2);</p><p> //setup communication with sony ericsson</p><p> Serial.begin(9600);</p><p> Serial.println(&quot;AT+CMGF=0&quot;); //sets the phone in PDU mode</p><p> delay(3000); //processing time</p><p> //setup other stuff</p><p> pinMode(relayPin, OUTPUT);</p><p>}</p><p>void loop(){</p><p> Serial.println(&quot;AT+CLIP=1&quot;); // check if someone is c</p><p> delay(3000); //processing time sony ericsson</p><p> while(Serial.available() &gt; 0){</p><p> char character = Serial.read(); // Receive a single character from the software serial port</p><p> lcd.write(character); //show te recieved character on the lcd</p><p> Data.concat(character); // Add the received character to the receive buffer</p><p> if(character == '\n' || character == '\r'){//this will reset your data string when a new line comes throught your serial, verry handy!</p><p> Data = &quot;&quot;;</p><p> }</p><p> if(Data.length() &gt; 15){</p><p> lcd.setCursor(0,1);</p><p> secondline = true;</p><p> }</p><p> if(Data.length() &gt; 30){</p><p> String temp = Data.substring(18,30); //position callers phone number</p><p> Data = &quot;&quot;; //reset the data string, you don't need it anny more. Now its empty again for the next time someone calls</p><p> if(temp == &quot;XXXXXXXXXX&quot;){ // your number</p><p> lcd.print(&quot;CLIP&quot;);</p><p> lcd.print(temp);</p><p> delay(100);</p><p> performaction();</p><p> }</p><p> }</p><p> }</p><p>}</p><p>void performaction(){</p><p>digitalWrite(relayPin, HIGH); //light on</p><p>Serial.println(&quot;AT+CHUP&quot;); //action performed -&gt; hang-up</p><p>delay(3000); //processing time sony ericsson</p><p>// delay(10000); //auto light off after 10seconds</p><p>// digitalWrite(relayPin, LOW);</p><p>}</p>
<p>It's because you made some programming errors. You can't make a sepperate if-statement for you're LCD screen you have to implement everything in the while(Serial.available() &gt; 0) loop. Otherwise you'll get the following scenario:</p><p>loop{</p><p>if(Serial.available() &gt; 0){ //read data for LCD }</p><p>while(Serial.available() &gt; 0) {//read data for proccesing}</p><p>}</p><p>problem with this is that you'll read al the serial data in the if statement for displaying it on your LCD and only after that you'll go tot while loop but then the serial data has been read out and there's nothing left you need to work like this:</p><p>loop{</p><p>while(Serial.available() &gt; 0) {</p><p>//read data for proccesing AND display it on the LCD at the same time.</p><p>}</p><p>It's a newbie mistake. Don't worry about it communicating in PDU through serial isn't easy. I'll try writing some more basecode for you start from. </p>
Great instructable! I'd love to see another instructable about how to send an sms in PDU mode.
<p>Done! Here it is: </p><p><a href="https://www.instructables.com/id/Arduino-sony-ericsson-gsm-shield-hack2/" rel="nofollow">https://www.instructables.com/id/Arduino-sony-erics...</a></p>
<p>Thanks! I might include it in a feature update if I find the time.</p>
<p>Hello dgx,</p><p>I would like to use a DRS 11 cable to connect an old Sony Ericsson to my arduino...</p><p>How have you modified the DRS-11 cable ? only by cutting the RS-232c connector (computer side) ? I heard that part contains some electronics components which could damage the arduino...</p><p>Thanks for your help.</p>
<p>Thanks for sharing how to increase serial buffer size !</p><p>In my project T68i is connected to the Arduino which read pressure sensor MPX5050DP for aquarium pump surveillance.</p><p>5V supply for Arduino and sensor are provided by DC-DC adapter MCP16251 from pin 11 of T68i this give me some power autonomy. </p><p>I use a modified DRS-11 cable, the phone is constantly powered with 220V ac adapter.</p><p>My question is if you know a software or hardware method for automatically restart the T68i phone after battery depletion when power supply voltage is back?</p><p> Thanks again !</p>

About This Instructable

31,615views

126favorites

License:

More by michvw:Arduino & sony ericsson: gsm shield hack2 arduino & sony ericsson: gsm shield hack 
Add instructable to: