Khaled Md Saifullah
Published © MIT

Led Control Over the Internet(IoT)

In this project I am going to show how we can control our home appliance like light(LED Light) by using our Home WiFi.

IntermediateFull instructions provided3 hours1,685
Led Control Over the Internet(IoT)

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Breadboard (generic)
Breadboard (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Fritzing file

Schematics

Led Light Control Over Internet

Code

Code for LED Light Control Over the Internet

Arduino
//Important Libries
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <ESP8266WiFi.h>

char ssid[] = "Your WiFi SSID name"; //Your Wifi Network Name
char wifiPassword[] = "Your WiFi Passsword"; //Your Wifi Password

char username[] = "Username from Cayenne website"; //This User Name From Cayenne Website
char password[] = "Password from Cayenne Website"; //This Password From Cayenne Website
char clientID[] = "ClientID from Cayenne Website"; //This Client ID From Cayenne Website

int light1 = 16; // Define Led Light
int light2 = 5;
int light3 = 4;

void setup() {
  pinMode(light1, OUTPUT);
  pinMode(light2, OUTPUT);
  pinMode(light3, OUTPUT);

  Serial.begin(115200);
  Cayenne.begin(username, password, clientID, ssid, wifiPassword);

}

void loop() {
  Cayenne.loop();
}

//Channels for Controlling Home Appliances
CAYENNE_IN(1)
{ CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());

  int i = getValue.asInt();
  digitalWrite(light1, i);
}

CAYENNE_IN(2)
{ CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());

  int j = getValue.asInt();
  digitalWrite(light2, j);
}

CAYENNE_IN(3)
{ CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());

  int k = getValue.asInt();
  digitalWrite(light3, k);
}

Code link for LED light control using internet

Credits

Khaled Md Saifullah

Khaled Md Saifullah

18 projects • 44 followers
🦸Tech Enthusiast 👨🏾‍💻Programmer 📳IoT Specialist

Comments