element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino gsm shield issue
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 7 replies
  • Subscribers 393 subscribers
  • Views 887 views
  • Users 0 members are here
  • gsmshield
  • uno
  • arduino
Related

Arduino gsm shield issue

tonderai
tonderai over 12 years ago

Hello

 

I recently bought the sim900 gsm module: http://www.ebay.co.uk/itm/GSM-GPRS-Shield-For-Arduino-/230911052682?pt=LH_DefaultDomain_0&hash=item35c35f0b8a

 

 

I have been working the https://code.google.com/p/gsm-shield-arduino/downloads/list using the arduino uno :https://www.dipmicro.com/store/BTE-RCB2011

 


I have configured every thing the right way and now trying the sms example. The serial
output says message sent but the message is not recieved by the phone. Hope you can help.

 

#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

 

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

 

//To change pins for Software Serial, use the two lines in GSM.cpp.

 

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

 

//Simple sketch to send and receive SMS.

 

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

 

void setup()
{
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
    Serial.println("\nstatus=READY");
    started=true; 
  }
  else Serial.println("\nstatus=IDLE");
 
  if(started){
    //Enable this two lines if you want to send an SMS.
    if (sms.SendSMS("+444538590489", "Arduino SMS"))
      Serial.println("\nSMS sent OK");
  }

 

};

 

void loop()
{
  if(started){
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))
    {
      Serial.println(n);
      Serial.println(smsbuffer);
    }
    delay(1000);
  }
};

  • Sign in to reply
  • Cancel

Top Replies

  • theenggprojects
    theenggprojects over 10 years ago +1
    You should have a look at this link ..... http://www.theengineeringprojects.com/2015/02/receive-sms-commands-using-sim900-arduino.html .... It will give you the basic idea off how GSM works, it actually…
Parents
  • Former Member
    Former Member over 12 years ago

    Tonderai,

       Do you have documentation on the proper usage of gsm.readSMS?

    I don't.  But it seems odd to me that it would take as parameters two

    uninitialized buffers, smsbuffer and n. 

     

    Edited to add:   

       I think I found the documentation:

    -     readSMS (char* msg, int msglength, char* number, int nlength) Checks if

    there are available messages. Takes the first one and deletes it from modem

    memory. Returns message in msg, and original phone number in “number”.

    Msglength and nlength must hold the corresponding buffer size.

    http://labs.arduino.cc/GPRS/Library

     

    So your code looks OK to me.

     

    But at the top of that documentation, it says:

     

    "This page is outdated. For information on using the GSM library with the current GSM shield,

    visit the GSM library reference pages.    http://arduino.cc/en/Reference/GSM

     

    and at that page I don't see readSMS.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • tonderai
    tonderai over 12 years ago in reply to Former Member

    Thanks so much for the reply. After Arduino 1.0.5 or later gsm module come installed. The gsm library

    I am using is found here https://code.google.com/p/gsm-shield-arduino/downloads/list

     

    I dont know if the gsm library that comes with the new ide is compatible with the shield I am using

    the brand of the arduino shield on the arduino site is different .

     

    This is the one I am using: http://www.ebay.co.uk/itm/GSM-GPRS-Shield-For-Arduino-/230911052682?pt=LH_DefaultDomain_0&hash=item35c35f0b8a

     

    At the bottom of the purchase page is a link to https://code.google.com/p/gsm-shield-arduino/downloads/list

    thats why I an using it.

     

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to tonderai

    Tonderai,

        If I read your original post correctly, the message isn't getting sent

    at all, not just that your program can't retrieve the message.  Is that correct?

     

    I believe there are lower-level modem commands besides sms.SendSMS

    that can enable debugging modes that could give you clues about

    what's going wrong. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • tonderai
    tonderai over 12 years ago in reply to Former Member

    Okay.

     

    I will look into that. The wierd thing is the print out says message sent but the phone does'nt get it.!

     

      if(started){

        //Enable this two lines if you want to send an SMS.

        if (sms.SendSMS("+444538590489", "Arduino SMS"))

          Serial.println("\nSMS sent OK");

      }

     


    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to tonderai

    Dear Tonderai,

    here is the simple code to send and receive sms through gsm sim900.

    //receiving sms

    void setup ()

    {

    Serial.begin(9600);

    Serial.write("AT+CMGF=1\r");           //set GSM to text mode

    delay(1500);

    Serial.write("AT+CPMS=\"SM\"\r");      //Preferred SMS Message Storage

    delay(1000);

    Serial.write("AT+CMGR=1\r");

    Serial.write("AT+CNMI=2,2,0,0,0\r");

    delay(1000);        //list the first message from SIM //Memory

                while(1)

               {

                            if(Serial.available())

                            {

                                        Serial.write(Serial.read());

                            } 

              }

    }

     

    void loop()

    {

    }


    //sending sms


        

    void setup()

    {

    1. Serial.begin(9600);

    delay(5000);

    }

    void loop()

    {

    Serial.println("AT");

    delay(1000);

    Serial.println("AT+CMGF=1");

    delay(1000);

    Serial.println("AT+CMGS=\"08792546229\""); //CHANGE TO //DESTINATION NUMBER

    delay(1000);

    Serial.print("hi...sms from arduino");

    Serial.write(26);

    delay(1000);

    }


    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 10 years ago in reply to tonderai

    Dear Tonderai,

    here is the simple code to send and receive sms through gsm sim900.

    //receiving sms

    void setup ()

    {

    Serial.begin(9600);

    Serial.write("AT+CMGF=1\r");           //set GSM to text mode

    delay(1500);

    Serial.write("AT+CPMS=\"SM\"\r");      //Preferred SMS Message Storage

    delay(1000);

    Serial.write("AT+CMGR=1\r");

    Serial.write("AT+CNMI=2,2,0,0,0\r");

    delay(1000);        //list the first message from SIM //Memory

                while(1)

               {

                            if(Serial.available())

                            {

                                        Serial.write(Serial.read());

                            } 

              }

    }

     

    void loop()

    {

    }


    //sending sms


        

    void setup()

    {

    1. Serial.begin(9600);

    delay(5000);

    }

    void loop()

    {

    Serial.println("AT");

    delay(1000);

    Serial.println("AT+CMGF=1");

    delay(1000);

    Serial.println("AT+CMGS=\"08792546229\""); //CHANGE TO //DESTINATION NUMBER

    delay(1000);

    Serial.print("hi...sms from arduino");

    Serial.write(26);

    delay(1000);

    }


    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube