Skip to the content
2 layers34 × 46 mmNfcemu, the printed circuit board in 3D

NFC模拟器

Size
34 × 46 mm
Copper layers
2
Thickness
1.6 mm
Parts
58
Nets
64
Pads
201
Tracks, vias
390, 169
Pours
2
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
10 Jul 2022
Updated
26 Oct 2022

Overview

Nfcemu is an open-source printed circuit board by solosky, from the solosky/nfc-emu repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 34 × 46 mm with 58 parts on 64 nets, routed with 390 tracks and 169 vias.

It is built around the ATMEGA328P-AU, CH343P and SX1308, with the AO3401A among its other parts. Its parts include 22 resistors, 13 diodes, 9 capacitors, 4 ICs and 2 transistors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

4

README

README.md

nfc-emu

这是一个可以模拟NTAG215的模拟器。 可以用来模拟Amiibo和门禁卡。 硬件理论上支持Mifare的卡片,但目前固件不支持。

功能

  • 支持最多10张卡模拟
  • 支持模拟Amiibo
  • 4秒无响应自动断电

PCB

RevARevB
imageimage
可用和RevA相比新增了CH343P串口芯片,可以直接通过USB下载固件。注意:RevB未能完整测试,使用慎重!!

演示

固件编译和烧写

本固件是基于Ardunio框架实现的,所以固件烧写方法很类似。 主要分两步,第一步刷入bootloader, 第二步使用串口刷入固件。 bootloader只需要刷写一次即可,之后的固件更新可以直接用串口刷入新固件。

刷入Bootloader

需要的软件:progisp 需要的硬件:USB ISP

  • assets/optiboot_flash_atmega328p_UART0_115200_13560000L_B1.hex 刷入MCU中。
  • 修改熔丝位:低位值:0xCE, 高位值:0xDE,扩展位:0xFF image

连接左边标记为ISP的接口到USB ISP烧写器上,接线顺序如下:

CLK MOSI MISO RESET GND

注意需要把电池安装上,在刷入bootloader过程中需要一直按住中键打开电源。

刷入步骤:

  1. 先点击 编程熔丝 后面的框,弹出熔丝对话框,点击读出按钮读出当前值,然后依次输入 低位值:0xCE, 高位值:0xDE,扩展位:0xFF,点击写入执行写入操作
  2. 点击文件 -> 调入flash, 选择assets/optiboot_flash_atmega328p_UART0_115200_13560000L_B1.hex,点击自动按钮写入bootloader

编译固件

首先需要下载 vscode, 安装platformio插件,并安装arduino框架。

因为用了非标准的13.56M的晶振,需要新建一个board。 在 C:\Users{{用户名}}.platformio\platforms\atmelavr\boards下面新建一个文件 ATmega328PNfcEmu.json, 内容如下:

text
{
  "build": {
    "core": "MiniCore",
    "extra_flags": "-DARDUINO_AVR_ATmega328P",
    "f_cpu": "13560000L",
    "mcu": "atmega328p",
    "variant": "standard"
  },
  "bootloader": {
    "led_pin": "B5"
  },
  "debug": {
    "simavr_target": "atmega328p",
    "avr-stub": {
      "speed": 115200
    }
  },
  "frameworks": [
    "arduino"
  ],
  "name": "ATmega328P/PA NFC EMU",
  "upload": {
    "maximum_ram_size": 2048,
    "maximum_size": 32768,

使用vscode打开项目的fw文件夹,platformio插件会自动启动识别为一个platformio的项目。 点击编译按钮就可以完成编译。

刷入固件

刷入固件使用vscode的platformio插件完成。

RevA

需要额外一个带DTR信号的USB转串口的模块,连接右边的UART接口按如下顺序连接USB串口模块。

+5V TXD RXD DTR GND

注意:TXD连串口模块的RXD,RXD连串口模块的TXD。

RevB

自带了的USB转串口模块,直接插上USB线,系统自动识别出串口设备。

刷入步骤

刷入之前,修改platformio.ini中的 upload_port,monitor_port的值为设备的串口号。 点击上传按钮就可以下载固件到设备中。

支持的卡

硬件上支持14443-3A的低速卡,比如NTAG215, Mifare等常见卡。 软件层面目前只支持模拟NTAG215,Mifare卡暂时不支持。

功耗

目前使用中耗电量为22mA,CR2032勉强能使用,还需要进一步优化电路减少功耗。

因为设计了断电电路,不使用基本不耗电,使用时间取决于使用次数。

注意:一定要使用南孚的传应CR2032电池,其他电池不一定能提供这么大的放电电流!

写入TAG

可以用手机APP写入,也可以用PN532等NFC读写器写入。

使用手机APP写入

如果手机支持NFC,可以下载如下软件写入Amiibo:

iOS: AppleStore搜索Umiibo写入。 Umiibo是收费软件,但只需要6元RMB,没有应用内购买,很良心的APP的,强烈推荐购买。

Andriod: https://github.com/HiddenRamblings/TagMo/releases 下载最新版本的TAGMO安装。

如果以上都没有,可以购买PN532模块,然后安装Linux虚拟机,将PN532 USB设备接入虚拟机后,执行如下命令写入标签。

安装libnfc

text
sudo apt update
sudo apt install libnfc-dev

Amiibo写入

text
nfc-mfultralight w "SSB Zelda.bin" --full
NFC device: pn532 opened
1 ISO14443A passive target(s) found:
	040402cb5d6480
Using MIFARE Ultralight card with UID: 040402cb5d6480
WARNING: Tag is EV1 or NTAG - PASSWORD may be required
NTAG Type: NTAG215 (504 user bytes)
Checking if UL badge is DirectWrite...
 Original Block 0 (Pages 0-2): 0404028acb5d648072480000
 Original UID: 040402cb5d6480
 Attempt to write Block 0 (pages 0-2) ...
  Writing Page 0: 04 04 02 8a
  Writing Page 1: cb 5d 64 80
  Writing Page 2: 72 48 00 00
 Block 0 written successfully
Card is DirectWrite
Writing 135 pages |.......................................................................................................................................|
Done, 135 of 135 pages written (0 pages skipped, 0 pages failed).

默认固件所有标签都是空白的,需要用APP写入标签才能使用。

操作说明

  • 关机状态下短按中键开机,电源指示灯亮起
  • 开机状态下短按上,下键切换标签
  • 开机状态下长按中键2秒以上重置标签,uid也会随机生成,标签指示灯会短闪两次
  • 开机状态下靠近读卡器读取标签

可以使用重置标签操作结合APP来无限刷Amiibo!

注意:写入和重置标签会产生Flash的写入操作,一般来说Flash的写入操作是有次数限制的,按ATMEGA328p的手册来说,每扇区至少有10000次写入寿命,所以每个标签的至少能刷写10000次左右(重置和写入算两次操作),超过这个次数当前标签的数据可能永久无法写入。

后续可以考虑实现写均衡来充分利用剩余未使用的空间来提高标签的写入次数。

感谢

此项目是移植 Simple NFC,主要的模拟代码来源SimpleNFC,感谢 @Nonannet 提供的代码,非常棒的实现!

欢迎加群讨论

QQ群:109761876

Parts

58
QtyValueFootprintReferences
1020KResistor_SMD:R_0402_1005MetricR5, R7, R15, R16, R17, R18, R19, R20, R21, R22
8LED_SmallLED_SMD:LED_0402_1005MetricD6, D7, D8, D9, D10, D11, D12, D13
410KResistor_SMD:R_0402_1005MetricR3, R8, R10, R13
4D_SmallDiode_SMD:D_SOD-323D2, D3, D4, D5
30.1uFCapacitor_SMD:C_0402_1005MetricC1, C2, C3
3470Resistor_SMD:R_0402_1005MetricR1, R2, R4
210uFCapacitor_SMD:C_0603_1608MetricC8, C9
222pFCapacitor_SMD:C_0402_1005MetricC5, C7
10Resistor_SMD:R_0402_1005MetricR9
1100KResistor_SMD:R_0402_1005MetricR14
110nFCapacitor_SMD:C_0402_1005MetricC6
113.56MhzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
11KResistor_SMD:R_0402_1005MetricR11
11N5819Diode_SMD:D_SOD-323D1
12KResistor_SMD:R_0402_1005MetricR6
14.7uHInductor_SMD:L_0805_2012MetricL1
151pCapacitor_SMD:C_0402_1005MetricC4
1560KResistor_SMD:R_0402_1005MetricR12
1AO3401APackage_TO_SOT_SMD:SOT-23Q1
1ATmega328P-APackage_QFP:TQFP-32_7x7mm_P0.8mmU2
1Antenna_LoopMyLib:NFC_ANT2AE1
1Battery_CellBattery:BatteryHolder_Keystone_3002_1x2032BT1
1CH343PPackage_DFN_QFN:QFN-16-1EP_3x3mm_P0.5mm_EP1.45x1.45mmU1
1Conn_01x05Connector_PinHeader_1.27mm:PinHeader_1x05_P1.27mm_VerticalJ2
1LOGOMyLib:nfc_emuG***
1MSWMyLib:MSWU3
1Q_NPN_BECPackage_TO_SOT_SMD:SOT-23Q2
1SX1308Package_TO_SOT_SMD:TSOT-23-6U4
1USB_C_Receptacle_USB2.0Connector_USB:USB_C_Receptacle_HRO_TYPE-C-31-M-12J1

The 57 most common of 58 parts.

More from solosky/nfc-emu

1
  • 2 layers34 × 46 mmNfcemu, the printed circuit board in 3D

    Nfcemu

    solosky/nfc-emu

    NFC模拟器

    50 parts117Apache-2.0

Similar boards

  • 2 layers90 × 34 mmLoRa Node, the printed circuit board in 3D

    LoRa Node

    TilenTinta/Greenhouse_LoRa_Node

    An open-source monitoring system designed for use in greenhouses, orchards or other agricultural environments

    78 parts2MIT
  • 4 layers96.6 × 45.6 mmA133CoreDK LCDdeck, the printed circuit board in 3D

    A133CoreDK LCDdeck

    kitspace-test-repos/kicad6-file-collection

    53 partsMIT
  • 2 layers312.5 × 122.3 mmSHEGO75-V5, the printed circuit board in 3D

    SHEGO75-V5

    Charading/Shego75HE

    My endgame 75% hall effect keyboard

    392 parts75
  • 2 layers148.6 × 192.2 mmBadge, the printed circuit board in 3D

    Badge

    NuttyShell/NuttyBadge

    NuttyBadge: A NuttyShell crafted multi-tool. Opensourced Hardawre and Software

    169 parts31GPL-3.0
  • 6 layers100 × 120 mmAstra piNas, the printed circuit board in 3D

    Astra piNas

    jlcjak/astra_piNas

    Six-layer CM5 Lite dual-NVMe carrier with PCIe switch, Ethernet, microSD, USB-C PD and PoE. Review design; fabrication hold documented.

    176 parts30
  • 2 layers40 × 89.5 mmMono, the printed circuit board in 3D

    Mono

    jmcpheron/pico-quorum

    Several people, several keys, one Safe. Hardware approvals for Safe multisig wallets.

    89 partsMIT
  • 4 layers99 × 54 mmFrank next, the printed circuit board in 3D

    Frank next

    rh1tech/frank

    RP2350 Based Hardware Emulation Platform

    253 parts66GPL-3.0
  • 4 layers80.6 × 54 mmFrank next proto, the printed circuit board in 3D

    Frank next proto

    rh1tech/frank-lab

    FRANK Board Laboratory (work-in-progress board prototopyes)

    211 parts4GPL-3.0

Questions

How big is the Nfcemu PCB?

It measures 34 × 46 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Nfcemu use?

58 parts, built around the ATMEGA328P-AU, CH343P, SX1308 and AO3401A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Nfcemu KiCad files?

From the solosky/nfc-emu repository on GitHub, at the commit this page was made from: the board is hw/RevB/nfcemulator/nfcemu.kicad_pcb and its schematic hw/RevA/nfcemulator/nfcemu.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Nfcemu design in my own project?

Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).