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.

Contact

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

Map Your Particles!
Easy
  • 40
  • 3

Protip

Locate your Particle Photons, P1s and Electrons on a map without needing extra hardware.

Sending Photos and Video Over the Internet!
Easy
  • 1,744
  • 25

Full instructions

Record video, perform object and face recognition, take a time-lapse or whatever else with a Particle Photon and the 5-megapixel Arducam!

Boost Your Google Home With Prota OS for RPi
Easy
  • 1,246
  • 6

Full instructions

Extend your Google Home features to smart light, smart speakers, smart cam and smart appliances with those DIY tricks based on Raspberry Pi.

Google Home - Control DIY Devices
Easy
  • 821
  • 8

Full instructions

This project show how to control multiple IoT devices using Google Home.

DIY Smart Home Automation for Everyone
Easy
  • 1,457
  • 15

Full instructions

Smart Home automation made easy and accessible for anyone, for little budget and no skills needed with Prota OS on Raspberry Pi

MyPIR-Sensor Informs Me Via IFTTT
Easy
  • 224
  • 1

Full instructions

Cheap & easy alarm-system.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback