Whenever someone rings the doorbell in our office, a loud sound is played from two door intercoms, one downstairs and one upstairs. The one that is upstairs is located near our development team. The red dot in the below image shows the location of the upstairs intercom, while the blue ellipse marks where the developers are situated.
When we moved to our current location in june 2019 the job of answering the intercom ended up being the development team's responsibility, mainly due to their close proximity to the intercom. The doorbell rings a few times a day, and either the microphone or the speaker outside the front door is terrible, because nobody ever hears what is said in the intercom. This of course leads to nobody bothering to make an attempt at communication, and everyone just presses on the “open door” button without second thoughts.
The job of answering the door is reduced to walking a few meters from the desk to the intercom, pushing the button, and returning to the desk. This is, naturally, a tough ask for a developer. Not that the distance is overwhelming, but precious concentration is broken as soon as you get up from your desk.
The hardware solution
The unnatural solution for a software engineer is to throw hardware at the problem, yet in this case that is what we did (at first). Realizing that a button is the simplest circuitry element imaginable that just shorts the circuit it is connected to, we soldered on two wires to the back of the button which we then extended all the way to our desks.
The button in the middle of the left image is the button that opens the door, and that we soldered wires onto the back of. The gray and the white wires are the wires that extend to our desks.
The wires extend from the intercom in the background to our desks. Our interior designer is very pleased with this.
We then connected three buttons to these wires, making a parallel connection for each button, so that only one of the buttons needed to be pressed to open the door. We wanted more than one button to avoid just moving the problem from being to walk to the intercom to walking to whoever's desk the button was on.
Fire in the hole!
Now whenever someone rings the door, the door opens almost immediately, as it’s almost become a competition to press the button first (not that we have a way of determining who won).
The software solution
The above solution works well when at least one of the desks with a button is “manned”. Whenever there’s a meeting or the developers are working from home we’re back to the original problem of having to walk to the intercom to answer the door. Only this time the distance is probably much greater (the developers sit right next to the intercom) so the problem is much worse.
Thus we needed a solution that allows any employee to open the door from anywhere in the office. Extending wires to every corner of the office was quickly deemed too hardware-heavy, so a solution involving a Raspberry PI, a tiny custom circuit, and some software was devised instead.
This new solution works as such: The Raspberry is connected to the same wires the buttons are connected to, and shorts these (acting as a remote controlled button) on behalf of employees. The Raspberry hosts a very simple website with a single button that, when clicked, triggers the Raspberry to open the door.
The Raspberry and the custom circuit. The black and red wires are connected in parallel with the ones that extend to the intercom.
The custom circuit is needed to be able to short the wires, which the Raspberry can’t do out of the box (it can only pull the voltage up or down). The custom circuit consists of an NPN transistor and a resistor. The base of the transistor is connected to a GPIO pin on the Raspberry, and the collector and emitter are connected to the wires that extend from the intercom. This way, when the GPIO on the Raspberry is high, the transistor shorts the wires in the same way a button would, while when the GPIO is low, the transistor acts as an open circuit.
The circuit diagram: The intercom is represented by the voltage source on the left, the physical buttons in the first solution by the switches, and this solution by the transistor, resistor and the Raspberry.
The website where employees can click the button to open the door.
The software consists of two Python applications: One for setting the GPIO pin high, wait a few seconds, and setting it low again. The other application is a Flask application serving the website through uWSGI and nginx. The latter also handles calling the former whenever the button is pressed.
The solution described here has become an integral part of the infrastructure in the office. Without it, the concentration of many people would’ve been disturbed every day, and a lot of long walks to and from the intercom would be necessary. As a plus, since opening the door now only requires a WiFi connection, it is also possible to enter the office from the street using your phone instead of the physical key (we’re aware of the security implications).