查看: 1328|回复: 1

[项目] NFC|近场通讯模块|制作门禁

Never Forget Your Keys: NFC Door Reminder


2019-01-24 15.36.47.gif

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

GP2Y0A21 距离传感器
NFC Reader
NFC近场通讯模块 Arduino兼容
NFC Tags (order as many as you want to have to put on key rings)
NFC标签 圆形挂件(数量取决于你有多少钥匙需要它)
Micro USB Cable

高品质 micro USB数据线
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 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: 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.

将附件传到您的Leonardo开始。如果您不了解某些串行通信代码,请不要担心; 这个程序的唯一目的是与NFC近场通讯模块通信。实现“电子音”和读取距离值的部分非常简单。一旦从距离传感器读取的距离低于原先设置的指定阈值,蜂鸣器就会开始产生“电子音”,直到扫描NFC标签或你走出了设定的距离。扫描标签后,蜂鸣器就会乖乖“闭嘴”5秒钟。
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.
显然,它的作用当然不仅限于此。到目前位置,NFC近场通讯模块可以检测到已经被扫描过的任何一个标签 - 它不关心标签上的数据。所以可以创建不同的配置文件来收集关于每个拥有标签的人员进入和离开房间的时间/频率的数据分析。

Step 4: Mounting

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.


这个项目由Alex Wulff制作,一位非常有才华的电子工程师

DFrJWN_6mVE  学徒 来自手机

发表于 2019-2-3 09:55:05

KIKIYA 发表于 2019-1-24 16:21
Never Forget Your Keys: NFC Door ReminderNFC近场通讯模块:制作门禁
翻译中涉及某些专业用语,我尽力了 ...

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册


心愿单 编辑


上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2019 Comsenz Inc. Powered by Discuz! X3.4 Licensed