While the notion of the best table in a cafe is open to debate, it’s likely that if you frequent specific places near your office or home, you have a preferred table. I’m someone who has a “spot” or table that I personally prefer. I can pretty much always be found in one of my preferred cafe at one of my preferred table. This post isn’t about coffee or my table it’s rather about how I ensure that I always know what’s the status of my table at different cafes.
Some time back I found myself reaching the cafe and my table being occupied. The reader should know at this point that I’m turning into one of those old man who gets massively disappointed over small changes like not getting their fav table. So, I decided to take the matters into my own hand and over engineered a solution for my problem.
Problem Statement
We want to identify the crowd in an around a particular place with minimal cost involved. No calling and confirming from cafes is not an option (we want over-engineered solution pay attention please). We will measure our solution on 3 parameters:
Cost.
Near real-time metrics.
Coolness.
Solution
My first thoughts were to just access to the camera’s setup but that would require creating some unethical backdoor. I have been fiddling around with these cheap ESP32 processors costs around Rs 500 or so.
These bad bois have a dual core processor, wifi, bluetooth and what not. So, I decided to use them along with a simple rechargeable battery from nearest Ikea.
How do I use them?
So typically all phones and a ton of other devices use bluetooth and Bluetooth Low Energy (BLE) for all sort of cool stuff. If you haven’t you must read about the Apple’s FindMy network. What I have done is I’ve written bunch of micropython scripts that scan the area for devices and send an update to my server at home.
The server at home just simply run a FastAPI server and captures the number of devices in and around the device. Each device has it’s own identification which tells me which cafe is seeing how many people around my table. My precious table:
So when I need to go out for a coffee I just query the API and it tells me which cafe table has minimal people around my table and I get to that one.
Corner cases
Since these devices are quite exposed I need to do some extra leg effort for solving bunch of things:
Battery consumption: I’m lazy I don’t want to change the battery's every so often so the device goes into deep sleep when it has pushed the data and sleeps for 5 mins. The device goes into deep sleep at night times (uses time sync from another API).
Home server safety: My server is DDoS protected and has TLS to avoid anyone figuring out how they can mess up with my system.
Internet: I’m heavily at the mercy of the cafes’ wifi I’m currently in the process of working out a solution that does not need the cafes’ wifi but that is experimental at best.
Losses: So far I’ve not lost or gotten my device stolen. But even if it does get stolen it’s a cheap device.
What’s next?
I’m thinking of extending the solution to some more interesting use-cases. I’d be happy to hear folks thought on what sort of over-engineered solutions you are working on.