Garager V2
We had a Model 3 and it was great. Then we got a Model Y, and I learned that the HomeLink garage door opener that we had got so used to was no longer standard equipment. This note describes the design of the replacement. The first version was in Python on a Raspberry Pi Zero 2 W. The current version is in C++ on an ESP32-S3. It has the following basic functionality:
1. Open the garage door (if closed) when the Tesla approaches after being gone for a while.
2. Close the garage door will close (if open) about 15 secs after the Tesla leaves.
3. The device can be programmed to respond to any one Tesla and can be reset when necessary.
4. It can indicate when the vehicle is completely inside the garage, so the driver can stop. This is described further in the Genie “hack”.
5. It has a web interface to operate and monitor the garage door, and to configure various parameters.
There are several advanced functions that are limited to Teslas:
1. When the Tesla arrives, a calendar is checked for upcoming trips and a visual reminder is generated if the charge remaining is not sufficient.
2. The Tesla cabin can be pre-warmed or pre-cooled to prepare for an upcoming trip. The seat and steering wheel will be warmed, and windows will be closed.
3. The Tesla can be locked after arrival or at a configured time for the night. The windows and trunk will be closed. This is useful if the Tesla is parked on the driveway.
4. Tesla vehicles typically need a matching mobile phone (or card) before they can be driven. The device can temporarily enable the Tesla to be driven out of the garage without the phone.
5. The Tesla AC climate control sometimes stays on after arrival. The device can force it off.
6. The device can use the calendar to intelligently control the charging times and current to maximize battery health.
7. The device can close the garage door (if open) at a configurable time for the night.
All Teslas continually broadcast a Bluetooth LE signal. The ESP32 senses the signal and operates the garage door as needed by pulsing a relay that simulates the garage door button press. The door state (open or closed) is determined using a sensor where a magnet triggers a reed relay. No change is needed on the Tesla. An external antenna on the ESP32 significantly increases the BLE detection range. The software size requires 8Mb flash on the ESP32.
There are alternative solutions that provide the basic functions, specifically the MyQ product. It is a bit more expensive and requires a small annual subscription. Tesla also reluctantly supports the old HomeLink thing, though that also involves a significant fee.
There is nothing complicated here. The total cost is less than $20.
1. ESP32-S3 dev board with 16MB flash and an external PCB antenna (~$7)
2. Garage Door control stuff:
a. Relay, transistor, diodes, resistor,
b. Magnet, Magnet sensor, wires...
3. 3D printed case and sensor holder
4. A USB (C) power supply (5v 10w)
The final assembly is shown below.
The relay to pulse the garage door opener is driven by a transistor. The diode shown protects from any inductive spike caused by the relay as it turns off. The second relay shown is for the ‘entry sensor’ feature.
The 'door closed' sensor is a 'magnetic induction' reed switch. A magnet is attached to the belt or chain such that it is near the opener motor when the door is closed. When the door is opened, the magnet moves away towards the garage door. It will not go over the drive gear. The sensor is placed on the drive motor housing so that the magnet will activate the sensor when the door is fully closed. For this type of sensor, the magnet should ideally be positioned so that the lines of force pass longitudinally through the sensor. There is no ‘door open’ sensor. The 3D printed sensor mounts are shown below.
There are three ways to detect a Tesla: ICMP pings, the Tesla API and BLE. Tesla responds to pings while it is connected to the home LAN. However, pings stop when it goes to sleep. It also takes a while for an arriving Tesla to connect to the home WiFi and start responding to pings. The second option, the Tesla API is expensive and also can be very slow. It seems to not work for the few critical seconds after the vehicle starts. I considered building an Android app that could run a background task to signal the garage door when it was inside the home’s geo-fence. Most of the code to do that is in my Where project. In the end, I felt that a Bluetooth based solution was quite reliable.
The Tesla continuously broadcasts Bluetooth LE advertisements, even when it is asleep. These can be used to detect the presence or absence of the Tesla. A transition from absence to presence indicates an arrival and the door should be opened, while a transition from presence to absence indicates a departure and the door should be closed. The Pi detects the BLE signal of the arriving vehicle about 30 meters away. This sounds easy in theory, but there are many sticky issues in reality:
· Though there are frequent BLE advertisements transmitted (~10/sec), many get lost due to collisions.
· Even when the vehicle is peacefully asleep in the garage, the signal frequently gets lost for several seconds, falsely indicating a departure.
· Software updates can cause the Tesla to stop broadcasting a BLE signal for about 2 minutes, probably while rebooting. When the signal is restored after the update, it could falsely indicate an arrival and cause an undesired garage door opening. We need to not open the door for signal losses of less than 5 mins. Also, the door should not be closed until the signal has been lost for about 15 secs.
This solution is not limited to Teslas. Other vehicles (and bicycles too) could carry a BLE beacon. However, I would use a long-range beacon and power it using the vehicle.
A Tesla’s BLE beacon can be recorded and replayed using a freely available app. This would allow a hacker to spoof a Tesla and open garage doors. The device can be configured to authenticate the Tesla before opening the garage door. This also enables a few advanced functions. The authentication step takes about 2 secs.
The software has an embedded web server that displays status, allows the garage door to be opened and closed manually, and allows more configurations. The software can optionally send an SMS message when the door closes.
Also check out a related project: https://pejaver.com/Projects/GeniiHack.htm
All in fun...
2025