By: Over Complicated DIY
Have you ever tried to automate your garage door only to realize that mounting magnetic reed switches is a nightmare? Between alignment issues and messy wires, it’s often more trouble than it’s worth.
For this project, I decided to go a different route. Instead of checking if two magnets are touching, the Smart Garage Door Controller V1 uses an MPU6050 IMU (Inertial Measurement Unit) to sense gravity and motion. It knows exactly where your door is because it feels the door move.
The electronics are housed in a custom 3D-printed case, powered directly from the same 110V AC outlet as the garage door opener. Here is how the power rail is handled:
Power Input: A 12V DC power supply feeds into the case.
Voltage Regulation: A Buck Converter steps that 12V down to the 5V required by the ESP32-S3.
Power Cleanup: To handle the "dirty" power environment of a garage (where big motors create electrical noise), I’ve used a smoothing capacitor.
Star Wiring: All power leads are soldered directly to the capacitor legs to minimize voltage drops and interference.
Wiring: Internally, I used 30 AWG wire for the tight spots, and standard garage door bell wire for the 4-lead umbilical (+/- and the two relay leads) that connects the controller to the opener's terminal block.
Wire Loom: Plastic loom to protect the umbilical as it moves with the door.
By mounting the sensor to the top panel of the door, the controller senses the vibration of the motor starting and the change in tilt as the panel goes from vertical to horizontal.
Expert Tuner Web GUI: A built-in web server allows you to calibrate sensitivity and smoothing in real-time.
Home Assistant Native: Full MQTT Discovery support—it shows up as a "Cover" entity automatically.
Safety First: Uses a 600ms pulse to simulate a button press, compatible with almost every standard opener.
Non-Volatile Memory: The ESP32 remembers if the door was open or closed even after a power outage.
Component Connection
MPU6050 SDA ESP32-S3 Pin 8
MPU6050 SCL ESP32-S3 Pin 9
Relay Signal ESP32-S3 Pin 10
Power In. 12V DC → Buck Converter (5V) → Capacitor
Before uploading, update the following variables in main.cpp:
WIFI_SSID / WIFI_PASS
MQTT_HOST / MQTT_USER / MQTT_PASS
Leveling: Open your door fully and click "SET OPEN (100%)" in the Web UI.
Sensitivity: Watch the Live G-Force readout. Set your Sensitivity threshold just above the "idle" noise level.
Smoothing: If the door status "flickers," increase the Smoothing value (closer to 0.8). If it feels laggy, decrease it (closer to 0.2).
Direction: If the percentage decreases while opening, toggle the Invert Direction checkbox.
PlatformIO Configuration (platformio.ini)
Main Controller Logic (src/main.cpp)
3D Printed Case Files
This project is the definition of "Over Complicated DIY"—why use a $2 magnet when you can use a 3-axis gyro and a web server? But the result is a fairly solid, fairly accurate controller that provides more data and better control than any off-the-shelf "smart" opener.
Happy Building!
- Over Complicated DIY