Arduino Uno + GSM Shield + StarHub Sim Card : Intro

Last time when I bought the Cooking Hacks GSM Shield, I found difficult to manage the signaling, it always shutting down all sudden, very bad because inside the shield there is no built in antenna, I must buy stuff antenna to make it works. But now, I have a new GSM Shield that comes from Arduino itself, it called Arduino GSM Shields, and the good news is it built in internal antenna inside, cool. Save all the dramas.

Before i jump to hack the shield, i need to buy a simcard and i get the StarHub one, haven’t use so far, but it took $15 for the damage, fair enough.

10311114794_3b0584719d_c

Ok, lets open the plastic wrap, and make it works. First, I need to register the simcard with the phone, and make it works by testing the call and send/receive sms from the phone, after done, I plugged the simcard into the gsm shield and the plugged the gsm shield into the uno board. The tutorial from http://arduino.cc/en/Guide/ArduinoGSMShield said that it need external power with 700mA to 1000mA to supply the GSM shield, it’s not recommend to use power over the usb, it usually only power 500mA.

10312000406_9cfdd93047_c

Ok, done with the hardware setup, now we can do the fun with the arduino ide to do the code. Oh ya, it said also that it need ide at least 1.0.4 version to use the gsm library. The arduino guys , they really do the good job with the ide and the libraries, usually we must dwelling with “AT Command” to work with GSM things, but they encapsulated it so that we the coder just need to call the function, but I still can do to execute the “AT Command” to customized the application, awesome! Now I use the IDE version 1.0.5 and has built in the “GSM” Library inside, and I want to use it, but first I need to make proof that the network setup is working properly, I just checking the IMEI number and the signal strength. It was easy though because there is an example for it, thanks.

// import the GSM Library
#include <GSM.h>
// define PIN Number
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess( true ) ; // true with debug enabled
GSMScanner scannerNetworks ;
GSMModem modemTest ;
// save data variables
String IMEI = "862170010105474" ;
// serial monitor result messages
String errorText = "ERROR" ;
void setup() {
// initialize serial communications
Serial.begin( 9600 ) ;
Serial.println( "GSM networks scanner" ) ;
scannerNetworks.begin() ;
// connection state
boolean notConnected = true ;
// start gsm shield
// if your sim has pin , pass it as a parameter of begin() in quotes
while ( notConnected ) {
if ( gsmAccess.begin( PINNUMBER) == GSM_READY ) {
notConnected = false ;
} else {
Serial.println( "Not connected" ) ;
delay( 1000 ) ;
}
}
// get modem parameters
Serial.print( "Modem IMEI : " ) ;
IMEI = modemTest.getIMEI() ;
IMEI.replace( "\n" , "" ) ;
if ( IMEI != NULL ) {
Serial.println( IMEI ) ;
}
// currently connected carrier
Serial.print( "Current carrier: " ) ;
Serial.println( scannerNetworks.getCurrentCarrier() ) ;
// return strength and ber
// signal strength in 0-31 scale, 31 means power > 51 dBm
// ber is the bit error rate, 0-7 scale, 99 ~ not detectable
Serial.print( "Signal strength: " ) ;
Serial.println( scannerNetworks.getSignalStrength() ) ;
}
void loop() {
}
view raw 2013101701.c hosted with ❤ by GitHub

And Wohoo.. it works perfectly, it was detected with the correct telco carrier name, and mine has signal strengh 19, its quite fair enough for the value from my room. Ok for the next fun thing, i will do the send/receive sms.

Screen Shot 2013-10-17 at 12.08.44 AM