Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
K Gray
Published

Home Automation Smart Plugin with ESP8266 & Blynk

This tutorial is about making a Smart Plug with ESP8266 & Blynk for anything you want to turn on or off automatically.

BeginnerFull instructions provided30 minutes3,108
Home Automation Smart Plugin with ESP8266 & Blynk

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Grove - SPDT Relay(30A)
Seeed Studio Grove - SPDT Relay(30A)
×1
USB Wall Charger
×1
Wall Outlet Box
×1
Wall Outlet
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

ESP Smart Plug

Code

ESP Smart Plug Code

C/C++
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "your_auth";
char ssid[] = "your_ssid";
char pass[] = "your_pass";

#define relay 2 //GPIO2, D4

int state;

BLYNK_WRITE(V0){
  state = param.asInt();
}

void setup() {
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(relay, OUTPUT);
}

void loop() {
  digitalWrite(relay, state);
  Blynk.run();
}

Credits

K Gray
23 projects • 23 followers
I love making things out of electronic components, coding in python and C++, designing PCBs and lots more.

Comments