SIM800L based SMS controller

Pin
Send
Share
Send


SIM800L V2.0 GSM / GPRS is a quad-band GSM / GPRS module compatible with Arduino. The module is used to implement the functions of GSM (calls and SMS) and GPRS. The advantage of this module is the TTL interface with a voltage of 5V, which allows you to directly connect it to an Arduino or any other system with a 5V power supply. Most GSM / GPRS modules on the market require regulator connections or level conversion, while in SIM800L V.2 GSM / GPRS does not require additional interface level conversion circuits.
Here is an example project using SIM800L V.2 GSM / GPRS. The meaning of the project is to control the switches using the SMS controller. You can easily turn on and off most household appliances in the house, such as a llama, a fan, and so on.

Characteristics of the SIM800L V.2 GSM / GPRS module


Below are all the technical specifications of the SIM800L V.2 GSM / GPRS module:
  • TTL serial interface compatible with 3.3V and 5V microcontrollers compatible with Arduino.
  • The SIM800L module has a TTL serial interface.
  • Antenna plug
  • Network support: four bands 850/900/1800/1900 MHz, capable of making calls, SMS and data transfer with significantly reduced battery consumption.
  • VDD TTL UART interface, so you can directly connect an MCU such as 51MCU, ARM or MSP430. VDD plug used to match TTL voltage.
  • Model: SIMCOM SIM800L
  • Working voltage: from 3.7V to 5V;
  • dimensions: 40mm x 28mm x 3mm
  • GPRS multislot class 12/10
  • GPRS Batch Service Class B
  • Corresponds to GSM phase 2/2 +
  • Class 4 (2 Watts @ 850/900 MHz)
  • Class 1 (1 Wat @ 1800/1900 MHz)

Necessary materials


You'll need:


1. SIM800L V.2 GSM / GPRS module.
2. Arduino Uno.
3. 4-channel 5-volt relay module.
4. Wires - jumpers.
5. Power supply 5 V.
(Active links to the store for purchase)

Assembly and configuration


Once you have connected all the components, create a program, and then download it to your Arduino. But first, you must install the GPRS library, which you can download:
gprs.zip 28.02 Kb (downloads: 509)

Program Code for Arduino


After you have connected your SIM800L, 4-channel relay module and Arduino to your computer, enter the code below and you're done.
#include #include #define TIMEOUT 5000 #define ACTIVE LOW #define OFF HIGH byte Relay = {A0, A1, A2, A3}; byte StatRelay4; char buffNumber20; char currentLine500 = ""; int currentLineIndex = 0; bool nextLineIsMessage = false; String replyNumber = "089510863958"; GPRS gprs; void setup () {for (int i = 0; i >> Automatically Read SMS "); gprs.preInit (); delay (1000); while (0! = gprs.init ()) {delay (1000); Serial .print ("init errorrn");} // Manage message to mode ASCII if (0! = gprs.sendCmdAndWaitForResp ("AT + CMGF = 1rn", "OK", TIMEOUT)) {ERROR ("ERROR: CNMI") ; return;} // Read Incoming SMS if (0! = gprs.sendCmdAndWaitForResp ("AT + CNMI = 1,2,0,0,0rn", "OK", TIMEOUT)) {ERROR ("ERROR: CNMI") ; return;} int pjg = replyNumber.length () + 1; buffNumberpjg; replyNumber.toCharArray (buffNumber, pjg); Serial.print ("Send reply to number =>"); Serial.println (buffNumber); Serial.println ("Initialization Done"); Serial.println ("====================================== ========================))} void loop () {// Change status Relay ON / OFF for (int i = 0; i 0) {if (nextLineIsMessage) {Serial.println (lastLine); // =================================== ============================== >> Function of Relay Controller // Relay 1 Controller if (lastLine.indexOf ("Relay 1 ON ")> = 0) {StatRelay0 = AKTIF; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 1 Status Active"); gprs.sendSMS (buffNumber, "Relay 1 Status Active"); } else if (lastLine.indexOf ("Relay 1 OFF")> = 0) {StatRelay0 = MATI; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 1 Status Off"); gprs.sendSMS (buffNumber, "Relay 1 Status Off"); } // Relay 2 Controller if (lastLine.indexOf ("Relay 2 ON")> = 0) {StatRelay1 = AKTIF; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 2 Status Active"); gprs.sendSMS (buffNumber, "Relay 2 Status Active"); } else if (lastLine.indexOf ("Relay 2 OFF")> = 0) {StatRelay1 = MATI; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 2 Status Off"); gprs.sendSMS (buffNumber, "Relay 2 Status Off"); } // Relay 3 Controller if (lastLine.indexOf ("Relay 3 ON")> = 0) {StatRelay2 = AKTIF; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 3 Status Active"); gprs.sendSMS (buffNumber, "Relay 3 Status Active"); } else if (lastLine.indexOf ("Relay 3 OFF")> = 0) {StatRelay2 = MATI; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 3 Status Off"); gprs.sendSMS (buffNumber, "Relay 3 Status Off"); } // Relay 4 Controller if (lastLine.indexOf ("Relay 4 ON")> = 0) {StatRelay3 = AKTIF; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 4 Status Active"); gprs.sendSMS (buffNumber, "Relay 1 Status Active"); } else if (lastLine.indexOf ("Relay 4 OFF")> = 0) {StatRelay3 = MATI; Serial.print ("Reply ==== >>>>"); Serial.println ("Relay 4 Status Off"); gprs.sendSMS (buffNumber, "Relay 4 Status Off"); } nextLineIsMessage = false; } // ================================================ =================== >>} // Clear char array for next line of read for (int i = 0; i <sizeof (currentLine); ++ i) {currentLinei = (char) 0; } currentLineIndex = 0; } else {currentLinecurcurrentLineIndex ++ = lastCharRead; }}}

Device check


The tool works by sending SMS to SIM800L with a specific sequence of characters. For example, to enable relay 1, use the command "Relay 1 ON", and to turn it off, use the command "Relay 1 OFF". The rest of the relays have almost the same commands, with the exception of the serial number of each relay that you want to operate on. After automatically sending a message, the SIM800 will send a response in the form of a status message for each SIM card.

Video assembly, configuration, and device verification



Original article in English

Pin
Send
Share
Send

Watch the video: SMS Controller SIM800L V2 (November 2024).