Things used in this project

Hardware components:
Photon new
Particle Photon
×1
Wemos Relay Shield
×1
Liftmaster Garage Door Button
×1
Reed Switch
×1
micro usb Power Supply
Used an old bluetooth headset charging plug
×1
Software apps and online services:
Particle Build Environment
IFTTT Particle
SmartThings Developer Environment
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)
Wire Strippers / crimpers (generic)
Wires (female to female pin connectors)

Schematics

Wiring diagram
Reed switch and relay connected to the Particle Photon, door button connected to the relay
Fritzing haj1mztp2x

Code

Photon GarageC/C++
Use build.particle.io to upload this to the Particle Photon of your choice (as long as it's the one connected to the garage door opener).
int openGarageDoor(String pin);
int closeGarageDoor(String pin);

int relayPin = D1;
int sensorPin = D4;
String state = "closed";

void setup() {
    // make functions visible to Particle
    Particle.function("openGarage", openGarageDoor);
    Particle.function("closeGarage", closeGarageDoor);
    // set pinModes
    pinMode(relayPin, OUTPUT);
    pinMode(sensorPin, INPUT_PULLUP);

}

void loop() {
  // tell Particle if the door opens
  if (state != "open") {
      if (digitalRead(sensorPin) == HIGH) {
          Particle.publish("Garage_Door_Status", "open");
          state = "open";
      }
  }
  // tell Particle if the door closes
  if (state != "closed") {
      if (digitalRead(sensorPin) == LOW) {
          Particle.publish("Garage_Door_Status", "closed");
          state = "closed";
      }
  }
}

int openGarageDoor(String pin) {
    if(state == "closed"){
        Particle.publish("Garage_Door_Status","opening");
        digitalWrite(relayPin, HIGH);
        delay(1000);
        digitalWrite(relayPin, LOW);
    }
return 0;
}

int closeGarageDoor(String pin) {
    if(state == "open"){
        Particle.publish("Garage_Door_Status","closing");
        digitalWrite(relayPin, HIGH);
        delay(1000);
        digitalWrite(relayPin, LOW);
    }
return 0;
}

Credits

5122f3c8245558d1be6fd4b74625f990
David Smyth

Electrically inclined mechanical engineer. Addicted to projects.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Direct Photon to TP-Link Device Control
Easy
  • 330
  • 8

Full instructions

Add this small file to your project to control TP-Link bulbs and plugs directly with simple subroutine calls.

Poor Man's CAN Bus
Easy
  • 183
  • 4

Protip

Learn how to connect microcontrollers together using the CAN bus by using a simple AND gate

Internet Connected Bubble Machine
Easy
  • 50
  • 2

Full instructions

Make it possible to activate a bubble machine from anywhere using a Particle Photon.

MyPIR-Sensor activate analog RGB Stripe controlled by Photon
Easy
  • 112
  • 2

Full instructions

At my age you have to get up at night and get tired on the way to the bathroom. Using a PIR-Sensor to trigger light on!

Wireless IoT Door Open/Closed Sensor
Easy
  • 848
  • 12

Full instructions

Using the built-in reed switch on the mcMod120, we'll show you how to setup a super easy way to be alerted and track opening doors!!

Weather Box
Easy
  • 2,197
  • 11

Full instructions

Small weather station that uploads to Weather Underground with a NeoPixel ring for visualization.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback