Interface GSM Sim808 Module to Arduino – Calling,Send and Receive SMS

Many of us love working with Arduino. Because with the help of Arduino and GSM Sim808, it is possible to do a lot of fun projects at a very low cost by simply coding. And by interfacing GSM Sim808 with Arduino, it is possible to create many more fun projects. Because with the help of GSM you can control anything with the help of phone messages. You can control the light pump motor or any other load in your house through this GSM Module. So today I will show and explain to you how you can create such a project with the help of GSM by coding Arduino.

Through this blog post, I will show you how to interface between GSM and ARDUINO, how to read GSM – SMS and send SMS. Let’s see what modules and components we need to do this project practically.

 

  1. Arduino Uno R3 Board.
  2. GSM Sim808 Module.
  3. Jumper wire.
  4. 5v 2Amp Power supply.
  5. SIM.
  6. Mobile Phone.
  7. led
GSM sim808
GSM sim808

Coding Part:

Now I will show you the coding part. See for projecting with GSM above I have shown the pin diagram or connection diagram. You will make the connection according to this diagram. Now for coding you must add two library files to Arduino IDE Software. You can download these two library files from below.

Download the library file from here : Download Here

Software Serial Master: Download Here

 

After downloading the library file, you need to add it to the Arduino IDE software. After adding the library file, you need to add it to the image.

  1. Go to Arduino IDE software file option.
  2. Example.
  3. DFRobot_Sim808 Master.
  4. SIM808 call_up.
  5.  Send SMS.
  6.  Receive SMS.

SIM808 Load ON/OFF Project: Click Here

Our Youtube Channel: Click Here


Through GSM SIM 808 Module you can make calls but receive calls. You can do this project.First we will look at the coding of Call up.

CODE:

 #include <DFRobot_sim808.h>  
 #include <SoftwareSerial.h>  
 #define PIN_TX  7  
 #define PIN_RX  8  
 SoftwareSerial mySerial(PIN_TX,PIN_RX);  
 DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,  
 //Mobile phone number,need to change  
 #define PHONE_NUMBER "187******39"    
 //DFRobot_SIM808 sim808(&Serial);  
 void setup() {  
  mySerial.begin(9600);  
  Serial.begin(9600);  
  //********Initialize sim808 module*************  
  while(!sim808.init()) {   
    delay(1000);  
    Serial.print("Sim808 init error\r\n");  
  }  
  Serial.println("Sim808 init success");  
  Serial.println("Start to call ...");  
  //*********Call specified number***************  
  sim808.callUp(PHONE_NUMBER);  
 }  
 void loop() {  
  //nothing to do  
 }  

See through this coding you can do this project but receiving calls received by interfacing between GSM SIM 808 Module and Arduino. Now I will show you the coding of send SMS…

Code Send SMS:

 #include <DFRobot_sim808.h>  
 #include <SoftwareSerial.h>  
 //Mobile phone number,need to change  
 #define PHONE_NUMBER "187*******39"   
 //The content of messages sent  
 #define MESSAGE "hello,world"  
 #define PIN_TX  7  
 #define PIN_RX  8  
 SoftwareSerial mySerial(PIN_TX,PIN_RX);  
 DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,  
 //DFRobot_SIM808 sim808(&Serial);  
 void setup() {  
  //mySerial.begin(9600);  
  Serial.begin(9600);  
  //******** Initialize sim808 module *************  
  while(!sim808.init()) {  
    delay(1000);  
    Serial.print("Sim808 init error\r\n");  
  }   
  Serial.println("Sim808 init success");  
  Serial.println("Start to send message ...");  
  //******** define phone number and text **********  
  sim808.sendSMS(PHONE_NUMBER,MESSAGE);   
 }  
 void loop() {  
  //nothing to do  
 }  

With this coding you can project to send SMS. Now I will show the coding to receive SMS…

Code Read SMS:

 #include <DFRobot_sim808.h>  
 #include <SoftwareSerial.h>  
 #define MESSAGE_LENGTH 160  
 char message[MESSAGE_LENGTH];  
 int messageIndex = 0;  
 char phone[16];  
 char datetime[24];  
 #define PIN_TX  7  
 #define PIN_RX  8  
 SoftwareSerial mySerial(PIN_TX,PIN_RX);  
 DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,  
 //DFRobot_SIM808 sim808(&Serial);  
 void setup() {  
  //mySerial.begin(9600);  
  Serial.begin(9600);  
  //******** Initialize sim808 module *************  
  while(!sim808.init()) {  
    Serial.print("Sim808 init error\r\n");  
    delay(1000);  
  }  
  delay(3000);   
  Serial.println("Init Success, please send SMS message to me!");  
 }  
 void loop() {  
  //*********** Detecting unread SMS ************************  
   messageIndex = sim808.isSMSunread();  
   Serial.print("messageIndex: ");  
   Serial.println(messageIndex);  
   //*********** At least, there is one UNREAD SMS ***********  
   if (messageIndex > 0) {   
    sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);  
    //***********In order not to full SIM Memory, is better to delete it**********  
    sim808.deleteSMS(messageIndex);  
    Serial.print("From number: ");  
    Serial.println(phone);   
    Serial.print("Datetime: ");  
    Serial.println(datetime);      
    Serial.print("Recieved Message: ");  
    Serial.println(message);    
   }  
 }  

 

Above I have shown the coding of how to do call system project, call receiving project, and send SMS project by interfacing between GSM SIM808 Module and Arduino.

 

 

100% LikesVS
0% Dislikes

Leave a Comment