Since batocera 43, you can use a nfc reader and cards to start/stop your games or execute any custom action (like shutting down batocera).
Required hardware
A nfc reader
It is recommanded to use a pn532 reader while it is recognized by both software you can use in batocera. It costs about 10€.
The integrated batocera nfc service supports only pn532 readers.
The Zaparoo nfc service supports more hardware (see https://zaparoo.org/docs/readers/)
Nfc tags
Available softwares
batocera.linux offers 2 software solutions to make a nfc reader to work.
- the integrated batocera nfc service
- Zaparoo nfc service
The integrated batocera nfc service and Zaparoo nfc service both offers:
- write a nfc tag containing the path of a game from the game menu
- start a game when you connect a game tag to the nfc reader
- stop a game when you disconnect a game tag from the nfc reader
- call custom scripts when a tag is connected or disconnected.
The integrated batocera nfc service:
- is already inside batocera.linux. Nothing to install.
- is available for any batocera supported boards
The Zaparoo nfc service:
- is present in the batocera content downloader.
- should be available for most batocera supported boards (packages are built by the zaparoo team)
- supports more nfc readers hardware
- can connect to your phone to read qr code instead of nfc tags
- allows you to produce scenario and different interactions with other hardware
The integrated nfc service
Installation
Plug the nfc reader to batocera
Start the nfc service
From emulationstation, go in the system menu, find the services entry, and enable the simple nfc service.
Note that the nfc reader must be connected to batocera first. If when starting, the simple nfc service detects no hardware, it stops.
The simple nfc service is not enabled by default in batocera, cause the hardware used for nfc readers (uart converter) is generic, and cannot be distinguished from some other hardware.
Write the name of a card on a nfc tag
From emulationstation, choose a game, and press a long time on it to display its menu. Choose “Write an nfc tag for this game”.
If the entry is not present, it means that the nfc reader was not detected.
Put the nfc tag on the reader to write it.
Usage
Default behavior :
- while navigating in the emulationstation menu, connect a tag to your nfc reader : the game starts
- while playing a game : disconnect the tag from the nfc reader : the game stops
Customized scripts
By default, when you connect a tag, the nfc service will execute all the script present in the following system directory :
- /usr/share/batocera/scripts/on-nfc-connect
If you create the following directory, the system default scripts will not be executed, instead, the one of the custom directory will be executed.
- /userdata/system/configs/emulationstation/scripts/on-nfc-connect
The same behavior occurs for disconnect with the following directories :
- /usr/share/batocera/scripts/on-nfc-disconnect
- /userdata/system/configs/emulationstation/scripts/on-nfc-disconnect
Extra file : When a nfc service detects a nfc reader and listen to it, it create the following file :
- /var/run/batocera-nfc.running
When the hardware is removed, this file is removed. Thanks to this, emulationstation takes the decision to show or not the write entry in the menu. You could use this file to know whether a nfc reader is listening tags or not.
The Zaparoo nfc service
Installation
Details given in the following video : https://www.youtube.com/watch?v=XpH27Yswe38
- hardware/nfc.txt
- Last modified: 5 weeks ago
- by nadenislamarre






