After a long day at work, the last thing you want is to sit in your driveway, fumbling for a garage remote that’s buried somewhere—or worse, left behind. Maybe the battery’s dead. Maybe the signal’s weak. Maybe someone else in your household needs access, but they don’t have the remote.
It’s a small everyday hassle that adds up to real frustration over time.
That’s why we built the Smart Garage Control System – to bring hands-free, hassle-free garage access to your daily routine.
With automatic license plate recognition, the garage opens as you arrive—no button presses, no waiting. For extra flexibility, the system can also be controlled via smartphone, giving you full access even without your vehicle.
Because coming home should feel like coming home—not like unlocking another problem.
How It WorksThe project is designed to manage and automate access to a garage based on vehicle license plate recognition. Authorized license plates are stored locally on a Raspberry Pi in a JSON-based whitelist. This list can be managed via MQTT messages, allowing new plates to be added, removed, or displayed as needed.
When a user approaches home, a script within Home Assistant is automatically triggered. This trigger can be based either on the user's smartphone connecting to the home Wi-Fi or entering a defined geofence. The script sends an MQTT message to activate the Raspberry Pi camera, which captures an image of the arriving vehicle. The image is then processed by a license plate recognition pipeline that uses YOLO for license plate detection and a CRNN model for optical character recognition. The detected license plate is compared against the stored whitelist. If a match is found, an MQTT message is sent to Home Assistant, which then communicates with an ESP32 microcontroller. The ESP32 activates a relay module that triggers the opening impulse for the garage door. As an alternative, users can manually open the garage door using the Home Assistant app on their smartphone.
When a vehicle leaves the garage, the process is similar. However, in this case, the trigger is provided by the ESP32. A light-dependent resistor (LDR) detects an increase in brightness—indicating that the garage door has been opened—sending an MQTT message to initiate the camera and license plate recognition process once more.
Build InstructionsRaspberry PiTo set up the Raspberry Pi, begin by connecting the camera module to the designated camera interface. After this, follow the step-by-step instructions provided in docs/setup_pi.txt within the pipeline repository. These instructions guide you through the entire setup process: installing the operating system on the Raspberry Pi, installing all required libraries, adjusting system settings, cloning the project code, and configuring the script to start automatically on boot.
Once the setup is complete, mount the Raspberry Pi and camera near the garage. Ensure that the camera is positioned level and straight to accurately capture vehicle license plates. The entrance area should be well-covered within the camera's field of view. Additionally, it is important to protect the Raspberry Pi from weather conditions to ensure reliable operation.
If you are interested in the training process of the detection and recognition models, you can explore the repository Automatic-Garage-Opener. It contains the training pipeline for the YOLO model (used for license plate detection), the generation of synthetic license plates, and the training of the CRNN model for character recognition.
ESP32The ESP32 in this project controls a relay module to interface with a typical garage door system. Most standard garage door openers include a terminal block for external control inputs. These systems operate by connecting the COM signal to the respective input (up or down) to trigger movement in the desired direction. The relay module serves this purpose by momentarily closing the circuit, simulating a button press. As shown in the schematic below, the relay is wired accordingly to safely and effectively control the door mechanism via the ESP32.
In addition, an LDR (Light Dependent Resistor) is used to determine the state of the garage door based on the ambient light level inside the garage. When the door is open, natural daylight enters, resulting in higher light readings. Conversely, when the door is closed, the garage remains darker, and the LDR detects lower light levels. Disadvantage: Reliable only during daylight.
The Home Assistant serves as the central control unit in this project:
The ESP32 is integrated into Home Assistant using ESPHome, which allows for seamless configuration and remote updates. Initially, the ESP32 must be flashed via USB, but afterward, any adjustments—such as changing the pin assignments for the up/down outputs or tweaking the brightness threshold for the LDR—can be made wirelessly through Home Assistant. This greatly simplifies future updates and maintenance. Additionally, the linked ESPHome YAML configuration automatically creates a cover entity in Home Assistant. This provides a real-time display of the garage door’s open/closed status and allows users to control the door directly from the Home Assistant app on their phone—making remote operation simple and intuitive. It is important to ensure that the Wi-Fi signal is strong enough at the garage door control unit’s location to support reliable communication and over-the-air updates.
In our setup, Home Assistant also functions as the MQTT broker, handling all MQTT-based communication. It communicates with the Raspberry Pi over MQTT, sending tailored wake-up signals depending on the trigger—such as location-based events or light levels indicating an open garage. In return, Home Assistant receives messages from the Pi when a license plate has been successfully recognized, along with a command indicating whether the garage door should be opened or closed. This bi-directional communication ensures smooth automation and real-time system response.
What next?The current state of the project represents a functional prototype tailored to a specific garage setup used for testing. There are several areas that offer potential for further development and improvement:
- Enhancing the license plate recognition model to improve accuracy and robustness.
- Addressing edge cases and failure scenarios, particularly when recognition fails or produces incorrect results.
- Designing and manufacturing a custom enclosure for the Raspberry Pi that supports various mounting options and ensures durability.
- Improving the monitoring and feedback mechanisms for the garage door’s current status to enhance reliability and safety.
Comments