Making your own ‘smart’ garage door controller09 Feb 2021
I have two garage doors, both of which can have motors and can be opened automatically from my car, using a remote or a press off a button. Very convienient.
However, sometimes I want to check if the garage doors are closed and be able to close / open them remotely, even if I am not anywhere near them.
Now, you can buy new garage door motors or buy something that makes them smart, but what's the fun in that? It is just another app on your mobile phone, another company storing your data in the cloud and another security hole in your network.
I decided to make my own controllers for my garage doors. In fact, my idea was very simple: since most automatic garage doors have a physical, wired, button a relay should be able to mimic that button press. Also, I wanted to make it a bit more fancy and know if the door was closed, open or if a vehicle was parked in the parking spot. For that I needed a ultrasonic distance sensor.
I looked at various solutions, including opengarage.io, which is very similar, but too expensive for my taste, because I had to buy two (one for each door). Also I did not like their interface.
In the end, this is my solution:
- A Wemos D1 mini that runs a custom Arduino solution, which sends status and accepts commands over MQTT from a solution like Home Assistant. It also is configured for updates over the air.
- Two relays, one for each garage door
- Two HCSR04 ultrasonic distance sensors, one for each garage door.
The code can be easily extended to handle more than two doors.
I wanted to make the solution relatively secure, so I came up with a 'rolling cypher' security scheme. The controller only accepts the command to open the door when the cypher provided with the command matches with its calculation. For security purposes I removed that part from the code before sharing.
You can find the code and how to make it work for your situation on my GitHub.