Automated door system

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.


For this project, I am going to use a Photon board from Particle.io and a Relay module I got from eBay.

I am a huge fan of Particle, their products are super solid and easy to use. (this is not a sponsored post).

Particle Photon

particle photon

Relay Module

relay model


Hardware

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.

door circuit

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.

Connection

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.

relay connection

relay model

Software

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 method

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.

blynk
blynk

After connecting the Blynk app with the Particle board, you are ready to go!

POST method

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:

  https://api.spark.io/v1/devices/DEVICE_ID/open?access_token=ACCESS_TOKEN

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.

Happy hacking!

hackman

Comments

  1. hey, I am trying to replicate your cool project and I got a Photon and a relay. How did you manage to connect the relay to the photon? Have you opened the white thing that keeps together the 3 lines at the relay end?
    Thanks!

  2. hi, i wanna ask you what i should put instead of this code :
    Particle.publish(“house_door_open”); should i create something? i really didn’t get this. could you please tell me what i should do?

  3. i try to do first part which is Blynk method and i did all things same like here but when i push play button on the blynk app, it says that particle photon project is offline. how can i figure out this problem ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.