Never Forget Your Keys: NFC Door Reminder




Introduction: Never Forget Your Keys: NFC Door Reminder

Alex Wulff

I recently moved into my dorm room at Harvard--among the many changes I've encountered is having to remember my keys each and every time I leave the room. Rather than just try and remember the normal way I decided to have technology do the remembering for me!

This project is essentially an NFC reader that you stick on your door. Every time you approach the door the circuit makes noise; the only way to stop the noise is to scan an NFC tag affixed to your keys against the reader. Thus, the noise means you won't ever forget your keys again! Let's dive in.

Step 1: The Parts

Every component required for this project can be purchased from The links are below:

You're also going to need a few male-to-male jumper wires and female-to-male jumper wires to connect everything together. In addition, you should have your key ring handy.

The purpose of the distance sensor in this project is to determine when you start to approach the door. When a certain threshold is met the buzzer will start making noise until an NFC tag is scanned.

Step 2: Connecting the Components

No soldering is required, so connection time is minimal.

  • The IR sensor needs 5V power, so plug the red connection wire into the Leonardo's 5V pin. The black wire goes to GND, and the remaining data wire goes to A0.
  • The NFC reader's 3.3V pin should be plugged into 3V, and the GND pin into GND. The RX pin gets plugged into the Leonardo's TX pin and the TX pin into the RX pin on the Leonardo.
  • You can connect the red wire on the Gravity piezo buzzer to VIN, the black wire to GND, and the green wire to pin 10.

There should be just enough power pins available that a breadboard isn't required. Please note that if you power your Leonardo from a source other than USB the VIN pin may not output a clean 5V.

Step 3: Step 4: the Code

Upload the attached sketch to your Leonardo to begin. Don't worry if you don't understand some of the Serial communication code; the sole purpose of a lot of this program is communicating with the NFC reader. The portions that implement making noise and reading distance values are pretty simple. As soon as the distance reading from the IR sensor drops below a specific threshold the buzzer starts making noise until either an NFC tag is scanned or the distance threshold isn't met. Once a tag is scanned the buzzer won't make any noise for 5 seconds even if an object is within the threshold.

Obviously there's the capability for much more. Right now the NFC reader checks to see if any tag is scanned - it doesn't care about the data on the tag. Different profiles could be created to gather analytics on when/how often a specific person enters and leaves the room.

Step 4: Mounting

After some trial and error I developed what I think is the optimal mounting system. Place the distance sensor right next to the door. This minimizes the number of false positives of people just walking past it. The location of the NFC reader is a matter of personal preference: I placed it right at waist level so I can quickly scan my keys when I walk out of the door. Depending upon your outlet setup you might very well need an extension cord to provide power to the Leonardo.

Double-sided sticky tape is probably the best way to ensure that components stay where they should be.

Step 5: Going Further

As I mentioned previously, there's much more you can do with this system. Incorporating some kind of analytics system would be an interesting experiment. Additionally, you could try and replace the distance sensor with some kind of capacitive system that detects when the doorknob is touched and responds accordingly.

Lazy Life Challenge

Runner Up in the
Lazy Life Challenge



    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    14 Discussions

    What if you just want to open the door to let someone in or out?

    Probably you need a "bypass" pushbutton for that.

    2 replies

    That’s a pretty good idea - it would even be possible to implement this functionality with the current hardware. The software could detect if the user waves their hand in front of the sensor and have the system enter bypass mode

    I am currently working on a project now that might have a partial solution of sorts.

    Using the Arduino platform and ESP32 chip we scan BlueTooth(BT) for known BT devices to identify who is at a work table.

    Because we only scan no BT pairing is needed, you only need list them some way.

    There are a few examples of BT scanning on the HC-05 floating around the web which make BT integration to Arduino easy.

    Similar could be used to know visitor from resident, then you only need beep if its a resident and ignore visitors.

    Being one that has forgotten my Cell Phone at times, I did something similar but different. ( kind of hard to drive away with out the keys )

    I wrote an NFR app that sets off a load alarm if my keys and phone are separated more than a few feet.

    They haven't been separated in a few years now. it's working.

    Nice project and a good idea.

    Some possible improvements: Instead of an IR distance sensor you could use a magnetic door opening sensor like this one:

    That would minimize false alarms as it would only activate the system when you open the door.

    You could also combine it with the distance sensor. In case you open the door to let someone in, you don't want the alarm to go off. You can use the proximity sensor to check if someone is still in the room after the door closed. If this is the case, the alarm turns itself off. If not, the alarm continues (except if it was disarmed with the NFC tag).

    Happy building :-)

    1 reply

    Magnetic door sensor is smart. I have had one or two false alarms when I walked past the door which were slightly annoying.

    Good project, Have you had it installed for long?

    The reason I ask is whenever I've used buzzers (particularly with sensors) it isn't long before they drove me nuts and got decommissioned.

    However, as your aim is to stop you leaving the room and locking yourself out then maybe a servo actuated door bolt would be more useful? You'd have to do it in a manner that could be easily overridden in case of fire or hardware failure but a simple spring-loaded deadbolt would prevent you leaving without swiping. A downside is you'd also have to swipe to let someone in but I guess that's preferable to getting buzzed as you move near the door.

    1 reply

    This is actually a pretty good idea for an extension of the project. Being physically not allowed to leave without checking your keys would definitely ensure that they're never left behind. The buzzer does annoy me but I guess that's the point :)


    10 months ago

    I do not understand people always misplacing or losing their keys. I have carried keys since I was 12 years old, that's 38 years now. If you are not using your key(s) they go back into your pocket. Simple.

    2 replies

    good solution, if you never change pants :)

    The nature of this project is less about losing your keys and more about leaving them behind when you leave a room. My door locks automatically, so if I leave my room without my keys I have a problem :)

    I'll never have to whistle for my keys again! Voted.

    1 reply

    I can tell you firsthand that it does work :) thanks for your vote