Introduction: Arduino Text'in

Arduino text‘in.

Key Features:
24 relays controlled by 4 I/O lines!
Cell phone text using your Arduino.

This project hacks a cell phone to text using normally open relays. After investigating cellular modules on the internet I decided it looks not only rather pricy, but also like a possibility that even after I had it working that a cellular provider might not let me put the device on their network. It seemed like a good cell phone hack was in order to make this work for me.

Step 1:

Purchase a cheap prepaid flip phone, activate and charge it. Mine was $20.00.

Flip phones are fairly easy to disassemble. You will need a very small screw driver set. The button pads on the inside are still large enough to allow for soldering wires in place without too much trouble. The prepaid plans let you text for pretty cheap too if you pick the right plan. Plus because its prepaid you can just let it run out whenever you are finished with it and best of all no contract.

Turn on the flip phone and take some notes about how it operates. Yours may access menus and things differently then mine does and its nice to know as you move forward with this.

Figure out what keys you still want to have access to once the phone is mounted. Because I used a prepaid phone I have to access it now and then to add more air time. It is also helpful to know how things are going with the phone when you can turn it on and activate it with the buttons after it is mounted to the board. The buttons on your cell phone board will be connecting directly to the phone. This way you can access the phone even if the rest of the circuit is off or maybe just doing other things.

Safety First. Remove the battery from the phone. Tear apart the flip phone. The circuit board inside is pretty delicate and has some sharp parts so use some caution. Do not break the LCD displays and be very careful not to destroy the very small ribbon cables that interconnect things. The part of the phone that houses the LCD, microphone and usually the camera will need to be taken completely out of the case. The flip phone I purchased had enough room to flip the camera around so that it can still take pictures. The case for the main board of the phone (where the battery is) will need to stay more or less intact. This makes it easier to put the battery back in and your not messing with the built in antenna so it should still have its normal signal strength.

Step 2:

Purchase / scavenge some electronics parts.
1 - Arduino Uno
24 - Normally Open buttons. These will replace the buttons on the phone.
3 - 74HC374 Octal D-Type Flip-Flop chips.
24 - Reed relays. I had a bunch laying around.
24 - NPN general purpose. I used 2N2222.
24 - 20 K Ohm resistors
24 to 48 General purpose diodes
  You don’t have to go overkill like I did. At minimum you need one diode across the relay coil to prevent voltage spikes when the coil turns off.
1 - Board to mount relay stuff.
1 - Board to mount cell phone
A bunch of jumper wires. Keep them neat. It makes it easier to trouble shoot.
1 - 12 volt power for relays.
1 - 5 volt power for 74hc374’s and Arduino.

Step 3:

Layout your buttons on your board more or less like they are laid out on the cell phone. This makes it easier to know what buttons you are pressing. Notice that I have not used a few of the buttons.

Step 4:

Find some small fairly flexible cable to use for all of the interconnecting soldering you are going to be doing. I used some spare ribbon cable. I cut it longer then I would need. I then tinned and  trimmed the end to go to the phone. Leave your wires long here because it is easier to cut wire off then it is to try to re-solder them. The circuit board on the phone can easily be damaged by too much heat so use caution. I found it easier to start with the button pads closest to my new buttons and move my way up from there.

Step 5:

Once you have the part of the phone that houses the LCD apart you may need to cut or drill a hole in the mounting board for the ribbon cable to go through. The LCD will be mounting on the same side as the new buttons. I used some two sided tape to mount it. The main part of the cell phone will be mounted on the other side so it is closer to the relays.

Step 6:

Before soldering the wires to the button pads on the phone check to be sure you are using normally open buttons also verify the way you have them soldered. The buttons on the phone board will also be going off to the relay board so your going to need some more ribbon cable.

I found it was easier if I mounted the cell phone body and LCD before I soldered to the buttons on the cell phone board. Be careful not to scratch the phones LCD.

Once you have all of the buttons on the phone board soldered and interconnected to the cell phone pads you can move on to getting the relay board assembled.

Step 7: RELAY BOARD

I love to expand the I/O on things as far as I can.
I use to have a few 74HC164 serial in, parallel out shift registers. I tried to order some more through a local electronics place and two years later I am still waiting for them to get in. Geographical oddity or something. So one day as I was looking at the circuit diagram for the 74hc164. I noticed it was similar to the 74hc374 except there would have to be some jumpers to make it function properly. The cool part about these is that it only takes two I/O (clock and data) to control up to eight outputs!
If you take more then one chip and tie all of the data lines together and only clock the one you want to have responding you can do even more. I tied 3 chips together and have 24 relays at the cost of 4 I/O.
I love that!

The 74hc374's needs 5 volts to operate. I built a regulator circuit with a 7805 voltage regulator and a few other components. Plus you can take the input 12 volts for powering the relays to run your 5 volt regulator.

Step 8:

The relay board is a bit of an undertaking.
Do some good planning on lay out of your parts and its not too bad for soldering to a through hole solder board. If you need some help in the planning take a close look at the pictures. This board took a little while to put together so don’t get frustrated with it too quickly. Also, like they say there is more then one way to skin your knees… Anyway. The relay circuit I used worked for me. If you have a relay circuit you like, use it in place of the one I used. Its a good idea to bread board it first, or even a part of it to make sure it is going to work. It is not fun to get something all soldered together just to find something doesn’t like something else. The diode across the coil of the relay is important. If you decide not to use it don’t be surprised when things start acting funny and then one day decide not to work again. When the coil of the relay is turned off it can generate some reverse voltage spikes. That is not good for your circuit.

The heat sink in the middle of my board has the 7812 voltage regulator under it. If you use a wall wart you wont have that taking up room on your board.

Step 9:

The back side of my relay board.

Step 10:

Once you have the relay board built decide what relay numbers are going to be for what buttons on the phone.
Mine are set up this way so this will match my program.

Chip 1 Relay 1 = Left select key
Chip 1 Relay 2 = up directional arrow key
Chip 1 Relay 3 = Right select key
Chip 1 Relay 4 = left directional arrow key
Chip 1 Relay 5 = OK key
Chip 1 Relay 6 = right directional arrow key
Chip 1 Relay 7 = down directional arrow key
Chip 1 Relay 8 = Direct to text messaging key. May not be on all phones.
Chip 2 Relay 1 = Send key
Chip 2 Relay 2 = Clear key
Chip 2 Relay 3 = End/Power key
Chip 2 Relay 4 = Number 1 key
Chip 2 Relay 5 = Number 2 key
Chip 2 Relay 6 = Number 3 key
Chip 2 Relay 7 = Number 4 key
Chip 2 Relay 8 = Number 5 key
Chip 3 Relay 1 = Number 6 key
Chip 3 Relay 2 = Number 7 key
Chip 3 Relay 3 = Number 8 key
Chip 3 Relay 4 = Number 9 key
Chip 3 Relay 5 = Star key
Chip 3 Relay 6 = Number 0 key
Chip 3 Relay 7 = Pound/Space in text key
Chip 3 Relay 8 = Spare. Connect to self destruct if you like.

Step 11: PHONE TESTING

Start with testing all of the new buttons that you soldered to the phone board.

These should all be going directly to the phone and shouldn’t need to have any power to the rest of the circuit.

Press what should be your end/power button to turn on the phone. Press each of the buttons and make sure they are correct. Example, If you press what should be button number 4 and something else pops up on the phone you need to check out your wiring on the buttons to the cell phone pads and do some correcting. If you don’t do the correcting your relays will probably be off too.

If everything here checks out you are good to move on.

Step 12: ADJUSTMENTS TO THE PHONE

My phone is a part of a larger project and it is built with that in mind.
You will need to delete the existing quick text. Then add some new quick text into the quick text section of your phone.
Mine are as follows.

Quick text number 1 = “ Error”
Quick text number 2 = “ Run time”
Quick text number 3 = “ Day low”
Quick text number 4 = “ Day high”
Quick text number 5 = “Outside”
Quick text number 6 = “Inside”
Quick text number 7 = “ Voltage”
If you want to send other things just make the adjustments in the quick text and in the program.

I text more then just myself whenever I send something so I decided to put everyone who should get a text in as a contact and then added them into group 1 in the grouping of the phone. You will want to add your number to this group so it can text you as we move on.

Also my phone has the enter key (like to go to next line) stored in the symbols.
If all of this seems to line up with what you have. Load my code.

Be ready to hit the end key a bunch if things are not just right.

Step 13: My Program

/*
10-11-2012 RAY McQUEEN
This is the completed cell phone project

The cell phone button arrangements work for the phone I have.
You may have to do some investigation on the phone you use.


*/
//
///////////////////////////
//74HC374 CHIPS TO RELAYS//
///////////////////////////
//
const int phn_data = 9; //74xx374 pin 3 data
const int phn_clk1 = 8; //74xx374 chip 1 clock
const int phn_clk2 = 7; //74xx374 chip 2 clock
const int phn_clk3 = 6; //74xx374 chip 3 clock
//
///////////////
//PHONE STUFF//
///////////////
//
int phn_A = 0; //character to be shifted, used in phn_on & chip1-3
int phn_B = 0; //relay number to use
//
//////////////////////////////////////
//THESE ARE FOR BREAKING OUT NUMBERS//
//////////////////////////////////////
int val1000s = 0;//register to hold 1000 count
int val100s = 0;//register to hold 100 count
int val10s = 0;//register to hold 10 count
int val1s = 0;//register for 1 count
int test_test = 0;//register to store number for testing/time also
int tst_val = 0; //place to store a copy for breaking out number
int voltage = 0;//storage for a number to test for sending
int copy = 0;//copy of whatever I put in it
//
int phn_val = 375; //relay on time (375 works very well) for phone
//
//***ARRAYS***
//arrays count starts at 0 not 1 and goes up
//
int phn_relays[] = {
  //this is for choosing the relay number to turn on
  //We only want one relay on at a time.
  0, 1, 2, 4, 8, 16, 32, 64, 128, 256 };
//
//
//
void setup() {
  pinMode(phn_data, OUTPUT); //define pin9 as output
  pinMode(phn_clk1, OUTPUT); //define pin8 as output
  pinMode(phn_clk2, OUTPUT); //define pin7 as output
  pinMode(phn_clk3, OUTPUT); //define pin6 as output
  //
  ////////////////
  //END OF SETUP//
  ////////////////
}
//
///////////////////
//BEGIN MAIN LOOP//
///////////////////
//
void loop() {
  //
  delay(30000);//wait for a little while before starting
  //
  measure();//pretend to take some kind of reading
  //
  clr_all();//make sure all relays are clear
  //
  ray_show();//writes "Arduino text'in" on 1st line "Ray McQueen" on second line.
  //but doesnt send as text
  delay(10000);//wait 10 seconds
  norm_send();//send a normal text
  //
  delay(30000);
  delay(30000);
  delay(30000);
  delay(30000);
  //
  ////////////////////
  //END OF MAIN LOOP//
  ////////////////////
  //
}
//
//
//
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//BEGIN PHONE ROUTINES                      \\
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
//this sends to all people added into the base group
void norm_send() {
  delay(phn_val);
  phn_on();
  delay(30000);// 30 seconds delay so phone can start up
  //
  norm_text();//this opens the text window
  //
  phn_compose();//compose inside outside text
  //
  delay(5000);//wait for message to send
  e_nd();//message is sent. Turn off the phone
  delay(phn_val);
  e_nd();
  delay(phn_val);
  e_nd();
  delay(phn_val);
  phn_on();
  delay(10);
}
//
//
//this doesnt send a text
//it loads waits for a few then deletes text and shuts back down
void ray_show() {
  delay(phn_val);
  phn_on();//turn on phone
  delay(30000);// 30 seconds delay so phone can start up
  //
  norm_text();//this opens the text window
  //
  //this adds the "Aduino text'in Ray McQueen"
  ard_text();//
  //
  delay(30000);//wait to be able to read message
  e_nd();//message is complete. Turn off the phone
  delay(phn_val);
  e_nd();
  delay(phn_val);
  e_nd();
  delay(phn_val);
  phn_on();//turn phone back off in prep for normal text
  delay(10);
}
//
//nothing needs to be loaded before getting here
//this handles phone to turn on and off
//the phone will need 30 seconds more if powering up
void phn_on() {
  phn_B = 3;//relay 3
  phn_A = (phn_relays[phn_B]);//aray for the relay to turn on
  //select chip 2 relay number 3
  shiftOut(phn_data, phn_clk2, MSBFIRST, phn_A);
  delay (3000); //delay 3 seconds
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk2, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored in val
}
//
//this is to add the group for everyone and get to the
//text window so a text may then be composed
//this assumes the phone is already powered on but may
//be in standby
void norm_text() {
  //wake up phone in case in standy
  e_nd();
  //
  e_nd();
  //
  dir_text();
  //new text message
  numb_1();
  //text message
  numb_1();
  //add
  r_sel();
  //
  numb_4();
  //
  ok();
  //
  ok();
  //
  //the text window is now open and ready for text input
}
//
//*******************************************
//these are for calling the correct relays
//by the key name instead of having to remember the
//number to load into B and the chip number
//
void l_sel() {
  phn_B = 1;
  chip_1();//left select key
  delay(phn_val);
}
//
void r_sel() {
  phn_B = 3;
  chip_1();//right select key
  delay(phn_val);
}
//
void up_arrow() {
  phn_B = 2;
  chip_1();//up arrow key
  delay(phn_val);
}
//
void l_arrow() {
  phn_B = 4;
  chip_1();//left arrow key
  delay(phn_val);
}
//
void r_arrow() {
  phn_B = 6;
  chip_1();//right arrow key
  delay(phn_val);
}
//
void down_arrow() {
  phn_B = 7;
  chip_1();//down arrow key
  delay(phn_val);
}
//
void ok() {
  phn_B = 5;
  chip_1();//ok key
  delay(phn_val);
}
//
void dir_text() {
  phn_B = 8;
  chip_1();//direct to text key
  delay(phn_val);
  delay(phn_val);
}
//
void s_end() {
  phn_B = 1;
  chip_2();//send key
  delay(phn_val);
}
//
void c_lear() {
  phn_B = 2;
  chip_2();//clear key
  delay(phn_val);
}
//
void e_nd() {
  phn_B = 3;
  chip_2();//end key
  delay(phn_val);
}
//
void numb_1() {
  phn_B = 4;
  chip_2();//number 1
  delay(phn_val);
}
//
void numb_2() {
  phn_B = 5;
  chip_2();//number 2
  delay(phn_val);
}
//
void numb_3() {
  phn_B = 6;
  chip_2();//number 3
  delay(phn_val);
}
//
void numb_4() {
  phn_B = 7;
  chip_2();//number 4
  delay(phn_val);
}
//
void numb_5() {
  phn_B = 8;
  chip_2();//number 5
  delay(phn_val);
}
//
void numb_6() {
  phn_B = 1;
  chip_3();//number 6
  delay(phn_val);
}
//
void numb_7() {
  phn_B = 2;
  chip_3();//number 7
  delay(phn_val);
}
//
void numb_8() {
  phn_B = 3;
  chip_3();//number 8
  delay(phn_val);
}
//
void numb_9() {
  phn_B = 4;
  chip_3();//number 9
  delay(phn_val);
}
//
void numb_0() {
  phn_B = 6;
  chip_3();//number 0
  delay(phn_val);
}
//
void star_key() {
  phn_B = 5;
  chip_3();//star key
  delay(phn_val);
}
//
void pound_key() {
  phn_B = 7;
  chip_3();//pound key/space in text
  delay(phn_val);
}
//
//**************************************
//
// B needs to be loaded with the relay to turn on before gets here
void chip_1() {
  //use this for the first 8 relays
  phn_A = (phn_relays[phn_B]);//array for the relay number to turn on
  shiftOut(phn_data, phn_clk1, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk1, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
}
//
// B needs to be loaded with the relay to turn on before gets here
void chip_2() {
  //use this for the second 8 relays
  phn_A = (phn_relays[phn_B]);//array for the relay number to turn on
  shiftOut(phn_data, phn_clk2, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk2, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
}
//
// B needs to be loaded with the relay to turn on before gets here
void chip_3() {
  //use this for the third 8 relays
  phn_A = (phn_relays[phn_B]);//array for the relay number to turn on
  shiftOut(phn_data, phn_clk3, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk3, MSBFIRST, phn_A);
  delay(phn_val); //delay the amount of time stored
}
//
//
void measure() {
  //This takes a number and breaks it out to press the
  //proper buttons on the phone to send that number
  voltage = (95);//Any test number to send
  //
  //test 1000s
  val1000s = 0;//clear 1000 register
  test_test = voltage;//copy contents of voltage for testing
  while (test_test >= 1000) {
    test_test = test_test - 1000;//take away 1000 until you have no more
    val1000s++;//add one for each 1000 you have
  }
  //test 100s
  val100s = 0;//clear hundreads register
  while (test_test >= 100) {
    test_test = test_test - 100;//take away 100 until you have no more
    val100s++;//add one for each 100 you have
  }
  //test 10s
  val10s = 0;//clear tens for testing
  while (test_test >= 10) {
    test_test = test_test - 10;//take away 10 until you have no more
    val10s++;//add one for each 10 you have
  }
  //remainder is the ones
  val1s = test_test;//whats left over is you ones
  //
  //end testing
  //the number that was stored in test_test is now be broken
  //out into four register
  //val1000s = the number of 1000's in the test number
  //val100s = the number of 100's in the test number
  //val10s = the number of 10's in the test number
  //val1s = remainder, the number of 1's in the test number
  //
}
//
//
//This is used to enter the actual reading into the text to
//be sent from the phone. These are numbers to be entered
void phn_temps() {
  switch (copy) {
    case 0://number 0
    numb_0();
    break;
    //
    case 1://number 1
    numb_1();
    break;
    //
    case 2://number 2
    numb_2();
    break;
    //
    case 3://number 3
    numb_3();
    break;
    //
    case 4://number 4
    numb_4();
    break;
    //
    case 5://number 5
    numb_5();
    break;
    //
    case 6://number 6
    numb_6();
    break;
    //
    case 7://number 7
    numb_7();
    break;
    //
    case 8://number 8
    numb_8();
    break;
    //
    case 9://number 9
    numb_9();
    break;
  }
}
//
//
//THE TEXT WINDOW MUST BE OPEN BEFORE GETTING HERE
void phn_compose() {
  l_sel();//Abc mode
  numb_8();//Quick text
  numb_6();//Inside
  pound_key();//space
  l_sel();//Abc mode
  numb_5();//make sure its set for 123 mode
  if (val1000s >= 1) { //test to see if it needs to be blank
    copy = val1000s;//get a copy of register
    phn_temps();//figure out which number to press
  }
  if (val1000s >= 1 && val100s >= 1) {
    copy = val100s;//get copy of register
    phn_temps();//figure out which number to press
  }
  copy = val10s;//get copy of register
  phn_temps();//figure out whick number to press
  copy = val1s;//get copy of register
  phn_temps();//figure out which number to press
  l_sel();//Abc mode
  numb_6();//symbols
  r_sel();//1st symbol set
  r_sel();//2nd symbol set
  numb_9();//symbol 'return' key
  l_sel();//Abc mode
  numb_8();//quick text
  numb_5();//'outside'
  pound_key();//space
  l_sel();//Abc mode
  numb_5();//make sure its set for 123 mode
  if (val1000s >= 1) { //test to see if it needs to be blank
    copy = val1000s;//get a copy of register
    phn_temps();//figure out which number to press
  }
  if (val1000s >= 1 && val100s >= 1) {
    copy = val100s;//get copy of register
    phn_temps();//figure out which number to press
  }
  copy = val10s;//get copy of register
  phn_temps();//figure out whick number to press
  copy = val1s;//get copy of register
  phn_temps();//figure out which number to press
  ok();//send text
}
//
void ard_text() {
  l_sel();//Abc mode
  numb_3();//Abc
  numb_2();// A
  numb_7();
  numb_7();
  numb_7();//r
  numb_3();//d
  numb_8();
  numb_8();//u
  numb_4();
  numb_4();
  numb_4();//i
  numb_6();
  numb_6();//n
  r_arrow();//needed between letters on same number
  numb_6();
  numb_6();
  numb_6();//o
  pound_key();//space in text
  numb_8();//t
  numb_3();
  numb_3();//e
  numb_9();
  numb_9();//x
  numb_8();//t
  l_sel();//Abc mode
  numb_6();//symbols
  numb_9();//'
  numb_4();
  numb_4();
  numb_4();//i
  numb_6();
  numb_6();//n
  l_sel();//Abc mode
  numb_6();//symbols
  r_sel();
  r_sel();
  numb_9();//enter
  l_sel();//Abc mode
  numb_3();//Abc
  numb_7();
  numb_7();
  numb_7();//R
  numb_2();//a
  numb_9();
  numb_9();
  numb_9();//y
  pound_key();//space in text
  l_sel();//Abc mode
  numb_3();//Abc
  numb_6();//M
  numb_2();
  numb_2();
  numb_2();//c
  l_sel();//Abc mode
  numb_3();//Abc
  numb_7();
  numb_7();//Q
  numb_8();
  numb_8();//u
  numb_3();
  numb_3();//e
  r_arrow();//needed between letters on same number
  numb_3();
  numb_3();//e
  numb_6();
  numb_6();//n
}
//
void clr_all() {
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk1, MSBFIRST, phn_A);
  delay(10); //small delay
  //
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk2, MSBFIRST, phn_A);
  delay(10); //small delay
  //
  phn_A = 0;// this will clear the relay
  shiftOut(phn_data, phn_clk3, MSBFIRST, phn_A);
  delay(10); //small delay
}
//
//
//

Hack It! Contest

First Prize in the
Hack It! Contest