Hacking the parking gate
How we developed an internal tool from idea to prototype within a day
It’s well known that at Q42, we love our internal side projects. Especially when it comes to office hacks, like the Shitty Load Balancer. Most of these projects arise during our bi-weekly Passietijd (Tinker Friday) on which we get a full day to play around with new technologies or to build cool applications. Personally, I love the approach of building a quick prototype to test the usefulness of an idea.
Recently, we got a new parking system at our office in The Hague. Previously, we had to scan our badge to get access to the parking garage. But now we had to switch to using remotes to enter the parking gate. That created a problem. Not only was there a lack of - very expensive - remotes, we also got notified only a few days upfront about this new situation. Most Q'ers would now have to temporarily park their car at the gate, run inside to grab a remote, run back to the car, just to enter the garage. Not quite the ideal situation. However, constraints turned into creativity as we solved this problem with a small hardware project.
When we finally got our hands on the remote, the itch to solve our problem was immediately there. The goal: get a solution in a single day. The bonus challenge: we didn't want the owner of the parking garage to know that we were hacking their system... 😁
The first attempt was reading the radio signal from the remote. Using a HackRF we set out to capture the signal and replay (sending the same signal again) it. And... No luck. It was a unique code every time. Of course, we could spend time on deciphering this, but would we match our time constraint then? Unlikely…
On to the next approach then! What about soldering wires to the buttons and just using a relay (an electronically controlled switch)? That would work!
I set about to solder some wires and order components. Because of the stability and versatility, I opted to use an ESP32 microcontroller as the main board, as well as a common dual relay board for the two different buttons. The hardware side was created in a couple of hours. Now we had to do the software. What kind of front-end / client side could we build for our colleagues to use this easily?
The first idea for this was to use a web interface where we could open the parking gate. Unfortunately, we had no Wi-Fi reception at this place, so this idea quickly became harder since we couldn’t connect the device directly to the internet that way and control it remotely.
Luckily, the ESP32 also has Bluetooth Low Energy support! We could use this to create a local app that could even work offline. We quickly set up a proof of concept, and it worked amazingly well!
So it was time to make our mobile apps. We started with the iOS app, since iOS has a relatively good interface for Bluetooth Low Energy. First, we made a functional MVP iOS app. This app had just a button that opened the garage door, and it worked! My colleague Carsten set out to make this a nice looking app with some styling in SwiftUI, as well as a Google login to prevent abuse.
For Android, another colleague, Joost, made an awesome web interface using the new and experimental Web Bluetooth API, along with a Google login and access rules in Firebase storage to get the secrets to send to the hardware. This gives Android users a way to open the garage door as well.
At the end, we had a relatively simple hardware device - hidden in the garage 😉 - and two mobile apps that allow any of our colleagues to open the garage door again from within their car. This was all achieved with just some creatively applied pragmatic technology.
Buying extra remotes for all 80+ Q'ers would have costed us several thousands of euros. Our hack turned out to be much cheaper! 🤓