如何使用树莓派和ACR122U读取NFC标签数据

发布于 2025-01-11 20:33:52 字数 802 浏览 4 评论 0原文

我正在开发一个 python 项目,该项目需要从 NFC 标签(特别是 URL)读取数据。

我购买了 USB NFC 读卡器,并且正在使用 libnfc 库。我的树莓派可以正确识别阅读器和标签,并且它可以使用 nfc-poll 正确识别标签何时存在。但是,它只提供有关标签 ID、ATQA 和 SAK 的信息(我不确定最后两个是什么)。它本身没有给我数据/网址。

任何在读取标签数据方面的帮助,无论是使用 libnfc 还是其他方式,我们将不胜感激。我在 Python 方面经验丰富,但以前从未做过类似的项目,因此尽可能简单将不胜感激。

我的 python 代码非常简单:

from subprocess import call

while True:
   try:
      call('nfc-poll')
   except:
      print('Error')
      break

呈现标签时的输出如下所示:

ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_REF): 00 44
       UID (NFC1D1): 04 7b a7 2c d0 6c 80
      SAK (SEL_RES): 00

I'm working on a python project that requires reading data from NFC tags- specifically URLs.

I purchased a USB NFC reader and am using the libnfc library. I have my raspberry pi recognizing the reader and tags properly, and it correctly identifies when a tag is present using nfc-poll. However, it only gives me information on the tag's ID, ATQA, and SAK (I'm not sure what the last two are). It doesn't give me the data/url itself.

Any help would be appreciated in reading the tag data, either with libnfc or something else. I'm experienced in Python but have never done a project anything like this before so as simple as possible would be appreciated.

My python code is pretty simple:

from subprocess import call

while True:
   try:
      call('nfc-poll')
   except:
      print('Error')
      break

And the output when a tag is presented looks like this:

ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_REF): 00 44
       UID (NFC1D1): 04 7b a7 2c d0 6c 80
      SAK (SEL_RES): 00

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文