Did you ever wanted your garage door to magically open without any manual interaction while driving home? Well here is how you can achieve this by building a GPS supported garage door opener.

Batcave - V1

In a previous post (projekt batcave - der prototyp), I described how to receive signals from your existing garage door remote by using a library called rc-switch. Thanks to that, I had all the necessary parts to build a fully working system.

These are the parts I used (Sources):

  • ESP8622 - Usually I use a Wemos D1 mini as it allready has a 5V voltage regulator on board.
  • RF 433MHz Transmitter/Receiver Module - we only need the transmitter here
  • GPS Modul
  • Casing

The Circuit

Prototyp - Steckplatine Prototyp - Steckplatine

The FM transmitter is connected to D0, GND and VCC (3.3V). The GPS modul has 4 relevant connectors:

  • EN (Yellow) –> VCC (3.3V)
  • VCC (Red) –> VCC (3.3V)
  • GND (Black) –> GND
  • RX (Green) –> D6 (Software Serial TX)
  • TX (Blue) –> D7 (Software Serial RX)

The Software (Git Repository)

There is no hardware without a proper software. In an initial version I concentrated on the pure functionality. That’s why I didn’t dare to create a separate batcave library in the first place, everything was done deathstar style ;-)

In the meantime I almost finished that task in a separate branch which is still not merged because I am facing some problems with the SoftwareSerial library - I am probably going to replace that with another library. If you want to contribute, feel free to contact me.

In the meantime, you can clone from master.

I soon realized that it would be best to build this little firmware as a state machine. There is a library called fms which came in very handy. Basically you define transitions containing 2 states and a signal. When the signal is sent, the first transision that matches the current state defines the next state.

main.cpp
1
2
3
...
fsm.add_transition(&state_initial, &state_send_signal, SEND_SIGNAL_EVENT, NULL);
fsm.add_transition(&state_initial, &state_got_gps, GOT_GPS_EVENT, NULL);

There is also a timed transition available that does transitions after a specified time rather than a signal. Here is the basic layout of my state machine:

Batcave - main Workflow Batcave - main Workflow

One requirement was to open the garage when leaving it in the morning. Therefore I had to persist some state info such as the gps fix and the “at home” state - whenever we lose or regain gps fix, or have passed the perimeters of our geo fence, this information gets written to EEPROM. If we start our engine and batcave boots up it knows we have entered the garage (at-home = true, gps lost = true), therefore it is going to send the door signal right from the start.

The Casing

I designed the case using Fusion 360. There are a bunch of good tutorials out there. So get a printer, and start designing !!

You can find my files here (STL-Files). I used transparent PLA so that all the little LEDs inside can shine through. I am propably going to change that as it draws too much attention while driving during the night ;-)

Batcave case open Batcave case open
Batcave case top with gps antenna Batcave case top with gps antenna

First Test

The Future

Having a gps enabled device in my car I soon thought of connecting it to the cloud and transmitt the tracking data to be stored and analized later on and build some apps upon it, such as an electronic driver’s log. There is a new topic that is drawing my attention right now - LoRaWAN. Maybe I am going to build one of these, put it on top of my flat and start transmitting using thethingsnetwork.org.

So stay tuned!

Partslist

Software