Wednesday, February 15, 2012

Hacking the Nokia 3310 as a cheap Arduino SMS Shield

Back to my home in Shah Alam, I have a problem with the main power supply (the 240VAC that is). Still not knowing the cause, it used to trip (breaker cut-off) occasionally without any reasonable reason, especially during heavy rain and thunderstorms. It bothers me a lot since I have a PC and fridge that need to be turned ON 24hrs a day. This become real problem when I'm out from home during the long holiday, the power trip without me knowing it, and when going back from the holiday, everything in the fridge was lost and bad smell conquering my whole house. I never like the smell.. darn! x:(

So I am thinking myself, wouldn't be great if my home could inform me (at least by sms) that the main power supply was down and then I could reply back to the home to switch on the main circuit breaker back again so that the fridge can continue to run. Since I already have my Arduino Diecimilia lying around (and not attach to any other project) then all I need is a GSM module shield where I can program it to send sms or to receive sms to do any specific job (e.g turn on the main breaker).

After some time looking through the net (from eBay to be exact) for any cheap GSM module, my search was a disappointment. I could not get any of the module for less than USD40 plus the shipping, which is way over my budget. And also it could take me some time to learn on how to program my Arduino to communicate with those module (its been a while I'm not doing programming after quitting my job as an engineer :-P )..

Then I'm looking for other simple solution other than using the GSM module. An idea came across my mind after looking at my old-but-still-working Nokia 3310 in my storage box (i still kept the phone for a nostalgic reason). Why not just hack the phone (i'm not using that phone anyway) with some relays to duplicate the 'button-pressing' action and tell it to send sms to any number saved in the phone book. It just a simple yet cheap solution to my problem. All I need to buy is new battery and charger since the original battery was fully depleted and cannot be charge anymore. Luckily for me, there are still peoples selling the OEM battery. Fuh!

The Phone Hack

After charging the battery and switching on the phone, I'm confirmed that the phone is still working as expected. So I started to open up the covers (front and rear - just use small screwdriver to pry the left/right side). The keypad will follow the front cover easily when I open it. Then there are six small screw around the lcd panel (red-marked in picture). It is not the normal philips-type screw and I need to use the Torx T5 screw driver instead. Need to pry a little bit more on both side of the lcd screen in order to open up the panel.


Finally, I have found what I'm looking for. The PCB board! (sorry..picture taken after I soldered the wire. duh!)


Here is the close-up of the soldered wire. I just need 2 button (OK and DOWN) to control the sending sms sequence since the message and phone number are already saved in the phone itself.


Need to put some black pvc tape to prevent it from shorting and I don't want any unnecessary button press to happen. (*please note that doing this will make both buttons is unavailable to be pressed anymore. you'll need some other button on the shield to by-pass)


Done with the wires, now its time to put back the phone all together again. Start with the lcd panel, screws and finally the phone cover. Pictures below shows how I route the wires through the battery and the rear cover. This is why we need to use the thinnest wire available. Its very tight space there.




As you can see in the picture, I need to cut some small hole to taken out the wires. Or else the rear cover won't fit. Finally, I soldered 2x 2-pin connector at the end of the wires that will go to the shield board.

Now I've finished with the phone, its time to build the shield board.


The Shield Hack

Arduino is widely known for its 'shield'. Its a very versatile way to interfacing the Arduino with the outside world. Same goes to my SMS project here. I'm gonna need a shield to interface the Arduino with the phone and also to place the relays and necessary circuit to drive the relay. It is very easy to control a relay using the Arduino with help of a minimum number of component. I will not put the schematic here in my blog since I just follow what is already available from the Arduino Playground website. See here

The easiest way to build your own custom-made shield is to buy the ready-made proto-shield (or prototype shield as the full name) where you just need to solder the components on the prototype area, rather than messing with the stack-able pins and headers. Since that we cannot simply use our own protoboard (donut or perf) to make shield which is compatible to the Arduino due to its non-standard 0.16 space between the header (read here)..

Therefore I've done a few hacks on the Arduino in order to fit with my standard 0.1 donut board shield. Here are the photos:



On the shield board :

Since we already have a nice fit custom-made proto shield, now its time to place and solder other component such as relays etc.


This is how the wiring look like under the board. Messy but it works for me :-)

This is the connector and wires to the phone. I put some hot glue to prevent the wires from moving and loosen. (this is the 1st version of the board. on the 2nd version, i've put a small tactile switch just beside the connector in order to by-pass the button press)

So, this is the overall view of the finish SMS shield. I have left some spaces on the shield for future upgrade which is to add another relay to detect power trip and trigger the SMS sequence.


The Arduino program used in this project is simple and just using the favorite DigitalWrite( ) and Delay( ) function to turn the relay On and Off. Here is the code. You can copy, use and modify it as you pleased.

#include <Button.h>

/*
 Trip Detection SMS System version 1.0 (powered by Arduino Diecimila)
 Designed and Debugged by melawis501@HAFIZ, Nov 2011

 Version 1.0 Rev .'A'-  November 2011
*/


Button button = Button (10,PULLDOWN);

const int relayOK = 11;   // set pin 11 for phone button OK
const int relayDown = 12; // set pin 12 for phone button DOWN

const int onTime = 300;  //Relay On and Off timing. Adjust accordingly to suits your needs
const int offTime = 800;

void SMS_sendMsg();    // function to send the 'TRIP' message to 1st recepient

void setup() {

  pinMode(relayOK, OUTPUT);      // set pin 11 as OUTPUT (relay no.1)
  pinMode(relayDown, OUTPUT);    // set pin 12 as OUTPUT (relay no.2)

  digitalWrite(relayOK,LOW);     // set the state of both relays as LOW during system bootup
  digitalWrite(relayDown, LOW);
}

void loop() {

  if(button.isPressed()) {
      SMS_sendMsg();
  }
  else {
      digitalWrite(relayOK,LOW);
      digitalWrite(relayDown,LOW);
  }
}


void SMS_sendMsg(){
//Function for sending sms sequence 

  delay (1000);
  digitalWrite(relayOK,HIGH);//relay on -- to Page 2
  delay(onTime);
  digitalWrite(relayOK,LOW);//relay off
  delay(offTime);
  
  digitalWrite(relayOK,HIGH); // -- to Page 3
  delay(onTime);
  digitalWrite(relayOK,LOW);
  delay(offTime);
  
  digitalWrite(relayOK,HIGH); // -- to Page 4 (select phone number page)
  delay(onTime);
  digitalWrite(relayOK,LOW);
  delay(offTime);
  
  digitalWrite(relayDown,HIGH); // -- selecting phone number
  delay(onTime);
  digitalWrite(relayDown,LOW);
  delay(offTime);
  
  digitalWrite(relayOK,HIGH); // -- to Page 6
  delay(onTime);
  digitalWrite(relayOK,LOW);
  delay(offTime);
  
  digitalWrite(relayOK,HIGH); // -- to Page 7 - Confirm sending SMS
  delay(onTime);
  digitalWrite(relayOK,LOW);
  delay(offTime);
  
  delay(1000);




Last but not least, here's the video showing me testing the SMS shield. Enjoy!


Feel free to ask me anything about the project or suggesting new ideas to share. Hope this project would benefit others, especially the Arduino communities. See again until my next project!

Arduino rocks!!


Thursday, August 18, 2011

What I Want....Top 10 Wish List

        What I want?? Yeah..of coz I want gadgets..lots of them. There are so many gadgets that I want (assuming that I have lots of money :P) but the most wanted are as the list below. I have list down 10 most wanted gadget that I really want for the 2011 and WHY I want it. And again, only if I have thick pocket to say. It is a ‘WISH’ list anyway :p


1. Mountain Bike (Merida Matts Hardtail XC)

Why I want it? Its been a while since I wanted to own a good mountain bike to ride it as a workout and hobby. But due to work commitment and short on budget, it is always be a dream. Now my interest on cycling has come again and I’m planning to get serious into it. Now I want it because I want to join mtb carnival and jamboree around my country. As a beginner, I am not targeting to win any place in the race, but most important is to gain experience and at least, of cause to finish it.



2. Portable Media Player (Apple iPod touch 4G)

Why I want it? I have fall in love with the Apple iPod touch since their first appearance in 2007 but until now I still don’t have a chance to have one. Now with the latest 4th generation of the iTouch family and thousand and thousand of new apps made everyday, it is always be the most versatile portable media player ever made. It is small, sleek and easy to carry around. I want it mostly because it can work as my personal organizer other than for playing games and browsing the internet on-the-go. Other good thing that I love about this iTouch is because it can be so-called 'jailbreak' where it can be hack 'legally' in order to install paid apps for free. That's why I want it.



3. Laptop (Dell XPS 15z)
Why I want it? Who said Apple the only company who can make nice,beautiful and appealing laptop with powerful features in it package. Just see it closely to this Dell XPS 15z laptop. With it super-elegant anodized aluminium surface and super-thin form factor plus powerful system built into it, there is no more reason to explain why I want it.


4. Watch (Casio Protrek PRG-110Y)
Why I want it? For sure to watch the time. Protrek is the famous adventure-type watch from Casio and it has many features suitable enough for outdoor activities such as digital compass, altimeter, barometer etc. Why I want this specific model is because it has thin form factor compared to the other of its sibling which is usually thicker and heavy.


5. Phone (HTC Incredible S)
Why I want it? I never used an Android or even any HTC phone before this and I think HTC is a great  device to start with Android system. Although I already have my Blackberry Bold phone right now, this is the phone that I would definitely get it if something bad happen to my BB. ;p


6. Phone (Nokia E5) - this is for my wife :p
Why I want it? I want it because of my wife needed a new phone which can be use to update her Facebook status and browsing the internet easily while at home. Its a nice phone for women and with it business core features, organizing her daily task will become much more easy. 


7. Digicam (Panasonic Lumix DMC-FT10)
Why I want it? Gadget wish list without a digital camera will never be a complete list. It is really a must for a gadget guy like me to own a digital camera instead of using my phone camera to capture great moments, especially during my time with my family. But why do I need the 'tough' version is just because I don't need to worry about breaking it if dropping on the floor or spilling water onto it. And since I love to swim and riding mountain bike as my hobby, 'tough' camera like this Panasonic Lumix TF-10 would really be a great companion for me.


8. Home Media (Dell Inspiron Zino HD)


Why I want it? I love to download and watching movies so much but watching it on my laptop or my home pc monitor would never satisfy me. I want to watch it big and since I already have my new plasma TV with HD-ready and HDMI-ready, I just need the right gadget to store and play all my movies collection directly on my big TV. Why do I want this Dell Zino compact desktop pc is because it has everything I need to play those movies. Plus, together with wireless keyboard and mouse, I can even browsing internet and do Facebook chat on my big TV, all from the comfort of my Ikea Poang couch.


9. RC Hobby (Walkera Hybrid Metal CB180Z)

Why I want it? I started to love RC heli and planes since I was a little boy when my father always bring me and my little brother to watch big guys playing their RC toys in Ipoh. At that time, only gas-powered RC's available and the price was very high. But things are much different now where battery-powered RC's are common everywhere and getting so much cheap. Why I want it is just because I love RC's and I love the challenge controlling it, especially helis. It is much harder than controlling a RC car. But to all kids under 12-years old out there, this is absolutely not a toy. It is actually a BIG BOY TOYS. 


10. DIY Tools (Bosch GSR 10.8-2-Li Cordless Drill)
Why I want it? At home, I'm kind of DIM (do-it-myself) guy where I love to built things or I like to call it as 'project'. Either it is an electronic project or a home-made wooden cabinet or even installing and wiring new room light by myself. Having a great tool for making those project is always being my dream. Why I want this Bosch compact drill is because of its capable power drill in a very compact size. Easier to carry around and lighter than the standard bulky drill, it would be a useful tool to have in my toolbox.


          All right guys! That's all for my post this time. Hope you all enjoying reading it and wait for my next post which I'll write about all gadgets around me that I already have. I believe all you gadget lovers out there also have you're own wish list and if you wish to share it with me, just write down your comment below.

          Last but not least, as I already stated before, it is just a wish list which I dream to have it. Of cause, if I'm rich and all-i-want-i-can-get kind of guy, why do I bother to have a wish list as I can buy it all...

Happy reading! See ya' !!