Arduino Forum

Topics => Education and Teaching => Topic started by: tronixstuff on Sep 18, 2013, 04:41 am

Title: New tutorial - Arduino and SIM900 GSM Modules
Post by: tronixstuff on Sep 18, 2013, 04:41 am
A few people have been asking how to use SIM900-based GSM shields, so here's a start:
http://tronixstuff.com/2013/09/18/tutorial-arduino-sim900-gsm-modules/
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: tronixstuff on Jan 08, 2014, 07:25 am
And I've updated it with some more remote-control examples:
http://tronixstuff.com/2014/01/08/tutorial-arduino-and-sim900-gsm-modules/
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: GlomB on Jun 07, 2014, 01:36 am
There has to be a better way of checking caller-id and the SMS content? Seems really awkward the way you do it now?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: tronixstuff on Jun 10, 2014, 03:35 am
You could store the incoming data into a string and then parse it.
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: method8 on Jul 07, 2014, 08:39 pm
In something like this:

Code: [Select]
if (SIM900.available() > 0){
    c = SIM900.read();
    if (c != '\r') temp = temp + c;
     else {
        //do something with string temp
     }
}
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: method8 on Jul 07, 2014, 08:46 pm
I'm using tronixstuff's tutorial extensively and it is a life saver.

There's one thing I can't manage: Software Power On/Off. And sometimes the arduino resets (lose global variables) after an SMS is sent. I don't know what's going on.

I'm using this version: SIMCOM SIM900 Quad-band GSM GPRS Shield Development Board for Arduino/Iduino. Works perfectly. Just didn't manage to power on and that's something I really need unfortunately. Any help?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: kathyelecfreaks on Nov 17, 2014, 04:52 am
Arduino SIM900:  http://www.elecfreaks.com/store/gprsgsm-moduleefcom-pro-efcompro-p-450.html
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: ricky101 on Feb 17, 2015, 05:25 pm
Hi John,

Thanks for your very good Sim900 tutorials , found them to be the best around.
Could not leave thanks on your site as not member of those feeds.

Would just like to ask you for some more practical voltage questions.

Those shields say feed with 5v  to produced the 3v3 via the regulator but the regulator is able to accept a higher input voltage, but due to its minimal pcb heatsink wondered how it would fair with a 9v or 12v dc input ?

Its use in my project is very low, just sending out an alarm status message as a rare event.


Also when measuring the shields current during a SMS I can only see a peak of 330ma on my slow DVM, though its said it can reach 2A peak.

Again, in your experience,  would a Wall pack rated at 1A with an extra 470uf by or on the shield be sufficient to deal with that short 2A peak draw ?


Thanks
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: shpatel6 on Mar 05, 2015, 07:09 pm
i do not find library relatede this codes such as print , printin so anyone have that library ?
or any other codes detail ?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: shpatel6 on Mar 05, 2015, 07:24 pm
library codes detail and its purpose ?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: markmonkey on Mar 22, 2015, 03:34 pm
At last code that works :)

Do you know how i can get the Arduino GMS library to work with this SiMCOM SIM900 shield?

Or do you have a GPRS example?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: stex07 on May 23, 2015, 07:39 am
I have a problem with my SIM900 module which do not take the signal, ie the green light will blink and does pause signal indicating that it has. Ah to be this as I solve this problem
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: stex07 on May 23, 2015, 07:40 am
I have a problem with my SIM900 module which do not take the signal, ie the green light will blink and does pause signal indicating that it has. Ah to be this as I solve this problem
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: dechronos on May 24, 2015, 04:55 am
hey guys,

i have a project to make some security alarm, and i have plan on connected it with SIM900 where the alarm would active when it receive a call (i try to use a code from tronixstuff), when i combine the code for the alarm it doesn't work, may i have some example on how to do that please?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: AlexTadeo on Sep 24, 2015, 08:34 pm
what can i do if i don't want to receive new sms message notifications when i'm reading the serial port???
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: masterice on Oct 11, 2015, 12:15 pm
Thanks for a great tutorial.

I wander if anyone has successfully used the SIM900 shield with the arduino to check on the amount of credit on the prepay SIM card?

I have tried using the USSD code AT+CUSD=1,"*#10#" where *#10# is the code for the O2 network but I get nothing although the codes give me an OK return.

Any help would be much appreciated.

Slim
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: masterice on Oct 11, 2015, 01:59 pm
I have managed to answer my own query as to checking my prepay sim credit balance using an AT test sketch. I have included it below but due to blasted smilies being active on the board it has changed one line of code after the include# statement, which starts;
"SoftwareSerial GPRS(7, ........"  to include a smilie (dammit). it should be 7,8 but the 8 and then the ) screw it up
You'll need to check that in the IDE.
The explanation of how to use it is in the sketch and the use of the AT+CUSD section into any other SIM900 skect is easily possible




//  Serial echo and control for AT commands
//  Uses software serial link between the computer and the GPRS Shield
//  Set serial monitor to 19200
//  Computer is connected to hardware UART
//  SIM900 Shield is connected via the software UART

//  Enter the line below into the input part of the serial monitor
//  AT+CUSD=1, "*#10#"
//  press send
//  Remaining balance will print out in the serial monitor
//  NOTE "*#10#" is the code for O2 in the UK. You will need to find the correct code for your provider



#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8)   ;  //control pins for SIM900 shield

unsigned char serialbuffer[64];  // set up serialbuffer array for holding data received over serial port
int count=0;               // counter for serialbuffer array

void setup()  // setup routines
{
  GPRS.begin(19200);  // Set SIM900 interface speed to 19,200
  Serial.begin(19200);  // Set Arduino serial monitor speed to 19,200
}

void loop()  //main program
{
  if (GPRS.available())  // check GPRS is available
  {
    while(GPRS.available())
    {
      serialbuffer[count++]=GPRS.read();
      if(count == 64)break;
    }
    Serial.write(serialbuffer,count);  // write to serial port buffer
    clearserialbufferArray();
    count = 0;
  }
  if (Serial.available())
    GPRS.write(Serial.read());  // read from serial from sim900 shield
}

void clearserialbufferArray()  // clear the storage buffer
{
  for (int i=0; i<count;i++)
  {
    serialbuffer=NULL;
  }
}
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: robtillaart on Oct 11, 2015, 03:31 pm
please use code tags,
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: BillieBricks on Feb 17, 2016, 06:04 pm
Thank you for the clearly written how-to. It's was/is very helpful ;)
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: Nandagopal-P on Apr 03, 2016, 04:19 pm
I have tried the below mentioned code to get the message to my mobile. Instead of getting message i could only get the output in my serial monitor alone. Could anyone help me to get the message to my mobile. I'm in very need of this now.

char phone_no[]="8754928455";
void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  delay(2000);
  Serial.println("AT");
  delay(1000);
  Serial.println("AT+CMGS=1");
  Serial.print("AT+CMGS=\"");
  Serial.print(phone_no);
  delay(1000);
  Serial.print("\n Hello Dude");
  delay(1000);
 
 
}

void loop()
{
  // put your main code here, to run repeatedly:
 
}
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: richmond on Aug 02, 2016, 07:35 pm
Can someone help me? This is my code.

#include <LiquidCrystal.h>
#include "SIM900.h"
#include "sms.h"
#include <SoftwareSerial.h>
//#include <sms.h>
#include <PString.h>
SMSGSM sms;
boolean started = false;
char buffer[160];
char smsbuffer[160];
char n[20];
//LiquidCrystal lcd(4,2,3,7,8,9);
int buttonState;
int lastButtonState = LOW;
long lastDebounceTime = 0;
long debounceDelay = 50;
boolean st = false;
int buzzer = 12;

void setup() {


  //lcd.begin(16, 2);
  Serial.begin(9600);
  if (gsm.begin(2400))
  {
    started = true;
  }
  if (started)
  {
    delsms();
  }
  sms.SendSMS("+60142646978" , "Gas Sensor and GSM module activated");


}

void loop() {

  //lcd.setCursor(0, 0);

  //lcd.print("Detektor Gas SMS");
  int val = analogRead(A0);
  val = map(val, 0, 1023, 0, 100);
  //lcd.setCursor(0,1);
  //lcd.print("Kadar: ");
  //lcd.print(val);
  //lcd.print("%   ");

  //code using sensor detection
  if (val > 10) {
    tone(buzzer,800,500);
  delay(1000);
    st = true;
  }
  else st = false;

  if (st != lastButtonState) {
    lastDebounceTime = millis();
  }


  if ((millis() - lastDebounceTime) > debounceDelay) {

    if (st != buttonState) {
      buttonState = st;


      if (buttonState == HIGH) {
        PString str(buffer, sizeof(buffer));
        str.begin();
        str.print("Gas Detected! Gas leakage at ");
        str.print(val);
        str.print("%");
        //String a=str;
        sms.SendSMS("+60142646978", buffer);
      }
    }
  }

  //code using sms lapor.
  lastButtonState = st;
  int pos = 0;
  if (started)
  {
    pos = sms.IsSMSPresent(SMS_ALL);
    if (pos)
    {
      sms.GetSMS(pos, n, smsbuffer, 100);
      delay(2000);
      if (!strcmp(smsbuffer, "lapor"))
      {
        PString str(buffer, sizeof(buffer));
        str.begin();
        str.print("Rate of gas leakage currently at ");
        str.print(val);
        str.print("%");
        //String a=str;
        sms.SendSMS("+60142646978", buffer);
      }
      delsms();
    }
  }
}

//delete sms yang dihantar
void delsms()
{
  for (int i = 0; i < 10; i++)
  {
    int pos = sms.IsSMSPresent(SMS_ALL);
    if (pos != 0)
    {
      if (sms.DeleteSMS(pos) == 1) {} else {}
    }
  }
}



I'm using arduino uno, sim900 module, mq2 gas sensor and buzzer to create a gas sensor detector based on sms.
I have to 2 option :
1. The mq2 gas sensor detects and send the result via sms to the number set in the code.
2. We can send a specific string to know the surrounding gas percentage and send the result to the specific number set in the code.

But I want to change the second option to be auto reply to any incoming number. What should I do?
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: sahmed1990 on Sep 19, 2016, 08:41 am
Hi guys,

In SIM900 module, when the RTC time reaches to predefined value, is it possible to set or reset one of the GPIO's of the SIM900. Like at 10AM module has to SET the GPIO for 10 seconds and reset after 10 seconds (one time everyday). All these things to be done by SIM900 module.
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: dhuhachaniago on Oct 26, 2016, 09:41 pm
Want to ask the master
I'd like an LED control sms with sim900 and button / switch
Roughly like this:
1) When we send sms led1on then LED1 flame and no sms notification sms that LED1 Flash
2) When we sms led1off then LED1 dead and no sms notification sms that LED1 dead
3) When we sms led2on then LED2 flame and no sms notification sms that LED2 flame
4) When we sms led2off then LED2 dead and no sms notification sms that LED2 dead
5) When we sms ledallon then LED1 and LED2 flame and no sms notification sms that LED1 and LED2 flame
6) When we sms ledalloff then LED1 and LED2 dead and no sms notification sms that LED1 and LED2 dead
7) When we press the button / switch then LED3 flame and no sms notification sms that LED3 flame
8) When we press the button / switch again then LED2 dead and no sms notification sms that LED3 dead
9) But when we've sms command led1on / led2on / ledallon, led1off / led2off / ledalloff, then the button / switch, we press no sms notification that LED3 flame (button press)

Please help the master arduino
Thank you already want to help me
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: dhuhachaniago on Oct 26, 2016, 09:58 pm
My problem at the points 7, 8, 9 in the sketch that I have
please help me
thank you
Title: Arduino GSM SIM900 Button LED
Post by: dhuhachaniago on Oct 26, 2016, 10:21 pm
Please help me

Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: Marcrem on Feb 04, 2017, 11:27 am
Hello, can somebody help me?
I bought some weeks ago a Geetech GPRS/GSM SIM900 shield. After installing the antenna and putting the SIM card to the shield, i stacked the shield to my Arduino Uno. The shield gets power via the Arduino Uno. I switched the shield on and the red led started up. The green led started to blink aswell, but with a frequency which indicates that there's NO network connection.
On the internet I don't find anything which tell me how to solve the problem.
Can somebody Help me with a list of instructions (steps to follow) in order to get the shield connected to the cellular GSM network.

PS: the SIM card that I'm using is a prepaid card and works perfect in my mobile GSM, after inserting the PIN code on my GSM.

I'm looking forward to some reactions on the message, which will help me.
Thanks in advance.
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: deo93 on Mar 21, 2017, 11:16 am
I have a problem with my SIM900 module which do not take the signal, ie the green light will blink and does pause signal indicating that it has. Ah to be this as I solve this problem
how you solve it mr may you help me i have the same problem
Title: Re: New tutorial - Arduino and SIM900 GSM Modules
Post by: nixxon1 on Jul 05, 2017, 11:40 am
If I understand correctly, you have PIN lock activated on that SIM. First deactivate the PIN protection (do that in the phone) and after that, insert the SIM into SIM900 module and try again.