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
50
Nets
46
Pads
153
Tracks, vias
288, 146
Pours
4
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 50 parts on 46 nets, routed with 288 tracks and 146 vias.

It is built around the ATMEGA328P-AU, SX1308 and AO3401A. Its parts include 19 resistors, 12 diodes, 8 capacitors, 3 ICs and 2 transistors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

3

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

50
QtyValueFootprintReferences
1020KResistor_SMD:R_0402_1005MetricR2, R4, R12, R13, R14, R15, R16, R17, R18, R19
8LED_SmallLED_SMD:LED_0402_1005MetricD5, D6, D7, D8, D9, D10, D11, D12
410KResistor_SMD:R_0402_1005MetricR5, R6, R7, R10
4D_SmallDiode_SMD:D_SOD-323D1, D2, D3, D4
20.1uFCapacitor_SMD:C_0402_1005MetricC1, C6
210uFCapacitor_SMD:C_0603_1608MetricC7, C8
222pFCapacitor_SMD:C_0402_1005MetricC3, C5
2Conn_01x05Connector_PinHeader_1.27mm:PinHeader_1x05_P1.27mm_VerticalJ1, J2
1100KResistor_SMD:R_0402_1005MetricR11
110nFCapacitor_SMD:C_0402_1005MetricC4
113.56MhzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
11KResistor_SMD:R_0402_1005MetricR8
12KResistor_SMD:R_0402_1005MetricR3
130pCapacitor_SMD:C_0402_1005MetricC2
14.7uHInductor_SMD:L_0805_2012MetricL1
1470Resistor_SMD:R_0402_1005MetricR1
1732KResistor_SMD:R_0402_1005MetricR9
1AO3401APackage_TO_SOT_SMD:SOT-23Q1
1ATmega328P-APackage_QFP:TQFP-32_7x7mm_P0.8mmU1
1Antenna_LoopMyLib:NFC_ANT2AE1
1Battery_CellBattery:BatteryHolder_Keystone_3002_1x2032BT1
1MSWMyLib:MSWU2
1Q_NPN_BECPackage_TO_SOT_SMD:SOT-23Q2
1SX1308Package_TO_SOT_SMD:TSOT-23-6U3

More from solosky/nfc-emu

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

    Nfcemu

    solosky/nfc-emu

    NFC模拟器

    58 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 layers89.3 × 52.1 mmDivergence Meter Project v2, the printed circuit board in 3D

    Divergence Meter Project v2

    waicool20/Divergence-Meter-Project-v2

    This is the second iteration of the Divergence Meter Project and another personal learning project, this time learning how to integrate Li-Ion batteries into a project, new electrical converter topologies, Rust…

    149 parts28
  • 2 layers134 × 80 mmS3t, the printed circuit board in 3D

    S3t

    11tools/s3thermal

    a iray thermal camera controller pcb use Allwinner S3

    65 parts7
  • 2 layers75 × 75 mmPcb flip2 1layer, the printed circuit board in 3D

    Pcb flip2 1layer

    schwarzschildkugelblitz/The_Hive

    Application of Motion tracking and real time data transfer

    36 parts6
  • 2 layers100 × 61 mmWgr, the printed circuit board in 3D

    Wgr

    a5632645/final_design

    simple digital waveguide synthesizer & simple mpe midi keyboard(pitch bend and pressure)

    103 parts4
  • 2 layers98.3 × 98.3 mmDrone swarm, the printed circuit board in 3D

    Drone swarm

    ManhTi3012/MiniDrone

    A mini drone based on ESP32

    83 parts4MIT
  • 2 layers36.8 × 66 mmInterface, the printed circuit board in 3D

    Interface

    11tools/thermal_interface

    a thermal camera interface pcb project

    35 parts1

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?

50 parts, built around the ATMEGA328P-AU, 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/RevA/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).