SMS your Home

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

IntermediateFull instructions provided6,863

Things used in this project

Hardware components

1Sheeld
1Sheeld
×1
Relay (generic)
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Generic Lamp
×1
LED (generic)
LED (generic)
×1

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 • 29 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