Go Down

Topic: Arduino Uno + sim900 (Read 16126 times) previous topic - next topic



I have purchased an arduino uno rev 3 http://arduino.cc/en/Main/arduinoBoardUno and a icomsat v1.0 sim900 http://iteadstudio.com/store/images/produce/Shield/IComSat/icomsat_DS1.2.pdf i am trying to send an sms using this.

the code that i am using is
Code: [Select]

#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"

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

//GSM Shield for Arduino
//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.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
  else Serial.println("\nstatus=IDLE");
    //Enable this two lines if you want to send an SMS.
    if (sms.SendSMS("+971505393365", "Arduino SMS"))
      Serial.println("\nSMS sent OK");


void loop()
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))

it  prints the first line GSM shield testing and then gives DB: NO RESP
what could be the reason for this.


Have you connected an external power supply to the Uno board? The IComSat SIM900 requires 9V/2A power supply and will not work with the Uno board just connected to the USB. Also, you need to set the Tx to pin 4 and Rx to pin 5.

Also, there is a small switch with UART_Port/DBG_Port options - you need to set that to UART_Port

Once the above is done correctly, you should be able to read the SMS on your SIM Card using the below mentioned example code.


I got the same problem.
The status light on sim 900 is green all the time so does PWR, the net light on every 3 second.
I am not sure if it is registed, when I trid the code following
#include <NewSoftSerial.h>

/* GSM Shield example

created 2011
by Boris Landoni

This example code is in the public domain.


#include <GSM_Shield.h>
//for enable disable debug rem or not the string       #define DEBUG_PRINT
// definition of instance of GSM class
GSM gsm;

void setup() {
  Serial.println("system startup");
  //gsm.InitSerLine(9600);   //initialize serial 1
  gsm.TurnOn(9600);              //module power on
  //gsm.InitSerLine(9600);   //initialize serial 1
  gsm.InitParam(PARAM_SET_1);//configure the module 
  gsm.Echo(1);               //enable AT echo

void loop()
    int reg;
    switch (reg){   
        Serial.println("not registered");
      case REG_REGISTERED:
        Serial.println("GSM module is registered");     
      case REG_NO_RESPONSE:
        Serial.println("GSM doesn't response");
      case REG_COMM_LINE_BUSY:
        Serial.println("comm line is not free");
      Serial.print("Registration ");
It always show GSM doesn't response.
By the way, I wander why do we need to change RX and TX number. In arduino uno,tx is 1 and rx is 0.


AJ Weber

I bought a similar shield from seeedstudio and followed the instructions on their wiki.  I got it to work by sending it AT-commands (which this shield apparently accepts too), but have not tried the SMS/GSM specific library, which I assume is just a wrapper for the AT commands.

Check http://www.seeedstudio.com/wiki/index.php?title=GPRS_Shield_v0.9b and see if your shield will respond properly?  I am curious whether you will get this one working OK, because it's a little cheaper and I would buy it instead.

BTW: If your Arduino is connected (or will be connected) via USB to the computer, then the USB is using 1 & 2, and the shield uses two digital pins via the Serial library.

To that effect, starting with Arduino 1.0, you should try the SoftwareSerial.h library that is built-into the distribution.

Finally, I found (via some google searches and confirmed this) that when using the SoftwareSerial (or NewSoftwareSerial) library to communicate, you should reduce the shield's baud rate.  I do this across each interface to keep consistent with the following on startup:
Code: [Select]
Serial.begin(9600); //only if USB will be connected
mySerial.println("AT+IPR=9600"); //sets the GPRS chip to communicate at 9600 as well

Maybe this will help.  Please keep me informed as to how you do!



It is working now. I did not connect a extra power supply, just connect Uno with usb to labtop.
TX is 4 and RX is 5. I guess that the right pin.

i am using sim900 library the sms library , softwareserial ,wire.h and a rtc( real time clock ) library . i just read in the library example that if the ram is getting full the program would keep on restarting. my code is also acting wierd ,but my memory usage shows aboout 17kb from 30kb. although i think there is some conflict between the Sim900 and wire.h library . because the program would keep on restarting at wire.begin() when i use the wire.h library only. any solutions? I2C protocol may be causing a problem someone said to me, makes sense because sim900 also said it uses something like that , but dont know how .

libraries i used :
#include "SIM900.h"
#include "sms.h"
#include "SoftwareSerial.h"
#include "Wire.h"
#define DS3232_I2C_ADDRESS 0x68


but my memory usage shows aboout 17kb from 30kb.

Of the 2K (on 328-based Arduinos) or 8K (on the Mega)? You are not looking at the right kind of memory usage.

ok,yea its 328 based UNO and it say "Binary sketch size: 17,542 bytes (of a 32,256 byte maximum)" when compiled. is it the RAM as referred in the library, isn't it Rom usage . and if it isn't RAM , how do i know how much i've used.


There is a playground page that might be of interest: http://playground.arduino.cc/Code/AvailableMemory

There are three kinds of memory on the Arduino - Flash, where the code is stored, SRAM, where variables and literals are stored, along with the stack and heap, and EEPROM, where persistent data can be stored.

The message "Binary sketch size: 17,542 bytes (of a 32,256 byte maximum)" refers to the Flash memory used.

There is nothing that reports the amount of SRAM used, because it changes as the program runs. As local variables are created, the heap grows. As functions are called, the stack grows. The grow toward each other. When they meet, bad things happen.


I tried using AT commands and my module is responding but it gives an error when i try to send an sms using AT+CMGS
Any advice??


Any advice??

Sure. Re-read your post, and see if you can spot anything you left out. Like the code and error messages.


Here's the code. When i run it through arduino uno which is interfaced to a GPRS module from itead studios, it says AT+CMGS="+919---------" ERROR on the serial monitor.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() 
  // Open serial communications and wait for port to open:

void loop() // run over and over
  if (mySerial.available())
  if (Serial.available())

I tried replacing AT+CMGS="919---------" with just AT and it responds perfectly fine.

Hope u can help.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131