using GSM shield without Arduino GSM library (AT commands?)

Hi,
I've assembled a data logging unit with an RTC module, LCD (i2c) display, SD memory card shield and Arduino GSM/GPRS shield on Arduino Uno R3.

Since the sketch was too big for Arduino, I removed some of not used GSM library (Mockup, SMS, Voice, ModemVerification,MultiClientProvider, MultiServerProvider, ScanNetwork) moving all related files in a new folder.
I checked on a separate sketch that having removed those files did no affect the GPRS connection and data transfer with GET method works perfectly.

The sketch compiles well, but goes out of memory and it doesn't run.

Is there a way to avoid using GSM library? reducing so far memory usage to what I actually need? maybe with AT commands (I don't know much how they work).

Thanks for any help.

You can do it with SoftwareSerial library. Modem uses digital pin 2 for RX and digital pin 3 for TX.

You can directly give the AT command and also see the response of the AT.
First try out the AT commands using hyperterminal and then use it in your code .

Put this code in your Arduino and enter AT commands with Serial Monitor:

#include <SoftwareSerial.h>
#include <string.h>

char incoming_char = 0;
SoftwareSerial cell(2,3);

void setup()
{
// Initialize serial ports for communication.
Serial.begin(9600);

// Reset
Serial.println("Start Reset");
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
delay(12000);
digitalWrite(7, LOW);
delay(1000);
Serial.println("End Reset");

cell.begin(9600);

Serial.println("Enter your AT commands (with CR & NL)...");
}

void loop()
{
if(cell.available() > 0)
{
incoming_char = cell.read();
if((incoming_char >= ' ') && (incoming_char<='z'))
Serial.print(incoming_char);
else
{
Serial.print("%");
Serial.print((int) incoming_char);
Serial.print("%");
if(incoming_char == 10)
Serial.println();
}
}

if(Serial.available() > 0)
{
incoming_char = Serial.read();
cell.print(incoming_char);
}
}

How do you send sms in serial monitor using the at commands? Iv found these instructions but they seem to be for hyper terminal because no prompt shows up and ctrl+Z Have no effect. Buth NL & CR are selected and the proper baud rate is selected.

im using a tinysine gsm module and an arduino uno.

any suggestions?

To send an SMS, AT commands need to be entered in the following order:

  • at+cmgf=1 (send SMS in text mode)

  • at+cmgs=”+9955555555? (Destination number; replace +99 with the country code of the country you want to send the SMS to, 55555555 needs to be replaced with the destination number)

When a prompt > appears enter the text you wish to send as a message, for example:

Test sending SMS message
press CTRL+Z keys to send the message

When the SMS is sent correctly, a response will appear on the screen:
+CMGS: xx (xx=reference number)

Hi all...I have a question for you, regarding AT commands..How did you managed to read the responses from the module ?I've tryied some serial reads, but it seems I'm not doing it properly...Tryied to discard the firsts ,, the last ones, but with no succes. Can't find the proper alghorithm to do this. Can you point me to some direction ?

Hey,
First make sure your software serial pins and the one in gsmlibrary matches. Then it will work fine!

I had solved the problem, using strings (much easyer to manipulate,at least for me ),and for the moment I'm in the sms "bussiness", receiving commands that Ardu will execute,send sms for some status reporting and commands confirming.In this way, the module also works with the others platforms ,such Pic32's,uno32's, using his native Rx,Tx,Ctrl pins...Next attempt will be the GPRS stuff, which will be much tricky..for a noob like me...:slight_smile:

I've written this code for my Arduino UNO R3 and Arduino GSM shield on top to send a message to a cell phone when it detects a sound ( Microphone and amplifier is built already as an input)

and I recently get a problem with the double messages sending to my phone everytime.

When it picks up the signal. Pin 9 powers up the GSM Shield. Then it takes a few second to log on to the network. Then a message is sent to my cellphone.

Unfortunately, it is supposed to turn off the GSM module right away but it doesn't and many more messages come.

I use digitalWrite(powerPin, LOW); to turn it off.

It works sometimes but most of the time it doesn't and I don't want it to be so unstable.

Could it be the delay time? I've tried to modify the code in various ways and it still doesnt work.

Can anyone help me?

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);

int threshold = 300;
int powerPin = 9;

void setup()
{
  SIM900.begin(19200);
  Serial.begin(19200);
  pinMode(powerPin, OUTPUT);
  
}

void loop()
{
  if(analogRead(A0) > threshold)
  {
  digitalWrite(powerPin, HIGH);
  delay(1000);
  digitalWrite(powerPin, LOW);
  delay(8000);
  }
 sendSMS();
}

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+1234536789\"");                                     // recipient's mobile number, in international format E.123
  delay(100);
  SIM900.println("Message to be sent in here");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(1000);
}

Hi,
You can use AT commands to work with your GSM module. I had connected sim900 gsm module with arduino without sheild. It is working completely fine. :slight_smile: check link below

HI,
I have GSM SIM900A and i dont know how to use it.
Can anyone help me?

Do not append your questions to someone else's thread, it's considered rude. So is asking your question in several places. Please read the 'How to use this forum' stickie at the top of the board.

Rx -> Tx, Tx -> Rx, Gnd -> Ground, a decent power supply to provide 5 volts.

Common problems

The SIM900A does work in your country, right?

hi everyne,
I have used GSM sim 900 with arduino and without GSM library (with AT commands send via serial)
It worked fine for me .

Check link below

Sorry to hijack the thread, but its kinda old anyway.

Im having an issue with my SIM900. I posted the details here:
http://forum.arduino.cc/index.php?topic=427874.msg2949059#msg2949059

But in essence, the sim900 works with a mega using a library. And it has worked a few times for me using at commands similar to the ones mentioned in this thread. But most of the time it doesnt work because no sms gets sent.

Im stumped. Please help!

Hello everyone!

I've develop and Arduino library to handle AT Commands without the need of the GSM library. This lib can be used with Bluetooth, GSM, WiFi or any other kind of module that communicates using AT Commands.

It was made because first I wanted not to block code execution while waiting for a response and secondly, because is very very lightweight.

This comes with a price, the user needs to have some knowledge over wich AT CMDs uses the module but it's not a big deal.

I hope it helps someone out there.

ATHandler Arduino Library

Best Regards