Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Sending SMS using SIM900 GPRS Shield on: May 05, 2013, 01:36:21 am
Hi,

Thanks. The Status LED (red) is always ON, the Netlight LED (green) is 64ms On/3000ms Off, which means it is able to find the network. I dont have any PIN for SIM card.

My code using GSM library is given in the above post. Its output is as follows:

Quote
GSM Shield testing.
status=READY
-1

-1 implies that the sms is not sent.

When I dont use the GSM library, I upload the following code to Arduino. It handles the serial communication between the Arduino and shield:

Code:
#include <SoftwareSerial.h>
 
SoftwareSerial GPRS(7, 8);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array
void setup()
{
  GPRS.begin(9600);               // the GPRS baud rate   
  Serial.begin(9600);             // the Serial port of Arduino baud rate.
 
}
 
void loop()
{
  if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
  {
    while(GPRS.available())          // reading data into char array
    {
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
  }
    Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
    clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
    count = 0;                       // set counter of while loop to zero
 
 
  }
  if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
    GPRS.write(Serial.read());       // write it to the GPRS shield
}
void clearBufferArray()              // function to clear buffer array
{
  for (int i=0; i<count;i++)
    { buffer[i]=NULL;}                  // clear all index of array with command NULL
}


And then I manually give AT commands for sending SMS using a serial tool. The output in the Serial monitor is as follows:



Only the final step of sending the msg text followed by Ctrl+Z doesn't work.
When I give AT command for reading SMS (AT+CMGR=1), it displays the top SMS successfully. Many other AT commands from the SIM900 datasheet are also working fine. Dont know what happens while sending SMS.  I've also tried feeding the SMS center number but that didn't help.
2  Using Arduino / Networking, Protocols, and Devices / Sending SMS using SIM900 GPRS Shield on: May 04, 2013, 03:36:26 pm
Hi,

I am using the gprs shield v1.0 with arduino uno and I wish to send an SMS using it. This is the link to shield : http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0
I use the GSM library which comes along with it. https://code.google.com/p/gsm-shield-arduino/

I uploaded the following code to Arduino:

Code:
#include "SIM900.h"
#include <SoftwareSerial.h>

#include "sms.h"
SMSGSM 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 reccomanded to use 4800 or slower.
  if (gsm.begin(9600)){
    Serial.println("\nstatus=READY");
    started=true; 
  }
  else Serial.println("\nstatus=IDLE");
 
  if(started){
    //Enable this two lines if you want to send an SMS.
      int c = sms.SendSMS("+919703894422", "Arduino SMS");
      Serial.println(c);
  }
 
};

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);
  }
};

The sendSMS function returns a value of -1, which is the default value if SMS is not sent.
I went through the library's send SMS function but could not find any bug in it. This is the code:

Code:
char SMSGSM::SendSMS(char *number_str, char *message_str)
{
  char ret_val = -1;
  byte i;
  char end[2];
  end[0]=0x1a;
  end[1]='\0';
/*
  if (CLS_FREE != gsm.GetCommLineStatus()) return (ret_val);
  gsm.SetCommLineStatus(CLS_ATCMD); 
  ret_val = 0; // still not send
*/
  // try to send SMS 3 times in case there is some problem
  for (i = 0; i < 3; i++) {
    // send  AT+CMGS="number_str"
   
    gsm.SimpleWrite(F("AT+CMGS=\""));
    gsm.SimpleWrite(number_str); 
    gsm.SimpleWriteln("\"");
   
#ifdef DEBUG_ON
Serial.println("DEBUG:SMS TEST");
#endif
    // 1000 msec. for initial comm tmout
    // 50 msec. for inter character timeout
    if (RX_FINISHED_STR_RECV == gsm.WaitResp(1000, 500, ">")) {
#ifdef DEBUG_ON
Serial.println("DEBUG:>");
#endif
      // send SMS text
      gsm.SimpleWrite(message_str);
      gsm.SimpleWriteln(end);
  //_cell.flush(); // erase rx circular buffer
      if (RX_FINISHED_STR_RECV == gsm.WaitResp(7000, 5000, "+CMGS")) {
        // SMS was send correctly
        ret_val = 1;

        break;
      }
      else continue;
    }
    else {
      // try again
      continue;

    }
  }

  gsm.SetCommLineStatus(CLS_FREE);
  return (ret_val);
}

I found that when the function writes the SMS text to gsm, it does not receive the desired "+CMGS" from gsm and hence return value is never set to 1. Can someone please tell why this is happening?

I also tried sending the AT commands through a serial monitor and there also I face the same problem. After I write the message and send a Ctrl+Z, it responds with ERROR.

Please help....
3  Using Arduino / Networking, Protocols, and Devices / Re: GSM Shield on: May 03, 2013, 07:34:10 pm
you can try this one: http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0

It is cheaper. I purchased it from ebay for around $45
4  Using Arduino / Networking, Protocols, and Devices / Re: Problem in getting GPS data on: April 20, 2013, 06:35:43 pm
Thanks. I made the changes you suggested but its still not working. Here's the new code :

Code:
/*
This Sketch will run with the SkyNav SKM53 GPS
 RXD Arduino Pin 3
 TXD Arduino Pin 2
 RST Leave Open
 NC Leave Open
 GND Ground
 VCC +5
 Make sure you download and save to your Arduino/Libraries folder TinyGPS.h
 and NewSoftSerial.h files.
*/

#include <TinyGPS.h>
#include <SoftwareSerial.h>

unsigned long fix_age;

SoftwareSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  GPS.begin(9600);
  Serial.begin(9600);
}

void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;

  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);

  bool newdata= false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if(feedgps())
      newdata = true;
  }
 
  if(newdata)
    gpsdump(gps);
  Serial.print("Latitude : ");
  Serial.print(LAT/100000,7);
  Serial.print(" :: Longitude : ");
  Serial.println(LON/100000,7);
 
}

bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}

void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
  }
}

I also modified the feedgps() function to print the GPS data. It prints NMEA strings on the serial monitor but the gps.encode() function never returns true.

feedgps() function:

Code:
bool feedgps(){
  while (GPS.available())
  {
    char c = GPS.read();
    Serial.print(c);
    if (gps.encode(c))
      return true;
  }
  return 0;
}

Serial Monitor:

Quote
$GPGGA,232851.245,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,232851.245,V,8960.0000,N,00000.0000,E,0.00,0.00,200413,,,N*79
Latitude : 0.0000000 :: Longitude : 0.0000000

How do I make it work? Any alternatives? also tried the sample code that comes with TinyGPS library but same problem smiley-sad
5  Using Arduino / Networking, Protocols, and Devices / Problem in getting GPS data on: April 19, 2013, 01:17:43 pm
Hello,

I am using a GPS module (SKylab SKM53) with Arduino UNO to get location data. This is the code I use to read gps data

Code:
/*
This Sketch will run with the SkyNav SKM53 GPS
 RXD Arduino Pin 3
 TXD Arduino Pin 2
 RST Leave Open
 NC Leave Open
 GND Ground
 VCC +5
 Make sure you download and save to your Arduino/Libraries folder TinyGPS.h
 and NewSoftSerial.h files.
*/

#include <TinyGPS.h>
#include <SoftwareSerial.h>

unsigned long fix_age;

SoftwareSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  GPS.begin(9600);
  Serial.begin(9600);
}

void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;

  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);

  getGPS();
  Serial.print("Latitude : ");
  Serial.print(LAT/100000,7);
  Serial.print(" :: Longitude : ");
  Serial.println(LON/100000,7);
 
   }

void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
   
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}

bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}

void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
  }
}


Unfortunately, the gps.encode() function never returns true even though the module is sending proper NMEA data like this:

Quote
$GPGGA,002349.038,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*44
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,002349.038,V,8960.0000,N,00000.0000,E,0.00,0.00,060180,,,N*79

As a result, the lattitude and longitude displayed is always ZERO. Please help...
6  Using Arduino / Networking, Protocols, and Devices / Using SIM900 GPRS shield to send sms on: March 31, 2013, 09:48:47 am
Hi,

I'm using a SIM900 GPRS shield V1.0 in my project. I am following this link to send an SMS using AT commands http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0
I get correct responses for all the AT commands but when I send hex 1A after typing the message, it responds with "ERROR". Kindly help.
7  Using Arduino / Networking, Protocols, and Devices / Re: SIM908 module + Arduino UNO? on: January 24, 2013, 12:29:21 am
Thanks... that was helpful...

what about the following two options:

1) Arduino UNO + GSM/GPRS Shield + SkyLab SKM53
2) Arduino Gboard + SkyLab SKM53
Just wanted to know whether its possible and easy to setup.

Hardware links:

a) GSM/GPRS Shield : http://www.crcibernetica.com/sim900-gsm-gprs-shield-for-arduino/
b) SkyLab SKM53 : http://www.ebay.com/itm/Skylab-GPS-Module-MT3329-SKM53-with-Embedded-GPS-Antenna-Arduino-Compatible-/281035151978?pt=LH_DefaultDomain_0&hash=item416f001a6a
c) Gboard :  http://www.simplelabs.co.in/content/gboard-gsm-based-arduino-platform
8  Using Arduino / Networking, Protocols, and Devices / Re: SIM908 module + Arduino UNO? on: January 23, 2013, 05:00:33 pm
Here's the link to SIM908 module specifications: http://www.simcom.us/product_detail.php?cid=1&pid=38

Actually I wanted to know about the compatibility issues. Also, what hardware components will I require for the entire assembly? SIM908 module, UNO Board, GPS and  GSM antenna..  any major component missing? My questions might sound stupid because I have no previous experience in hardware at all. And that is why I need help badly....

Thank you..
9  Using Arduino / Networking, Protocols, and Devices / SIM908 module + Arduino UNO? on: January 23, 2013, 03:59:56 pm
Hello,

I am a beginner with Arduino platform.

I have an Arduino UNO board and I was wondering if I can connect it to a SIM908 module which has both GSM and GPS modules. Basically, I want to find the current location using GPS and send it via sms.
Please help....
10  Using Arduino / Project Guidance / Re: Suggestions for my project involving GSM and GPS on: January 23, 2013, 09:14:35 am
Thank you for the help.

Is it possible to connect SIM908 module to an Arduino UNO board? SIM908 has both GSM and GPS modules. And which library will be needed in order to access location data and send SMS?
11  Using Arduino / Project Guidance / Re: Suggestions for my project involving GSM and GPS on: January 21, 2013, 08:38:57 am
Sorry, I meant GPRS connectivity. I need to send location data to a server...

I found Gboard (http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411004.html) but it does not have GPS module
12  Using Arduino / Networking, Protocols, and Devices / Can I use an external GPS chip with a Gboard? on: January 21, 2013, 08:32:51 am
Hello,

I am working on developing a prototype for a device. The device should be able to get the location via GPS and send SMS to particular phone numbers. Also, it must support internet connectivity.

The Gboard (http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411004.html) has a  SIM900 GSM/GPRS module in it, but I'm not sure if i can connect an external GPS chip to it.

Or should I look for shields which support GSM/GPRS as well as GPS?

Thanks,
Shrenik Lad
13  Using Arduino / Project Guidance / Suggestions for my project involving GSM and GPS on: January 21, 2013, 02:31:39 am
Hello,

I am working on developing a prototype for a device. The device should be able to get the location and send SMS to particular phone numbers. Also, it must support internet connectivity.

Please suggest suitable Arduino shields and boards that I can use for the project.

Thanks,
Shrenik Lad
Pages: [1]