How to use GSM module with Arduino

Arduino

What is GSM Module?

GSM module is used for send/receive SMS, USSD, Call and Data service over GPRS. We used SIM900 in this tutorial, which is easy to inteface with Arduino using serial interface. Arduino will operate SIM900 using AT command

.SIM900

Where can we use this?

we can use this for vehicle tracking, home appliance control, connect devices with internet, GSM network monitoring, SMS Alert in Home security system.

How to connect with Arduino?

Connect Digital Pin 7&8 with Arduino. Common the ground.

GSM-Arduino-Connect-1

 

Check the below image

GSM-ArduinoConnect-2

GSM-ArduinoConnect-3

connect 2 jumper shown in the first picture. Software serial pin are connected with pin 7 & 8.

Code

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8); //Digital Pin 7 = TX, Digital Pin 8 = RX
unsigned char simmbuffer[64];
int bindex=0;

void setup(){
GPRS.begin(19200);
Serial.begin(19200);
Serial.print(“Serial ready”);
}

void loop(){
if (GPRS.available()){
while(GPRS.available()){
simmbuffer[bindex++]=GPRS.read();
if(bindex == 64)break;
}
Serial.write(simmbuffer,bindex);
for (int i=0; i<bindex;i++){
simmbuffer[i]=NULL;

}
bindex = 0;
}
if (Serial.available())
GPRS.write(Serial.read());
}

 

Set like below in Serial monitor interface

Serial-monitor

 

For details hands on please check the below video tutorial

 

20 comments

    • I think the issues are related – flat characterization and flat dramatic effect. I used Hugo to highlight the issue by means of ex&mtres.Clarke#8217;s Childhood’s End being the extreme of emotional deadness on one end, and Hugo being at the other extreme. And, on average, science fiction is closer to Clark than Hugo. I would like to see it a little more in Hugo’s direction. Was no one else appalled at the technical dryness at which Clark disposed of humanity?

  • hello sir. can you help me for the error of my gsm module and my arduino. because still the error says that the sim900 doesn’t response. check power and serial pin in gsm.cpp.. but my power supply is good. and my connection is same as yours.. how can I fix this? please help me.. florieranara04@gmail.com

  • My question is that i connected the gsm module directly to the arduino and the power light comes on but the netlight and status only stays on for a few seconds before going off. I thought the issue was with the network strength but now i’m thinking the arduino cant provide up to the 2A that the gsm module requires …… is this the case? and if so can i provide the 2A current via adding another component to the circuit because my project is powered with the arduino but i don’t want there to be two power adapters required to power the project.

    • Hi Damola, i have the same and exactly problem that you describe. Could you find a way to solve the netlght and status gone off after a few seconds?

      thnks!!

  • Thanks for the explanation!

    Your code should be changed such that ‘*’ can be used in place of ctrl-z for sending sms through the serial monitor:

    if (Serial.available())
    {
    byte b = Serial.read();
    if (b == ‘*’)
    GPRS.write(0x1a);
    else
    GPRS.write(b);
    }

  • Also, it’s not explicitly stated in your video, but the GSM module will not respond if the serial monitor is set to ‘No line endings’. It works with ‘Both NL & CR’.

Comments are closed.