|
I made progress on
the cell phone hacking project. The basic concept was to be able to use a
cellphone instead of a cellular shield with the Arduino to send text messages
via serial.
First things first I
needed to find out how the cellphone (I bought a Motorola AND Sim card )would communicate with the Arduino via the TTL serial port of
the phone which is just located in the headset jack on the top of the phone. The
phone uses and is controlled using AT Commands (Here is a
very helpful website about AT commands).
I just used a TRS
headset plug that I bought from Amazon (here
is the link) compatible with the cellphone to make the connection between the
Phone and the Arduino.
I soldered a wire to
each of the three connectors on the TRS plug. I used the Tip connector as the
TX connection (going to the Arduino), the ring connector as the RX connection
and finally the sleeve connector as the ground.
Balanced TRS cable
Once the wires were soldered on the TRS, it just became a matter of connecting everything together. So I plugged in the TRS cable in the headset jack of the phone and used the soldered wires to go on the arduino ( pins 2 and 3) which can be seen below in the fritzing schematic.
Testing
So to test
this out I plugged in the headset , pushed the button and waited to receive the
message on my cellphone.
The code I
used to test this out was pretty basic. I used the Arduino’s software library to
set up a software serial connection on pins 3 and 2 ( RX and TX pins). Due to excessive power management of the phone
It was required to send something over the serial connection to wake the phone
up first and then put it
in text mode. Naturally, after that I just
created my text message (from the code) and send it to my number then deleted
the message from the phone’s outbox after it’d been sent.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,2); // my pins 2 and 3 I used as
RX, TX
void setup()
{
pinMode(13, OUTPUT); // pin 13 digital out
pinMode(8, INPUT); // pushbutton
mySerial.begin(4800); // serial connection baud rate 4800
}
void loop(){
if (digitalRead(8)
== HIGH){ // If button pressed
digitalWrite(13, HIGH); // LED on.
mySerial.println("AT"); // wake up cell phone (Send
AT command)
delay(1000); //
wait a second
mySerial.println("AT+CMGF=1"); //phone goes in
text mode
delay(1000);
mySerial.println("AT+CMGW=\"+1413645####\"");
// destination number
delay(1000);
mySerial.print("testing out my arduino cellphone .");
// message composed
delay(1000);
mySerial.write(byte(26)); // (signals end of message)
delay(1000);
mySerial.println("AT+CMSS=1"); // message sent
digitalWrite(13, LOW); // LED off
delay(250);
digitalWrite(13, HIGH); // LED on.
delay(10000); // wait for the phone to send
mySerial.println("AT+CMGD=1"); // Deletes
message after reception
digitalWrite(13, LOW); // LED off.
delay(250);
}
}
|
http://www.developer.nokia.com/Community/Wiki/Using_AT_commands_to_send_and_read_SMS
No comments:
Post a Comment