top of page

Arduino GSM Module Tutorial: Sending SMS and Making Calls

Introduction:

GSM (Global System for Mobile Communications) modules are commonly used with Arduino for various applications, including sending SMS messages and making phone calls. In this tutorial, we'll guide you through the process of connecting an Arduino to a GSM module (specifically, the SIM800L module) and demonstrate how to send SMS messages and make phone calls.

Materials You'll Need:

  1. Arduino board (e.g., Arduino Uno)

  2. SIM800L GSM module

  3. SIM card (with SMS and calling capabilities)

  4. Antenna for the GSM module

  5. External power supply (5V, 2A)

  6. Jumper wires

  7. Breadboard (optional)

Step 1: Wiring Connections

Connect the GSM module to the Arduino as follows:

  • GSM VCC to Arduino 5V

  • GSM GND to Arduino GND

  • GSM TX to Arduino RX (pin 2)

  • GSM RX to Arduino TX (pin 3)

  • GSM RST (if available) to Arduino digital pin (e.g., pin 7)

  • GSM PWR to the external 5V power supply's positive terminal

  • GSM GND to the external 5V power supply's negative terminal

Ensure the power supply can provide sufficient current (at least 2A) for the GSM module.

Step 2: Insert the SIM Card

Insert a SIM card with SMS and calling capabilities into the GSM module, ensuring it is properly seated.

Step 3: Install the Necessary Libraries

To interface with the SIM800L module, you'll need the Adafruit FONA library. Open the Arduino IDE, navigate to "Sketch" > "Include Library" > "Manage Libraries..." and search for "Adafruit FONA." Click "Install" to add the library to your Arduino IDE.

Step 4: Write the Arduino Code

Here's an example Arduino code for sending an SMS and making a phone call using the SIM800L module:



#include "Adafruit_FONA.h"


#define FONA_RX 2

#define FONA_TX 3


SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

Adafruit_FONA fona = Adafruit_FONA(FONA_RX, FONA_TX);


void setup() {

Serial.begin(115200);

fonaSS.begin(4800);

if (!fona.begin(fonaSS)) {

Serial.println("Couldn't find FONA");

while (1);

}

Serial.println("FONA Ready");


// Replace with the recipient's phone number

char phoneNumber[] = "+1234567890";

char message[] = "Hello from Arduino!";


// Send SMS

if (fona.sendSMS(phoneNumber, message)) {

Serial.println("SMS Sent!");

} else {

Serial.println("SMS Failed to Send");

}


// Make a phone call

if (fona.callPhone(phoneNumber)) {

Serial.println("Calling...");

} else {

Serial.println("Call Failed");

}

}


void loop() {

// Your code here

}


Step 5: Customize the Code

  • Replace "**+1234567890**" with the recipient's phone number for SMS and calling.

  • Modify the "**message[]**" variable to change the content of the SMS.

  • You can add more functionality or automate actions based on sensor inputs or other triggers in the loop() function.

Step 6: Upload and Run the Code

Upload the code to your Arduino and open the Serial Monitor (Tools > Serial Monitor) to see the debug messages. You should see messages indicating the status of the SMS and phone call.


Conclusion:

You've successfully connected an Arduino to a GSM module and learned how to send SMS messages and make phone calls. This opens up possibilities for various remote monitoring and control applications, such as security systems, home automation, and data reporting. Experiment further with the SIM800L module to explore its full range of capabilities.


18 views0 comments

Recent Posts

See All

Comments


bottom of page