I made an example of the Home Automation using Wemos D1 + Blynk. The house has three rooms and a garage door and can be remotely controlled by Android or iOS. Wemos and Android (or iOS) are connected to server via local wifi.
Project video:
Used hardware:
- Wooden house model
- Wemos D1
- 5V power bank
- 5V yellow LED (3x 10cm)
- 5V servo motor
- Jumpers + cables
- Glue
Used software:
- Blynk
- Arduino IDE to program Wemos D1
Project code:
Thanks to great Blynk app, there si no need to program any light control to Wemos. For light control I used D0, D1 and D3 pins. For the garage door I used virtual pin V0 because I needed to set the proper limits of servo.
//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Servo.h>
char auth[] = "#######";
char ssid[] = "#######";
char pass[] = "#######";
Servo servogaraza;
BLYNK_WRITE(V0){
int pozicija = param.asInt();
if (pozicija == 0){
servogaraza.write(120); //top point
Serial.println("Open");
}
else if (pozicija == 1){
servogaraza.write(32); //low point
Serial.println("Close");
}
Serial.println(pozicija);
}
void setup(){
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
servogaraza.attach(D4);
}
void loop(){
Blynk.run();
}
Thank you Blynk for the great app and support!