Hackster is hosting Impact Spotlights: Smart Home. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Smart Home. Stream on Thursday!
robert watson
Published © GPL3+

Smart Home Automation System Using IoT

This project aims to design and implement a smart home automation system using IoT (Internet of Things).

BeginnerWork in progress3 hours174
Smart Home Automation System Using IoT

Things used in this project

Hardware components

SparkFun Breadboard Power Supply 5V/3.3V
SparkFun Breadboard Power Supply 5V/3.3V
×1
ESP8266 / Raspberry Pi
×1

Software apps and online services

Alexa Skills Kit
Amazon Alexa Alexa Skills Kit

Story

Read more

Code

related to this

HTML
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// WiFi credentials
char ssid[] = "Your_WiFi_Name";
char pass[] = "Your_WiFi_Password";

// Blynk authentication token
char auth[] = "Your_Blynk_Auth_Token";

// Define pins for relays (for appliances control)
#define LIGHT_PIN D1
#define FAN_PIN D2

// Virtual pins for Blynk
#define BLYNK_LIGHT V1
#define BLYNK_FAN V2

void setup() {
    Serial.begin(115200);
    Blynk.begin(auth, ssid, pass);
    pinMode(LIGHT_PIN, OUTPUT);
    pinMode(FAN_PIN, OUTPUT);
    digitalWrite(LIGHT_PIN, LOW);
    digitalWrite(FAN_PIN, LOW);
}

// Blynk function to control light
BLYNK_WRITE(BLYNK_LIGHT) {
    int lightState = param.asInt(); // Get value from app (0 or 1)
    digitalWrite(LIGHT_PIN, lightState);
}

// Blynk function to control fan
BLYNK_WRITE(BLYNK_FAN) {
    int fanState = param.asInt(); // Get value from app (0 or 1)
    digitalWrite(FAN_PIN, fanState);
}

void loop() {
    Blynk.run();
}

Credits

robert watson
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.