SIM800L is a cheap GSM/GPRS modem that works in four
frequency bands, i.e. 850, 900, 1800 and 1900 MHz. Its GPRS technology adopts
multi slot class 12/10 and supports the GPRS coding schemes CS1-CS4. Moreover,
with additional features such as Bluetooth, FM radio and compact size make it
the main alternative replacement the legendary module, SIM900.
To send an SMS (Short Message Service) with SIM800 module and Arduino is easy
enough. Simply provide some jumper cables to connect between modules with
Arduino. But you need to consider that this module works with a voltage range
of 3.4 - 4,4V. A voltage level which is not available in Arduino board (only
3.3V and 5V available). Thus, inevitably you have to provide an additional
power supply that provides a voltage level of 3.4 - 4,4V. Remember do not ever
connect Vcc pin of SIM800 module with voltage of 5V directly, because it can
damage the module. And if you are forced to use 3.3V voltage levels on the
Arduino board, then later will appear 'Under Voltage' warning in Serial Monitor
window. Then all functions of the module will be intermittent.
Tools and materials for Send SMS with SIM800L-Arduino experiments
1. Arduino Uno
2. SIM800L GSM/GPRS module
3. Some of the male-female jumper cables
4. DC-DC converter
5. Power supply 12V
Next, assemble all components above as shown in the picture
below
SIM800L-Arduino Sketch Handler
If all circuit hardware is ready, next step is to fill firmware
in Arduino board. Open Arduino IDE software, and fill in a simple sketch as
follows:
#include <SoftwareSerial.h>
#define SIM800_TX_PIN 8
#define SIM800_RX_PIN 7
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);
void setup() {
Serial.begin(9600);
while(!Serial);
Serial.println("Inisialize SIM800L module");
serialSIM800.begin(9600);
delay(1000);
Serial.println("Send SMS...");
//Set text mode to send sms
serialSIM800.write("AT+CMGF=1\r\n");
delay(1000);
//start to send Sms
serialSIM800.write("AT+CMGS=\"081910026910\"\r\n");
delay(1000);
serialSIM800.write("System ready");
delay(1000);
serialSIM800.write((char)26); //CTRL-Z
delay(1000);
Serial.println("SMS Terkirim!");
}
void loop() {
}
How it works is quite simple. Sketch above will emulates Arduino
pin 7 and 8 into serial pin using 'SoftwareSerial.h' library. Why not use hardware
serial in pin 0 and 1? Because this pin is used to monitor serial line Arduino
leading to laptop through a USB port using Serial Monitor window (for debugging
purposes).
Back again to pin 7 and 8 Arduino. These pins are connected
in cross connection to Tx/Rx pin of SIM800L module to communicate with. The
communication protocol used is the asynchronous serial communication with
certain baudrate (must be same both of Arduino and SIM800L module). While the
'language' used / understood by the modem is ‘AT Command’. So, inevitably
Arduino (or other controller) must use this command AT instruction set (you can
find its datasheet on the internet). Special to send sms, AT command sequence
is as follows:
AT + CMGS = "number-purpose" [enter]
[Type the SMS contents]
CTRL-Z
Oh yeah, one more, one of the important parameters in the
asynchronous serial communication is baudrate parameter. Default setting of the
SIM800L baudrate is 115,200 bps. You can easily change it to 9600 bps by
entering the AT command: 'AT + IPR = 9600' through the application console /
terminal client such as Hyper Terminal, Putty, or through Arduino’s Serial Monitor
window.
For a while it’s a preface tutorial, I will report more
enhanced practices in next tutorial. Meanwhile, maybe you can develop more
according to your project needs, inspired from my tutorial above. Let’s be
creative …
ConversionConversion EmoticonEmoticon