Earlier this year we moved from Berlin to Lisbon and found a nice apartment not too far from the city center.
Our apartment building door, like most around Lisbon, is old and doesn’t work very well. And with many friends coming to visit this summer, I decided to automate the door so that me and my friends can open the door using our mobile phones instead of spending 5 minutes trying to jiggle the key in the lock to get it open.
I am a huge fan of Particle, their products are super solid and easy to use. (this is not a sponsored post).
The hardware part of this project is very simple, I attached the relay to the intercom switch (this part may vary depending on your intercom system). As mine is very old, it was pretty straightforward to hack the wires from the switch to the relay.
When you press the switch, pin-1 and pin-2 are connected together, opening the door, and this will be the role of the relay in our project.
I am using a USB charger I had laying around the house to power the photon board. To control the relay you must connect three pins to the photon.
- VCC to 3V3
- GND to GND
- IN to D7
On the relay side, you just need to connect the wires on the middle and left or right side depending on your module.
On the software side, we need to find a way to send a signal to the photon board in order to close the circuit of the relay for a couple of seconds, opening the building door. When building this project, I came up with two possibilities, one faster that requires less coding and a more versatile version that requires a bit more coding.
Blynk is a modular mobile app for IOT projects and it is pretty easy to integrate with the Particle boards.
You need to get the app for your phone, get the authentication key, and change the code below. You may need to fix the code to match your hardware configuration.
After connecting the Blynk app with the Particle board, you are ready to go!
The second method is the one I am currently using because you can have more control of the system and also integrate it with different applications.
Below is the code to put in your Photon:
You can see on the setup() function, we are creating an external-call named “open”, which will trigger the function openCall().
To trigger the door-opening circuit, all you have to do is create a POST request to the following URL:
Just change the DEVICE_ID and ACCESS_TOKEN for the one of your application.
In my case, I decided to create an .html file and I added a button. Once pressed, it will open the door. It’s as simple as that! This way all I need to do is to share the URL with friends and family and they can easily open the door when they come home.
Here is the code:
From here you can use your creativity and improve the code, system, and much more.
For example, if you have an Airbnb with many different people coming to your house, you can create the system in a way that it will only work with specific accounts for a set period.