Before I went to college (the summer of 2019), I worked with my good friend Ryan Adolf to create "Compound Security," a voice-powered assistant that would unlock/open entry ways into one's house (like their garage door, for example). For me, I wanted to be able to open the gate to my driveway with my Google Assistant. Because we're not far enough in the future yet, garage doors and gates generally don't have APIs! So this project found us doing a lot of reverse engineering to be able to get big pieces of metal to open gracefully, all within 10 spoken words.
We first analyzed how the gate mechanism worked at the time: if I was inside the house, I could punch in 4 digits into my landline, and the gate would magically open! While we weren't sure how the data was flowing from the landline to the gate itself, we first tried to see if we could programatically generate dial tones and feed that through a landline interface. While generating the dial tones with SoX
from the command line was pretty easy, we never managed to successfully send it through any landline interfaces. Darn.
So the next thing we tried was creating a robotic arm that would physically press buttons on the keypads on my phone. We built a three-axis arm out of three servo motors and 3D-printed parts, but that ended up being the most questionable piece of engineering either of us had seen. So we abandoned that idea. Darn.
Then one day, while coming home from work, I realized that our cars can communicate with the gate—wirelessly!—with the remote control we had in the glove compartment. At that moment, I ran to my room, found an old garage door opener, paired it with the gate, and then took it apart. Looking at the buttons and the circuits on the inside, I saw that all that the button was doing was completing a circuit that would send out one of three signals.
I took these findings to Ryan, the resident hardware expert, and he suggested we use some transistors from the Computer Architecture class we took in highschool to programatically complete circuits on the repurposed garage door opener. On a separate PCB, we connected each circuit on the garage door opener through a 60 V 0.2 A transistor, whose base we pulled down with a 10K resistor. We also attached the base to a GPIO pin on an adjacent Raspberry Pi so that we could programatically send signals to our gate, garage door, or anything else that was infrared powered.
Here's a picture of the hardware:
Now that the hardware was setup, it was time to build the software! At first, I thought that I'd just have the Google Assistant servers send commands to my RasPi, but that presented a huge security issue: I'd have to configure our home network to allow incoming network connections. I decided to go with an alternative solution: websockets. When the RasPi booted, I'd have it establish a websocket connection to an intermediary GCP server that would be the relay between the Google Assistant servers and my RasPi. The flow ended up looking as follows:
I spent most of my time wrestling with the Google Assistant's Javascript SDK. Configuring intents through the SDK was infuriating (though I can't remember why specifically), so my advice to anybody trying to make a Google Assistant integration is to use Dialogflow, their console-based assistant configuration tool.
Apart from that, most other things went smoothly. Once I had setup my intermediary server on home.ramaswamy.org (which I have since taken offline due to costs), the websockets connected easily, the Google Assistant was calling me back consistently, and I placed the RasPi in a water-proof container in view of my gate. After months of iteration, it worked! I could say, "Hey Google, open the car gate" or "Hey Google, open the garage door," and my wish would be granted!
This was the first non-school project I did that lived at the intersection of hardware and software. GPIO pins were cool—they really were the stalwarts of the soft-hard transition. Most importantly, this ended up being something that I used on a daily basis, and my parents thought it was cool. What more could I ask for?