Introduction: Never Forget Your Keys: NFC Door Reminder
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 DFRobot.com. The links are below:
- Arduino Leonardo
- Sharp IR Analog Distance Sensor
- NFC Reader
- NFC Tags (order as many as you want to have to put on key rings)
- Micro USB Cable
- Piezo Buzzer
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.