Imagine turning an Arduino and a GSM module (such as SIM900 or SIM800) into a miniature phone: you can dial out or send a message with the press of a button! Here's how to build your own simple project.
🔧 Components You’ll Need- Arduino Uno (or similar)
GSM module (SIM900, SIM800, SIM900A, etc.)
- GSM module (SIM900, SIM800, SIM900A, etc.)
Two pushbuttons
- Two pushbuttons
Two LEDs (with 220 Ω resistors)
- Two LEDs (with 220 Ω resistors)
Jumper wires and breadboard
- Jumper wires and breadboard
USB cable for uploading code
- USB cable for uploading code
A SIM card enabled for voice and SMS (2G network support)
- A SIM card enabled for voice and SMS (2G network support)
Follow these connections:
Arduino digital 10 → GSM TX
- Arduino digital 10 → GSM TX
Arduino digital 11 → GSM RX
- Arduino digital 11 → GSM RX
Arduino GND → GSM GND
- Arduino GND → GSM GND
Use Pushbutton 1 on Arduino D7 for calling
- Use Pushbutton 1 on Arduino D7 for calling
Use Pushbutton 2 on Arduino D8 for SMS
- Use Pushbutton 2 on Arduino D8 for SMS
LED 1 (on D5) lights during calling
- LED 1 (on D5) lights during calling
LED 2 (on D4) lights during SMS sending Power the GSM module with an appropriate supply (often 12 V/1 A or regulated 5 V/3–4 V depending on your module)
- LED 2 (on D4) lights during SMS sending Power the GSM module with an appropriate supply (often 12 V/1 A or regulated 5 V/3–4 V depending on your module)
Press Button 1 (D7)
- Press Button 1 (D7)
Arduino sends: ATD<phone_number>;
to dial
- Arduino sends:
ATD<phone_number>;
to dial
LED 1 turns on while dialing
- LED 1 turns on while dialing
After a delay, Arduino sends ATH
to hang up
- After a delay, Arduino sends
ATH
to hang up
Activity is echoed on the Serial Monitor
Activity is echoed on the Serial Monitor
Sending an SMSPress Button 2 (D8)
- Press Button 2 (D8)
Arduino sends:
AT+CMGF=1
to enable text mode
AT+CMGF=1
to enable text mode
AT+CMGS="phone number"
AT+CMGS="phone number"
The message text
- The message text
Ctrl+Z
(ASCII 26) to dispatch the SMS
Ctrl+Z
(ASCII 26) to dispatch the SMS- Arduino sends:
AT+CMGF=1
to enable text modeAT+CMGS="phone number"
The message textCtrl+Z
(ASCII 26) to dispatch the SMS
LED 2 indicates the action is underway
- LED 2 indicates the action is underway
Confirmations appear on the Serial Monitor
- Confirmations appear on the Serial Monitor
Arduino can also receive SMS using AT commands:
Use AT+CNMI=2,2,0,0,0
to configure forwarding
- Use
AT+CNMI=2,2,0,0,0
to configure forwarding
Then monitor gsm.available()
to read incoming SMS text and remote number
- Then monitor
gsm.available()
to read incoming SMS text and remote number - Arduino can also receive SMS using AT commands:Use
AT+CNMI=2,2,0,0,0
to configure forwardingThen monitorgsm.available()
to read incoming SMS text and remote number
cpp
CopyEdit
#include <SoftwareSerial.h>
SoftwareSerial gsm(10,11); // RX|TX
const int callBtn = 7, msgBtn = 8;
pinMode(callBtn, INPUT);
pinMode(msgBtn, INPUT);
pinMode(5, OUTPUT); // LED1
pinMode(4, OUTPUT); // LED2
void setup() {
delay(10000); // module startup
Serial.begin(9600);
gsm.begin(9600);
}
void loop() {
if (digitalRead(callBtn) == HIGH) {
gsm.println("ATD7007651787;"); // replace with your number
digitalWrite(5, HIGH);
delay(100);
gsm.println("ATH");
delay(2000);
digitalWrite(5, LOW);
Serial.println("Calling...");
}
if (digitalRead(msgBtn) == HIGH) {
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CMGS=\"7007651787\"\r");
delay(1000);
gsm.println("Hello from Arduino!");
delay(100);
gsm.write(26); // Ctrl+Z
Serial.println("Message sent");
digitalWrite(4, LOW);
}
if (gsm.available()) {
Serial.write(gsm.read());
}
}
cpp
CopyEdit
#include <SoftwareSerial.h>
SoftwareSerial gsm(10,11); // RX|TX
const int callBtn = 7, msgBtn = 8;
pinMode(callBtn, INPUT);
pinMode(msgBtn, INPUT);
pinMode(5, OUTPUT); // LED1
pinMode(4, OUTPUT); // LED2
void setup() {
delay(10000); // module startup
Serial.begin(9600);
gsm.begin(9600);
}
void loop() {
if (digitalRead(callBtn) == HIGH) {
gsm.println("ATD7007651787;"); // replace with your number
digitalWrite(5, HIGH);
delay(100);
gsm.println("ATH");
delay(2000);
digitalWrite(5, LOW);
Serial.println("Calling...");
}
if (digitalRead(msgBtn) == HIGH) {
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CMGS=\"7007651787\"\r");
delay(1000);
gsm.println("Hello from Arduino!");
delay(100);
gsm.write(26); // Ctrl+Z
Serial.println("Message sent");
digitalWrite(4, LOW);
}
if (gsm.available()) {
Serial.write(gsm.read());
}
}
⚠️ Important Tips & TroubleshootingEnsure your SIM card supports the required 2G band in your country (e.g. many GSM modules only support 900 / 1800 MHz)
- Ensure your SIM card supports the required 2G band in your country (e.g. many GSM modules only support 900 / 1800 MHz)
Check power requirements: GSM modules often need steady current bursts of 1–2 A; using a separate regulator or battery is advised
- Check power requirements: GSM modules often need steady current bursts of 1–2 A; using a separate regulator or battery is advised
Proper logic level shifting may be necessary (Arduino 5 V → module 3.3 V pins) to avoid damaging the module
- Proper logic level shifting may be necessary (Arduino 5 V → module 3.3 V pins) to avoid damaging the module
Match baud rates between Arduino (Serial Monitor) and GSM module to avoid gibberish output
- Match baud rates between Arduino (Serial Monitor) and GSM module to avoid gibberish output
Comments