SetNFix
Published © LGPL

Smart Home Project Idea with SIM 800L Module

Make home automation project with sim800l

AdvancedFull instructions provided13
Smart Home Project Idea with SIM 800L Module

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Red
5 mm LED: Red
×1
Resistor 100 ohm
Resistor 100 ohm
×1
Gboard Pro 800 SIM800 GSM / GPRS Module 3.3v ATmega2560 Mainboard For Arduino Starter
Itead Gboard Pro 800 SIM800 GSM / GPRS Module 3.3v ATmega2560 Mainboard For Arduino Starter
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter

Story

Read more

Schematics

Circuit

Code

Codes

Arduino
#include <SoftwareSerial.h>
#include <Sim800l_EM.h>
Sim800l Sim800l;
unsigned long bauds = 9600;

String SMScontain; // SMS contain only
String SMSsender; // SMS sender's Name
String text; // Detail SMS 
String ReadTXT ="Test" ;
int NUMSMS; //SMS storage
long MSGlen;
uint8_t SMS_QTY;
String dt;
uint8_t index=1;
bool error;
String ReadMsg;
int Switch_1 = 4;// Out Put Pins
int Switch_2 = 5;// Out Put Pins
int Switch_3 = 6;// Out Put Pins
int Switch_4 = 7;// Out Put Pins
int Switch_5 = 8;// Out Put Pins


void setup(){
  Serial.begin(bauds);  
pinMode(Switch_1,OUTPUT);
pinMode(Switch_2,OUTPUT);
pinMode(Switch_3,OUTPUT);
pinMode(Switch_4,OUTPUT);
pinMode(Switch_5,OUTPUT);

  
  Sim800l.begin(); 
  delay(5000);
  Serial.print("Ready to Work");
}


void loop(){
//-------------------------------------------------------------
// Get SMS storage amount -------------------------------------
//-------------------------------------------------------------
Sim800l.AT();
delay(500);
//Serial.read();

int NUMSMS = Sim800l.getCountsms();
//SMScontain = Sim800l.readMSG(8);
//delay(500);
Serial.println(NUMSMS);
if (NUMSMS !=0 ){

//-------------------------------------------------------------
  
  SMScontain = Sim800l.readMSG(index); // Filter SMS contain
  SMScontain.trim();
  text = SMScontain;
  delay(1000);
  ReadTXT = text;
  
//-----------------------------------------------
 //===============================================
   if (text.length() > 0){ // GET SENDER NUMBER 
 //===============================================

    SMSsender = Sim800l.getNumberSms(index);
    SMSsender =SMSsender.substring(0,12);
    SMSsender.trim();
    //Serial.println(SMSsender.length() );
    //Serial.println(text);
    Sim800l.delAllSms();
 //  SMSsender = "+12345678910" // If you want to get fead back to a perticular number
//-----------------------------------------------
// FILTER MSG CONTAIN----------------------------
//-----------------------------------------------  

if (SMScontain.length() > 0){
Serial.print("SMSsender: ");
Serial.println(SMSsender);
Serial.print("SMS : ");
Serial.println(SMScontain);
}
//----------------------------------------------

}  //===============================================

} // END ------------------------------------>


//*************************************************
//ON OFF by SMS Switch 1----------------------------------
//*************************************************

if (SMScontain == "ON 1"){
digitalWrite(Switch_1,HIGH);
error=Sim800l.sendSms(SMSsender,"Switch 01 ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF 1"){
digitalWrite(Switch_1,LOW);
error=Sim800l.sendSms(SMSsender,"Switch 01 OFF"); // Active if you want a feadback
delay(500);}
//*************************************************
//*************************************************
//ON OFF by SMS Switch 2----------------------------------
//*************************************************

if (SMScontain == "ON 2"){
digitalWrite(Switch_2,HIGH);
error=Sim800l.sendSms(SMSsender,"Switch 02 ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF 2"){
digitalWrite(Switch_2,LOW);
error=Sim800l.sendSms(SMSsender,"Switch 02 OFF"); // Active if you want a feadback
delay(500);}
//*************************************************

//*************************************************
//ON OFF by SMS Switch 3----------------------------------
//*************************************************

if (SMScontain == "ON 3"){
digitalWrite(Switch_3,HIGH);
error=Sim800l.sendSms(SMSsender,"Switch 03 ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF 3"){
digitalWrite(Switch_3,LOW);
error=Sim800l.sendSms(SMSsender,"Switch 03 OFF"); // Active if you want a feadback
delay(500);}
//*************************************************

//*************************************************
//ON OFF by SMS Switch 4----------------------------------
//*************************************************

if (SMScontain == "ON 4"){
digitalWrite(Switch_4,HIGH);
error=Sim800l.sendSms(SMSsender,"Switch 04 ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF 4"){
digitalWrite(Switch_4,LOW);
error=Sim800l.sendSms(SMSsender,"Switch 04 OFF"); // Active if you want a feadback
delay(500);}
//*************************************************


//*************************************************
//ON OFF by SMS Switch 5----------------------------------
//*************************************************

if (SMScontain == "ON 5"){
digitalWrite(Switch_5,HIGH);//error=Sim800l.sendSms(SMSsender,"Switch 05 ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF 5"){
digitalWrite(Switch_5,LOW);
error=Sim800l.sendSms(SMSsender,"Switch 05 OFF"); // Active if you want a feadback
delay(500);}
//*************************************************

//*************************************************
//ON OFF by SMS all----------------------------------
//*************************************************

if (SMScontain == "ON ALL"){
digitalWrite(Switch_1,HIGH);
digitalWrite(Switch_2,HIGH);
digitalWrite(Switch_3,HIGH);
digitalWrite(Switch_4,HIGH);
digitalWrite(Switch_5,HIGH);
error=Sim800l.sendSms(SMSsender,"ALL Switch ON"); // Active if you want a feadback
delay(500);}
else if (SMScontain == "OFF ALL"){
digitalWrite(Switch_1,LOW);
digitalWrite(Switch_2,LOW);
digitalWrite(Switch_3,LOW);
digitalWrite(Switch_4,LOW);
digitalWrite(Switch_5,LOW);
error=Sim800l.sendSms(SMSsender,"ALL Switch OFF"); // Active if you want a feadback
delay(500);}
//*************************************************

//Clear Data
SMSsender ="";
SMScontain=""; 
text="";
if (NUMSMS >1){
Sim800l.delAllSms();}

} //END Void Loop

Credits

SetNFix

SetNFix

12 projects • 9 followers
I am an accountant in profession but, I would more prefer to work with electronics based innovations.

Comments

Add projectSign up / Login