Introduction: IOT Door Opener - With Old Smartphone and Headphones

A few years ago, I have developed a system to open my home door remotely.
For me it is really useful. For example when the mailman arrives, I am never there. He calls me at the phone, I answer that I'm in the shower and to leave the stuff downstairs (it is not true, I'm elsewhere).

In the meantime I open the door remotely.

Moreover I never bring the keys with me, and this is the only way for me to get in when I am locked out.

Finally, if I have guests at my place, there is no better way to open the door when I'm not around.

The system I have developed is a little bit complicated. For this reason, I propose this solution instead, that is simplified and low cost.

It opens the door (the main door on the street) thanks to an old phone, a pair of broken headphones and an Arduino.

The idea: I always see those selfie sticks everywhere (I live in Venice).

They do have a jack.

source: https://s-media-cache-ak0.pinimg.com/originals/87...

Step 1: The Circuit

At first you have to cut the wires and take care of one of the two channels (right or left does not matter, pick one.)
(img1) After peeling it, there are two more wires inside. One is the ground, the other is the signal (right or left). (img2) To do a clean job it is better soldering the two wires to the jumpers that will go to Arduino. The only important thing is to remember which is negative and which positive.

Step 2: Connecting Arduino

ow we can plug the jack into the phone and connect the wires to the Arduino (for a really low cost project you could use an ATTINY without problems).
The negative will go to Arduino ground, while the positive will go to pin A0. A0 is an analog input and it detects current variations. An audio signal, like the one that is coming out of the headphones output, makes a membrane vibrate, and so it will also be detected by Arduino. Let's make a fast test, using the simplest of the Arduino sketches: Analog Read Serial. Here is the result of the data in A0 when a beep sounds. (see the video) Obviously you have to raise the volume on your phone to the maximum level, even getting rid of all the warnings and alerts. When this is done, we have to write a small sketch that reads constantly the values in A0, and if it is higher than the threshold, it closes a relay. (img)

Step 3: The Relay

The relay will be connected to an output pin, just like in the basic blink sketch. The relay must be powered (+ and -) and must have a pin that triggers it. The wiring is therefore positive (5v, pick the right relay), negative and the signal pin, which in the Arduino sketch I arbitrarily called 'relay'.
The other variable is the threshold (called here 'audio'). This variable depends on your sound file and on your smartphone. Just note the value that is detected when the sound plays and insert this value as a threshold in the loop. The idea is that if a peek is detected, than the relay circuit has to close (video).

Step 4: The Doorphone

Now the part that is surprisingly easy: we have to connect the two wires coming out from the relay to the button of your doorphone.
My doorphone looks like this (img). We have to find the button that opens the door and that actually closes the circuit, connecting two wires. We attach the two wires that are coming out from the relay to this button. By doing this, we can still have the old button working, and the activation via mobile.

Step 5: Part II - the App

For this simple app I used MIT App Inventor. I really like the platform (I am not objective, being one of the Master Trainer), it's free, fast, and lets everyone make apps without programming.
This is what it looks like in pseudocode: Wait for a sms to arriveget the telephone number and sms textIf the telephone number is the right one, and the message contains the secret password, then play a beep at the maximum volume.Simple as that. What happens to the circuit you already know: as soon as the sound comes out through the fake headphones, it is evaluated by Arduino that closes the relay. The relay calls the doorphone button and the job is done. Check the video for the steps.

Step 6: A Little Hint

N.B. App Inventor can not work in background (if other tasks are in foreground, or if the smartphone goes in sleep mode, App Inventor stops working).
For this reason I used a little trick: Every few seconds the app sends an alert that keeps the phone awake. Another important thing: minimize the sound for ringtones and notifications and raise to the maximum the multimedia, otherwise, the door will open even with a phone call! This step is shown in the video.

Step 7: Test the App

Here it is a test drive of the app.
You can also see the Italian version here.

Home Improvement Contest 2017

Participated in the
Home Improvement Contest 2017