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 functionality:

-         Open the garage door (if closed) when the Tesla approaches after being gone for a while.

-         Close the garage door will close (if open) about 15 secs after the Tesla leaves.

-         The device can be programmed to respond to any one Tesla and can be reset when necessary.

-         It has a web interface to operate and monitor the garage door, and to configure various parameters.

-         It supports the Genii “hack” (described separately) to indicate when the vehicle is completely inside the garage.

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 work out of the box: Tesla supports the MyQ product.  It avoids the security risk that exists in the BLE approach, though that requires a small annual subscription.  Tesla also reluctantly supports the old HomeLink thing for a fee.

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, pins 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 also can be very slow.  API 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.

Hardware

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 ‘obstruction 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.

     

Bluetooth

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.

Web Server

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.

The Genii Hack

Also check out a related project: https://pejaver.com/Projects/GeniiHack.htm

All in fun...

2025