Garage Door Controller Integration with Obstruction Detection and Apple HomeKit

Hello everyone, I wanted to share my recent project where I successfully integrated an old Chamberlain Liftmaster garage door opener with my OpenHAB system. This journey has been quite an adventure, and I thought I’d document it here in case others might find it helpful or interesting.

Project Overview

I’ve always wanted to automate my garage door, but the challenge was integrating an older model with modern smart home technology. After some research, I decided to use an ESP8266 as the controller. The goal was to not only automate the door but also implement obstruction detection and ensure compatibility with Apple HomeKit.

The Setup

  1. Hardware: I used an ESP8266 DevKit (NodeMCU) as the controller. For the relay, I had a 3.3V relay board lying around, which I connected to a perfboard for soldering other components. An RGB LED was added for indication and debugging purposes.

  2. Software: I programmed the ESP8266 using the ESP8266 RTOS SDK, which is based on FreeRTOS. This allowed me to handle MQTT communication efficiently. The firmware was designed to read the safety sensor signals, detect obstructions, and publish the status via MQTT.

  3. OpenHAB Configuration: I set up MQTT topics for the garage door’s state, obstruction status, and RGB LED control. I also created items and rules in OpenHAB to handle the door’s operation, obstruction detection, and visual feedback through the RGB LED.

Challenges and Solutions

One of the main challenges was dealing with the safety sensors. These sensors emit a PWM signal when the door is unobstructed and a static HIGH signal when an obstruction is detected. I had to write custom code to accurately detect these signals and trigger the appropriate responses.

Another challenge was task scheduling on the ESP8266. The obstruction detection relies on interrupts for every rising and falling edge of the safety sensor signal. While this works well for detecting obstructions, I’m concerned that running these interrupts so frequently might be causing delays in processing MQTT events.

Current Concerns

Despite everything working smoothly, I’m worried about the task scheduling on the ESP MCU. The frequent interrupts might be eating up too much processing time, potentially blocking other tasks like MQTT event handling. I’d love to hear if anyone has insights or recommendations on how to optimize this setup to prevent any performance issues.

Seeking Advice

If anyone has experience with similar projects or knows of a more efficient way to handle obstruction detection without overwhelming the MCU, I’d be grateful for your input. Whether it’s about adjusting the interrupt handling, using a different MCU, or optimizing the task priorities, I’m all ears!

Thanks for reading, and I look forward to any feedback or suggestions you might have!