Hey guys, we are back with another new project. In this article, we are going to describe how to make GSM based home automation using Arduino. By using this setup you can remotely control the AC as well as DC home appliances very easily. So if you want to make this project you can find it on our website. Please read the full article carefully and the instructions too so that your system can work well. Code and circuit diagram both are given below.
This is a home automation system and is used for controlling the home appliances. Basically a system that controls the electronics appliance over the GSM is known as the GSM based home automation system. By using this system we can control the things by our phone message and call. We can send various commands to the Arduino using text messages and calls with our phone. All the commands are predefined in our system to control a specific appliance. We are using a SIM900 GSM module that can help in receiving the information from the users.
- Arduino Uno
- SIM900
- 12V, 2amp power supply for gsm module
- 4 channel relay
- AC bulb
- Socket
- 220ohm resistor
This is the circuit diagram for the project. Please connect the wires properly according to the given diagram.
Gsm based Home automation Arduino Code:-Note: Please upload the code which is given below to the Arduino.
// Techatronic.com
#define Bulb1 3
#define Bulb2 4
#define Bulb3 5
int temp=0,i=0;
int led=8;
char str[15];
void setup()
{
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(Bulb1, OUTPUT);
pinMode(Bulb2, OUTPUT);
pinMode(Bulb3, OUTPUT);
digitalWrite(Bulb1,HIGH);
digitalWrite(Bulb2,HIGH);
digitalWrite(Bulb3,HIGH);
Serial.println("AT+CNMI=2,2,0,0,0");
delay(500);
Serial.println("AT+CMGF=1");
delay(1000);
}
void loop()
{
if(temp==1)
{
check();
temp=0;
i=0;
delay(1000);
}
}
void serialEvent()
{
while(Serial.available())
{
if(Serial.find("#A."))
{
digitalWrite(8, HIGH);
delay(1000);
digitalWrite(8, LOW);
while (Serial.available())
{
char inChar=Serial.read();
str[i++]=inChar;
if(inChar=='*')
{
temp=1;
return;
}
}
}
}
}
void check()
{
if(!(strncmp(str,"bulb1 on",8)))
{
digitalWrite(Bulb1, LOW);
delay(200);
}
else if(!(strncmp(str,"bulb1 off",9)))
{
digitalWrite(Bulb1, HIGH);
delay(200);
}
else if(!(strncmp(str,"bulb2 on",8)))
{
digitalWrite(Bulb2, LOW);
delay(200);
}
else if(!(strncmp(str,"bulb2 off",9)))
{
digitalWrite(Bulb2, HIGH);
delay(200);
}
else if(!(strncmp(str,"bulb3 on",8)))
{
digitalWrite(Bulb3, LOW);
delay(200);
}
else if(!(strncmp(str,"bulb3 off",9)))
{
digitalWrite(Bulb3, HIGH);
delay(200);
}
else if(!(strncmp(str,"all on",6)))
{
digitalWrite(Bulb1, LOW);
digitalWrite(Bulb2, LOW);
digitalWrite(Bulb3, LOW);
delay(200);
}
else if(!(strncmp(str,"all off",7)))
{
digitalWrite(Bulb1, HIGH);
digitalWrite(Bulb2, HIGH);
digitalWrite(Bulb3, HIGH);
delay(200);
}
}
We hope that you liked this project and for better understanding try to make it on your own. Also, do check out more tutorials on Arduino and Raspberry Pi.
.HAPPY LEARNING!
Comments
Please log in or sign up to comment.