Control Home Appliance From Internet Using Arduino and WiFi

Control home appliances from anywhere in world using Internet. Make your home smart with Arduino and ESP8266 WiFi Module.

  • 1,737 views
  • 2 comments
  • 10 respects

Components and supplies

Apps and online services

Ide web
Arduino IDE
REST API

About this project

In this project showing how you can control your home appliances from anywhere in world using Internet. In our daily life we always forget to switch off Lights, TV, AC, Fan and other appliances and unnecessary we waste electricity and money of course, which is very precious for us.

So we have created a very simple video that you can follow and convert your normal home to Smart Home and you can control from anywhere in world.

Detail description available on www.iotboys.com

Visit www.iotboys.com for more projects .

Schematics

Circuit Design
Circuit Design
Control home appliances from anywhere from internet 1 1024x844 hrwrwvnbkr

Code

Source CodeC/C++
Source Code
#include "SoftwareSerial.h"

String ssid ="WIFI_NAME";
String password="WIFI_PASSWORD";

SoftwareSerial esp(3, 2);// RX, TX

String server = "www.iotboys.com"; //Your Host 
String uri = "/YOUR_API"; // Your URI

int RED_BULB=5; 
int YELLOW_BULB=6;

void setup() {

  pinMode(RED_BULB, OUTPUT);
  pinMode(YELLOW_BULB, OUTPUT);
  
  digitalWrite(RED_BULB, HIGH);
  digitalWrite(YELLOW_BULB, HIGH);
  
  esp.begin(9600);
  
  Serial.begin(9600);

  connectWifi();
  
  httpget();
  
  delay(1000);

}
void connectWifi() {

String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";

esp.println(cmd);

delay(4000);

if(esp.find("OK")) {

Serial.println("Connected!");

}
else {

Serial.println("Cannot connect to wifi ! Connecting again..."); }
connectWifi();

}
/////////////////////////////GET METHOD///////////////////////////////
void httpget() {
esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.

if( esp.find("OK")) {

Serial.println("TCP connection ready");

} delay(1000);

String getRequest =
"GET " + uri + " HTTP/1.0\r\n" +
"Host: " + server + "\r\n" +
"Accept: *" + "/" + "*\r\n" +
"Content-Type: application/json\r\n" +
"\r\n";

String sendCmd = "AT+CIPSEND=";

esp.print(sendCmd);

esp.println(getRequest.length() );

delay(500);

if(esp.find(">")) { 
  Serial.println("Sending.."); 
  esp.print(getRequest);
  
if( esp.find("SEND OK")) { 
  
Serial.println("Packet sent");

while (esp.available()) {

String response = esp.readString();

int RED_BULB_ON = response.indexOf("RED_BULB>TRUE")>0?1:0;
int YELLOW_BULB_ON = response.indexOf("YELLOW_BULB>TRUE")>0?1:0;

if(RED_BULB_ON==1)
{
  digitalWrite(RED_BULB, LOW);
}
else
{
  digitalWrite(RED_BULB, HIGH);
}
if(YELLOW_BULB_ON==1)
{
  digitalWrite(YELLOW_BULB, LOW);
}
else
{
  digitalWrite(YELLOW_BULB, HIGH);
}
}
esp.println("AT+CIPCLOSE");

}
}
}

void loop() {
  httpget();
}

Comments

Similar projects you might like

Plant Communicator

Project tutorial by Arduino

  • 1,615 views
  • 0 comments
  • 6 respects

The Nerd

Project tutorial by Arduino

  • 617 views
  • 1 comment
  • 1 respect

LED Matrix Display Badge

Project tutorial by FabLabAQ

  • 684 views
  • 0 comments
  • 3 respects

PICASO 4.0 The Infinite X- Axis CNC Wall Engraver

Project tutorial by Arnab Kumar Das

  • 193 views
  • 1 comment
  • 2 respects

Object Tracker and Updater

by Rupin Chheda

  • 279 views
  • 1 comment
  • 3 respects
Add projectSign up / Login