Stephen
Published

Wireless Garage Door Opener

Wanted to replace the standard remote control unit for a garage door with an app on my iPhone.

BeginnerShowcase (no instructions)2 hours5,032
Wireless Garage Door Opener

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Breadboard (generic)
Breadboard (generic)
×1
relay
×1
NC Magnetic Reed Switch
×1

Software apps and online services

Blynk
Blynk

Story

Read more

Schematics

Garage door opener

Code

Garage door opener

Arduino
/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  Blynk using a LED widget on your phone!

  App project setup:
    LED widget on V1

  WARNING :
  For this example you'll need SimpleTimer library:
    https://github.com/jfturcot/SimpleTimer
  Visit this page for more information:
    http://playground.arduino.cc/Code/SimpleTimer
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXXXXXX";
char pass[] = "XXXXXXXXXX";

WidgetLED led1(V1);

#define BLYNK_GREEN   "#23C48E"
#define BLYNK_RED       "#D3435C"


SimpleTimer timer;

// V1 LED Widget State
void blinkLedWidget()
 
 {
 if (digitalRead(D3)) {  

    led1.setColor(BLYNK_RED);  // magnetic switch is open, D3 is HIGH
    Serial.println("Door is open");

  } else {

    led1.setColor(BLYNK_GREEN);  // magnetic switch is closed, D3 is LOW
    Serial.println("Door is closed");

  }

}



void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  pinMode(D6, OUTPUT);   // connects to D1 of Relay
  pinMode(D5, OUTPUT);   // connects to D2 of Relay
  pinMode(D3, INPUT);    // connects to NC Magnetic Reed Switch
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

// Turn LED on, so colors are visible
  led1.on();
  timer.setInterval(1500L, blinkLedWidget);
}

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

Credits

Stephen

Stephen

1 project • 1 follower

Comments

Add projectSign up / Login