Yarana Iot Guru
Published © MIT

🏠 Build a Smart Home Automation System

Control home appliances from your smartphone using ESP32/ESP8266 β€” automate lights, fans, and more! By YaranaIoT Guru

BeginnerFull instructions provided8 hours29
🏠 Build a Smart Home Automation System

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

πŸ’» ESP32 Sample Code

C/C++
This code demonstrates manual relay testing over Wi-Fi. For full cloud control, use KME Smart or Blynk app.
#include <WiFi.h>

const char* ssid = "YourWiFi";
const char* password = "YourPassword";

int relayPins[] = {23, 22, 21, 19};

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnected to WiFi!");
  
  for (int i = 0; i < 4; i++) {
    pinMode(relayPins[i], OUTPUT);
    digitalWrite(relayPins[i], LOW);
  }
}

void loop() {
  // Toggle each relay
  for (int i = 0; i < 4; i++) {
    digitalWrite(relayPins[i], HIGH);
    delay(1000);
    digitalWrite(relayPins[i], LOW);
    delay(1000);
  }
}

Credits

Yarana Iot Guru
35 projects β€’ 1 follower
Yarana Iot Guru Yarana IoT Guru: Arduino, ESP32, GSM, NodeMCU & more. Projects, Tutorials & App Development. Innovate with us!
Thanks to YaranaIoT Guru.

Comments