Remote Garage Door Opener

I was locked out of the house for the last time this weekend.   I had to ask my son (who kindly agreed) to leave the warmth of his home in the dead of winter to drive over to unlock the door for me.  Thank you Matthew!

To prevent his from ever happening again I made the decision to put together a way to remotely trigger the garage door opener over the internet.  My plan is to use an ESP8266 ciruit board (connected  to WiFi) to convert some type of Node-Red “button” request into a signal to trigger the garage door opener.

Items needed for this project include the following.

1)  MQTT enabled buttons developed in Node-Red
2)  MQTT Broker
3)  ESP8266 NodeMCU 12E WiFi module
4)  2 channel DC 5V relay module

For the hardware I’ll use an ESP8266 NodeMCU WiFi module running as an MQTT subscriber.  The ESP will receive MQTT messages generated from Node-Red and pass a 1/2 second “high” charge to the 5V relay module.  The relay will then toggle or turn on/off the light or raises/lowers the garage door.

For the software I plan to utilize a Node-Red application on the Raspberry Pi device that I’ve dedicated solely to Node-Red applications.    I’ll require two pushbuttons.   One pushbutton will turn on/off the garage light and the other will open/close the garage door.   Each pushbutton will send it’s own MQTT message to yet another Raspberry Pi device which I have set up as an MQTT broker.   These pushbuttons will be made available on my personal website (VPN access required of course).

As mentioned above, the two Node-Red pushbuttons will trigger an MQTT topic and message.    Below are the messages that will be sent to the broker and subsequently published to all devices subscribing to the topic:

Pushbutton Topic Message
Door /garage/ /pushDoor
Light /garage/ /pushLight

The MQTT broker will pick up the topic/message and publish the message to the network.    The ESP8266 module will be subscribed to the “/garage/” topic will register the request and subsequntly send a high/low signal to the relay.

Below is the programming required to make this work:

Node-Red code for the pushbuttons to generate the MQTT message .  I also included a node to email a notification that the door was opened using this method.   (Copy the text below and import into Node-Red flow):

[{"id":"cdca879a.3fb718","type":"mqtt out","z":"b2f98e6f.e517e","name":"MQTT Broker","topic":"","qos":"1","retain":"","broker":"a9f2e1e7.e7f44","x":280,"y":100,"wires":[]},{"id":"78d50758.a0d2a8","type":"ui_button","z":"b2f98e6f.e517e","tab":"cd0d433b.4d1dd","name":"Door","payload":"/pushDoor/","topic":"/garage/","group":"Garage","order":"2","x":90,"y":120,"wires":[["cdca879a.3fb718","9ef59396.7d4fa"]]},{"id":"d9e6f44.da1ea08","type":"ui_button","z":"b2f98e6f.e517e","tab":"cd0d433b.4d1dd","name":"Light","payload":"/pushLight/","topic":"/garage/","group":"Garage","order":1,"x":90,"y":60,"wires":[["cdca879a.3fb718"]]},{"id":"9ef59396.7d4fa","type":"e-mail","z":"b2f98e6f.e517e","server":"smtp.gmail.com","port":"465","secure":true,"name":"pbosker@gmail.com","dname":"Garage door opened/closed","x":330,"y":180,"wires":[]},{"id":"a9f2e1e7.e7f44","type":"mqtt-broker","z":"","broker":"192.168.1.158","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"1","willPayload":"","birthTopic":"","birthQos":"1","birthPayload":""},{"id":"cd0d433b.4d1dd","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":"1"}]

Arduino code flashed to ESP8266:

Code coming later

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.