How to send SMS from GSM module to mobile phone using Arduino

 In security and home automation systems, it is sometimes necessary to quickly notify the owner of a situation. Alerts using sms messages, which can be sent from the GSM module, are perfect for this. And the implementation of such a dispatch will be discussed in this article.


How to send SMS from GSM module to mobile phone using Arduino

In our project, we will consider sending an SMS message from a GSM module SIM 800C to a mobile phone using an Arduino.


In this case, for ease of connection, we will use the GSM SIM 800 C Shield. Since this is a shield, that is, an expansion board, we can place it directly on the Arduino Uno board as shown in the following image.


How to send SMS from GSM module to mobile phone using Arduino

Insert the SIM card into the holder provided in the GSM module and then fix the SIM card holder as shown below.


How to send SMS from GSM module to mobile phone using Arduino

How to send SMS from GSM module to mobile phone using Arduino

Then apply power to the GSM module.


In the program, we need to indicate the phone number to which we should send a message. This module does not require the country code before the phone number. If you have a problem sending SMS, you can add the country code.


The source code for the Arduino program is as follows:



#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
 
#define FONA_RX            2
#define FONA_TX            3
#define FONA_RST           4
 
#define FONA_RI_INTERRUPT  0

char sendto[21] = "70xxxxxxxx"; 
char message[141] = "Hello"; 

String techtrends;
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
 
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
 
void setup() {  
  Serial.begin(115200);
  Serial.println(F("FONA incoming call example"));
  Serial.println(F("Initializing....(May take 3 seconds)"));
  delay(5000);
  fonaSS.begin(4800);
  if (! fona.begin(fonaSS)) {          
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  Serial.println(F("FONA is OK"));
 
 fona.print ("AT+CSMP=17,167,0,0\r");
   fona.sendSMS(sendto, message);
   delay(1000);
}
 
void loop()
{
  
  delay(10000);
}
Previous Post Next Post

Contact Form