SMS your Home

Remotely control home appliances (ON/OFF switching) by sending SMS

IntermediateFull instructions provided8,478

Things used in this project

Schematics

Circuit layout

Fritzing file

Code

Untitled file

Arduino
/*

SMS Your Home

This is a code to switch home appliance ON/OFF through sending SMS

This example shows an application on 1Sheeld's SMS shield.


*/

/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* 

A name for the LED on pin 12.

A name for the Lamp on pin 13.

*/


int WledPin = 12;
int LledPin = 13;


void setup()
{
	/* Start communication. */
	
	OneSheeld.begin();
	
	/* Set the LED pin as output.
	
	   set pin 12 as output
	*/
	   
	pinMode(WledPin, OUTPUT);
	pinMode(LledPin, OUTPUT);
	
}

void readSMS (String phoneNumber , String messageBody)
{
    //confirm sender is a specific numer//
    String strMobileNumber = "+12345678900000";
    
    /* Print out the phone Number and message on Terminal shield. */
    Terminal.println(phoneNumber);
    Terminal.println(messageBody);
    
    
    if (phoneNumber == strMobileNumber)
    {
    	//can detect upper and lower case//
    	messageBody.toLowerCase();
    	
    	//turn ON white led on pin 12 if "white on is recieved"//
    	if (messageBody == "white on")
    	{
    		digitalWrite(WledPin, HIGH);
    	}
    	
    	
    	//turn OFF white led on pin 12 if "white off is recieved"//
    	else if (messageBody == "white off")
    	{
    		digitalWrite(WledPin, LOW);
    	}
    	
    	
    	//turn ON lamp on pin 13 if "lamp on is recieved"//
    	else if (messageBody == "lamp on")
    	{
    		digitalWrite(LledPin, HIGH);
    	}
    	
    	
    	//turn OFF lamp on pin 13 if "lamp off is recieved"//
    	else if (messageBody == "lamp off")
    	{
    		digitalWrite(LledPin, LOW);
    	}
    }
    
}

void loop ()
{
	
	SMS.setOnSmsReceive(&readSMS);
	
}

Arduino Code

Credits

Mohamed Hassan AbdulRahman

Mohamed Hassan AbdulRahman

5 projects • 36 followers
Maker, aiming to make people’s life easier and more meaningful, using the latest HW & SW technologies, analysis and research.
Abdulrahman Elsharqawy

Abdulrahman Elsharqawy

2 projects • 8 followers
A passionate Maker

Comments