Usage Example for Arduino-Send SMS Messages
Last revision 2026/01/15
This article presents a detailed usage example for sending SMS messages with Arduino, guiding readers through the hardware and software setup, step-by-step procedures, and providing sample code for implementation using the SIM808 Expansion Shield.
Hardware Preparation
- DFR0181 Arduino UNO x1
- TEL0097 SIM808 Expansion Shield x1
- External Power Supply x1
- SIM Card x1
Software Preparation
-
Download and install the Arduino IDE: Click to download Arduino IDE
-
Download DFRobot_SIM808 library Click to Download DFRobot_SIM808 library
Steps
-
Insert a SIM card in to the SIM slot on the SIM808 expansion shield
-
Stack the expansion shield on to an Arduino UNO
-
Connect an external power source to the Arduino
-
Set the function switch to
None -
Upload the sample code
-
Set the function switch to
Arduinoand make sure SIM808 could communicate with Arduino board -
Press the Boot power button
-
Wait for the SIM card to register the network, the Net indicator LED will slowly flash every 3 seconds
-
Open the SIM808_SendSMS example or copy the code to your project
-
Input your SIM's phone number in the line:
#define PHONE_NUMBER "187*******39" -
Set the function switch to
Arduino
Sample Code
#include <DFRobot_sim808.h>
//Mobile phone number, need to change
#define PHONE_NUMBER "187*******39"
//The content of messages sent
#define MESSAGE "hello,world"
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
}
Was this article helpful?
