Call And Message Using Arduino And Gsm Module | GSM Tutorial | Arduino GSM project

Introduction

Hey guys, we are back with another new post. Do you know what a GSM module is? Well in this article we are going to make calls and message using Arduino and the gsm module. If you don’t know how a GSM module work with Arduino then goes through it first. Make the connections properly and then upload the given code to the Arduino. You can also check out more articles on Arduino and IoT published by us.

Call And Message Using Arduino And Gsm Module

Description

  • In this project we can make a phone call or send an SMS to any one using a GSM module in this arduino gsm project.
  • There are two push buttons, you can press the first push button and make a phone call.
  • For this you have you provide the mobile number on which you want to make a call.
  • You can also view the status of the executing task on the serial monitor screen.
  • The LED will glow and then turn off automatically once you press the push button which indicates that the task is under process .
  • You can also check the digitalize GSM based forest fire alert system made by us.
call and message using arduino and gsm module
call and message using arduino and gsm module

Components Required in GSM project

Call And Message Using Arduino And Gsm Module component

Arduino with GSM Module Circuit

call and message using arduino and gsm module
Arduino UNOLED 1LED 2220 Ohm Resistor
4 PinAnode Terminal   
5 Pin Anode Terminal 
GND  Terminal 1
 Cathode TerminalCathode TerminalTerminal 2
Arduino UNOButton 1Button 2220 Ohm Resistor
7 PinTerminal 1  
8 Pin Terminal 1 
GNDTerminal 2Terminal 2Terminal 1
 Terminal 1 Terminal 2
  Terminal 1Terminal 2
  • Connect a 12 volts 2 amp DC supply to the GSM module.
  • Join the digital-10 pin of the Arduino with the Tx pin of the GSM module.
  • Connect the GND pin of the Arduino with the GND pin of the GSM module.
  • Attach the digital-11 pin of the Arduino with the Rx pin of the GSM module.
  • Now take two LEDs and join their negative legs with the GND pin of the Arduino via a 220-ohm resistor.
  • Connect the positive leg of the one LED with the digital-4 pin of the Arduino and the positive leg of the other LED with the digital-5 pin of the Arduino.
  • Then take a push button and connect its one pin with the 5 volts pin of the Arduino. Join the other pin of the push button with the digital-8 pin of the Arduino.
  • Do the same for the second push button and connect it with the digital-7 pin of the Arduino.
  • Your circuit is complete now.
  • Also you can check the GSM based Home Automation.
gsm sim 900

Code for gsm and Arduino

NOTE: Please upload this code to the Arduino. You have to install <SoftwareSerial.h> library first. If you don’t know how to add a zip library to the Arduino IDE then do check it out here.

// TECHATRONIC.COM 
 // Download Library of SoftwareSerial link given  
 // https://github.com/PaulStoffregen/SoftwareSerial
   
#include<SoftwareSerial.h>
SoftwareSerial gsm(10,11); // SoftSerial( RX , TX ); 
 // 10 pin connect to TX of GSM SIM 900 Module  
 // 11 pin connect to RX of GSM SIM 900 Module
 
const int buttonPin1 = 7; // Push Button 1
const int buttonPin2 = 8; // Push Button 2  

int buttonState1 = 0;
int buttonState2 = 0;

void setup()
{
  delay(10000);
  Serial.begin(9600);
  gsm.begin(9600);
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);

   pinMode(5,OUTPUT);  // LED1 pin D5
   pinMode(4,OUTPUT);  // LED2 pin D4
  
  
 
}
void loop()
{
    buttonState1 = digitalRead(buttonPin1);
    buttonState2 = digitalRead(buttonPin2);

    if (Serial.available()>0)  
   switch(Serial.read())  
  { 
    case 'r': 
    RecieveMessage();  
    break;  
  } 

   if (gsm.available()>0)  
   Serial.write(gsm.read()); 

    

   if (buttonState1 == HIGH)
  {
   gsm.println("ATD7007651787;"); //replace x by your number
   delay(100);
   digitalWrite(5,HIGH);  // LED1 ON
   gsm.println("ATH");
   delay(2000);
   Serial.println("calling.....");
   digitalWrite(5,LOW);   // LED1 OFF
  } 


    if (buttonState2 == HIGH)
   {
    Serial.println ("Sending Message");
    digitalWrite(4,HIGH);      // LED2 ON 
  gsm.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);
  Serial.println ("Set SMS Number");
   gsm.println("AT+CMGS=\"7007651787\"\r"); //Mobile phone number to send message, replace x by your number
  delay(1000);
  Serial.println ("Set SMS Content");
  gsm.println("Techatronic.com");// Messsage content
  delay(100);
  Serial.println ("Finish");
  gsm.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  Serial.println ("Message has been sent ");
  digitalWrite(4,LOW);    // LED2 ON 

   } 
 
}
   void RecieveMessage()  
 {  
  Serial.println ("gsm RECEIVE SMS");
  delay (1000);  
  gsm.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS  
  delay(1000);  
  Serial.write ("Unread Message done");  
  
  } 

We hope that you liked this call and message using arduino and gsm module project and understand it’s working completely. If you have any doubts regarding this gsm project then feel free to post them in the comments section given below. Also, do check out more articles on Arduino and Raspberry Pi.

Thanks for reading.

gsm tutorial

1 thought on “Call And Message Using Arduino And Gsm Module | GSM Tutorial | Arduino GSM project”

  1. Hi If got a “sim900 gsm/gsm shield development board quad-band module” and I want it to be able to use 4 buttons to call 4 deferent callers. I cant find a Code on it on the net or YouTube, is there a possibility you can help my. I’m super new at Arduino.

    Reply

Leave a Comment