Go Down

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

Flake

Hey,

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"
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("+971505393365", "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);
  }
};


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

zensci

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.

Yuki123

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.


http://www.open-electronics.org
http://www.futurashop.it
*/

#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.begin(9600);
  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;
    reg=gsm.CheckRegistration();
    switch (reg){   
      case REG_NOT_REGISTERED:
        Serial.println("not registered");
        break;
      case REG_REGISTERED:
        Serial.println("GSM module is registered");     
        break;
      case REG_NO_RESPONSE:
        Serial.println("GSM doesn't response");
        break;
      case REG_COMM_LINE_BUSY:
        Serial.println("comm line is not free");
        break;
    }
    delay(2000);
   
    reg=gsm.IsRegistered();
      Serial.print("Registration ");
      Serial.println(reg);
   
    delay(50000);
}
   
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.

Thanks

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]
mySerial.begin(9600);
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!

--AJ

Yuki123

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.

Go Up