Control LED using SIM800L Sim card module
What Will I Learn?
- You will learn How to control LED using SMS
- You will learn coding on arduino Desktop IDE
- You will learn how to connect components
Requirements
Write here a bullet list of the requirements for the user in order to follow this tutorial.
- SIM800L
- Breadboard
- Jumper wires
- A blue LED
- 1k ohm Resistor
- Type B usb cable
- Arduino UNO R3 board
- PC
Difficulty
- Basic arduino Project
Tutorial Contents
Part 1. Information about main components
- Sim Card Module Sim800l
I am using this module for connect the sim card. It is a necessary component to communicate Arduino with sim card. Arduino and sim800l are using the communication protocol UART.
Arduino UNO R3
I am using this module for connect sim800l and LED. It is the main component in this project. Arduino is the brain of this project because, All the data goes through Arduino's control.
Part 2.Build The Circuit
The SIM800L has 7 set of pins, we will use only the 4 pins which are the (1) VCC it refers to the power signal, (2)GND or sometimes zero voltage. (3) RX (Receive Pin) Recieving data from arduino to sim800l. (4) TX Transmit data from sim800l to arduino.
- LED - pin 13 of the arduino with 1k ohm resistor
- RX - pin 10 of the arduino
- TX - pin 11 of the arduino
- VCC - pin 5V of the arduino
- GND - pin GND of the arduino
After connecting the LED and SIM800L to the breadboard, we connect Arduino with the help of jumpers.
Part 3.Software
First, click on the link below and select the version with your computer system. Download the arduino Desktop IDE:
Second, need 2 library for this project softwareserial.h and Sim800l.h. Download the library:
You can add your library to Arduino desktop IDE like this;
Part 4.Programing
Source Code
#include <Sim800l.h>
#include <SoftwareSerial.h>
Sim800l Sim800l;
String text;
uint8_t index;
uint8_t LED=13;
String textSms;
void setup(){
pinMode(LED,OUTPUT);
Serial.begin(9600);
Sim800l.begin();
Sim800l.delAllSms();
}
void loop(){
text=Sim800l.readSms(1);
if (text.indexOf("TURNON")!=-1){
Serial.println(text);
Serial.println("LED TURN ON");
digitalWrite(LED,1);
Sim800l.delAllSms();
}
if (text.indexOf("TURNOFF")!=-1){
Serial.println("LED TURN OFF");
digitalWrite(LED,0);
Sim800l.delAllSms();
}
}
Part 5.Sending SMS
When you send as TURNON message, the led will be turned on, the led will be turned off when you send it as TURNOFF message.
I hope this Tutorial will help you, thank you.
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not follow the Utopian Rules.
You can contact us on Discord.
[utopian-moderator]