Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Arduino
120 min
Share

Send a message from Arduino to your phone

This project will help you understand how to interface the SIM900 GSM module with your Arduino. You can use the SIM900 GSM module in many other advanced projects, like receiving important data from a sensor or monitoring a system status over a large communication range.

Project Video

Overview

In this tutorial, we will learn how to send a message from Arduino to your phone, using SIM900 GSM module.

Getting the Items

Arduino Uno R3 (Voltaat Version)
Get Item
SIM900 GSM Shield for Arduino
Get Item
AC/DC Power Adapter – 5V 3A (Barrel Jack)
Get Item
Half-size Breadboard
Get Item
Push button Switch (5 Pack) - 12mm
Get Item
1/4 Watt Resistor (20 Pack)
Get Item
Jumper Wires - Male to Male (40 Pack)
Get Item

Steps

Wiring it Up

You must make sure the jumper cap is connected as shown in the picture on the serial port select.

Connect wires between the Arduino and the SIM900 GSM module as shown in the image below.

Connections from the Arduino to the breadboard:

• Arduino pin GND → Breadboard ground line

• Arduino pin 5V → Breadboard 5V line

Connections from the sim900 GSM module:

• GND pin→ Breadboard ground line

• TXD pin → Arduino pin 7

• RXD pin → Arduino pin 8

Connections from the push button:

• First pin→ Breadboard 5v line

• Second pin→ Arduino pin 2

• Second pin→10KΩ resistor → Breadboard GND line

Coding


/*
 Voltaat learn (http://learn.voltaat.com/)
 Link for full tutorial:

 Tutorial: Send a message from Arduino to your phone

 The function of this code is to send an SMS message,
 "This message from your Arduino Uno,"
 from your Arduino to your cell phone,
 The code is simple and straightforward;
 it may help you with more complex applications.

 Connections from the Arduino to the breadboard:
 • Arduino GND pin → Breadboard ground line
 • Arduino 5V pin → Breadboard 5V line

 Connections from the sim900 GSM module:
 • TWO GND pin→ Breadboard ground line
 • TXD pin → Arduino pin 7
 • RXD pin → Arduino pin 8

 Connections from the push button:
 • First pin→ Breadboard 5v line
 • Second pin→ Arduino pin 2
 • Second pin→10KΩ resistor → Breadboard ground line
*/

//Allows serial communication on other digital pins of an Arduino board
#include "SoftwareSerial.h"

//Define push button to arduino digital pin 2
#define pushButton 2

//Configure software serial port with digital pins 7,8 (TR,RX)
SoftwareSerial SIM900(7, 8);

//Commands inside void setup run once
void setup() {

 //Arduino communicates with SIM900 GSM shield at a baud rate of 9600 (9600 bits per second)
 SIM900.begin(9600);

 //Start the serial monitor at 9600 baud rate (9600 bits per second)
 Serial.begin(9600);

 //pushButton is defined as an input
 pinMode(pushButton, INPUT);

 // Give time to your GSM shield log on to network
 //delay(20000);


}

//Commands inside void setup run forever
void loop()
{
 //If you press the push button
 if (digitalRead(pushButton) == HIGH) {

   // Send the SMS
   sendSMS();
   Serial.println("This Message from your Arduino Uno");
   delay(15000);
 }
}

void sendSMS() {
 // AT command to set SIM900 to SMS mode
 SIM900.print("AT+CMGF=1\r");
 delay(100);

 //Replace the X's WITH THE recipient's mobile number - use the international fromat
 SIM900.println("AT+CMGS=\"+201068421369\"");
 delay(100);

 //Send "This Message from your Arduino Uno" to your phone nubmer
 SIM900.println("This Message from your Arduino Uno");
 delay(100);
 //End AT command with a ^Z, ASCII code 26
 SIM900.println((char)26);
 delay(100);
 SIM900.println();
 //Give module time to send SMS
 delay(5000);
}

Testing it Out

know when your plant needs watering

When you press the push button, you will notice that your mobile device receives the following message: “This message from your Arduino UNO.”

Resources

No items found.