Itead 3G Shield



The Itead 3G Shield we sell for the Arduino / Mega is a long time favourite, one of loyal customers Mark Lewis wrote some very useful code and we would like to share it with out community.

Send and Receive SMS. Parse and utilise the received SMS.

Written 2017 when to my horror 2G I realised my entire fleet of SM5100B shields were soon to become obsolete.
Poorly written by Mark Lewis from sunny Cairns (QLD Australia) to work with ITEAD 3G shield and a MEGA.
Hopefully someone smarter will improve this simple functional code, or maybe
it will assist someone who needs help.

This is my hobby, and my intention is to help people. No liability for anything that goes bang. I have used the 
basis of this code in many successful and reliable projects. 


For goodness sakes use a decent power supply. You will have numerous intemittent problems (that cannot be solved by 
code) if you try and run the hardware over a USB cable etc.

Writing pin 8 HIGH will power up the shield, rather than having to press the on board button every reset
Writing pin 9 HIGH will reset the shield
Buy a sim adaptor, the Sim card can move away from the board, creating reliability issues.

OPTUS 3G:   Does not work
TELSTRA 3G: Works great


This code is designed to work with a MEGA and ITEAD 3G shield.  It could be altered to work with a UNO by using softare serial.

When a key word is received from an authorised number, a sms message is sent to the authorised number

SETTING UP THE SHIELD  ** Sorry, lots of steps.  This is to make the process simple, fast, and easy.

1.  Open the box and un-pack the contents
2.  Press the SIM5126A module on to the shield
3.  Insert the sim card
4.  Switch select "5V"
5.  Switch select flight mode "ON"
6.  Attach some male/female pins to MEGA to create more space between the shield and the Mega
7.  Attach the shield 
8.  Attach areal 
9.  Power up the Mega    LED status:    0 1 0 1
10. Attach USB directly to shield. NOT MEGA!
11. Press PWR switch     LED status:    0 1 1 1 followed shortly by: 1 1 1 1 
12. Wait for network connection  Led status:  FLASH 1 1 1 

Time to adjust the baud rate of the shield to 9600. You can follow the next few steps, or send the same AT command via the arduino instead of 
using a terminal program.

13. Open terminal program (I used terminal.exe)

    Settings: Baud:       115,200
              Data Bytes: 8
              Stop Byte:  1
              Other:      None
  1. Scan Ports

  2. 3 ports will be available

  3. Choose the second port

  4. Press the restart button on the shield

  5. Terminal will display:


  6. Send the shield the command AT

  7. Terminal should display “OK”

  8. Change the baud rate to 9600 by sending AT command: AT+IPREX = 9600

  9. Terminal should display “OK”

  10. Disconnect from terminal, remove USB, power OFF MEGA

  11. Make sure pins on the Serial pin selector of the shield have been removed

  12. Connect shield Rx to MEGA Tx

  13. Connect shield Tx to MEGA Rx

  14. Power up the board

  15. Connect USB to MEGA

  16. Follow steps 11/12 again

  17. Change the authorised phone number of the code

  18. Upload the code

  19. Improve my code, and integrate into lots of great projects


String phone;
String text;
String message;

String authorisedPhone = “614”; // your phone here format: 61414xxxxxxxxx (Authorised number)
String keyWord = “test”;
String smsMessage = “Hello world”;

long currentTime;
long smsMillis;

boolean messageReceived = false;

void setup()
Serial.println(“Warming up…”);



void loop()


if (currentTime - smsMillis> 10 && messageReceived == true) {

   if (message.substring(2,7) == "+CMT:") {
   //  Serial.println(message); // Comment out after diagnostic complete
 phone = message.substring(10,21);
 text =  message.substring(50,message.length()-2);
Serial.print("Message Received from: ");   Serial.println(phone);
Serial.print("Message: "); Serial.println(text);

if (phone.equals(authorisedPhone)) {
       Serial.println("Welcome. You are authorised");
    if(text.equals(keyWord)) {
   Serial.println("Command not recognised");
   Serial.println("You are not authorised");

else {

void serialEvent3() // GSM wired to Serial 3 on Mega
while (Serial3.available()) {

smsMillis = currentTime;

char x =;    
 message = String(message+x);


void sendSMS()
Serial.println(“Sending authorised a sms”);

String sms="";

sms = sms + “AT+CMGSO = “” + authorisedPhone + “”,”" + smsMessage + “”\r";