- Ensure Python 2.7 is working correctly and installed in
/usr/bin/python2.7
sudo apt-get install python-dev python-pip
sudo pip install python-daemon==2.2.4
(this is necessary to fix an issue with the latest release of python-daemon)
sudo mkdir /etc/nfc
sudo raspi-config
- Select "5 Interfacing"
- Select "P5 I2C"
- Select "<Yes>"
- Exit
raspi-config
program sudo shutdown -r now
to reboot with i2c enabled.
- Ensure you are logged in as
pi
and in the/home/pi
directory. wget -O libnfc-1.7.1.tar.bz2 https://bintray.com/nfc-tools/sources/download_file?file_path=libnfc-1.7.1.tar.bz2
tar -xvf libnfc-1.7.1.tar.bz2
cd libnfc-1.7.1
./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c
make
sudo make install
- After reboot, type
lsmod |grep i2c
and ensure that you see ani2c_dev
in the list. - Also, type
ls /dev/i2c*
and ensure that/dev/i2c-1
is returned.
sudo nano /etc/nfc/libnfc.conf
- Cut and paste the following and save the file.
# Allow device auto-detection (default: true)
# Note: if this auto-detection is disabled, user has to manually set a device
# configuration using file or environment variable
allow_autoscan = true
# Allow intrusive auto-detection (default: false)
# Warning: intrusive auto-detection can seriously disturb other devices
# This option is not recommended, so user should prefer to add manually his/her device.
allow_intrusive_scan = false
# Set log level (default: error)
# Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug)
# Note: if you compiled with --enable-debug option, the default log level is "debug"
log_level = 1
# Manually set default device (no default)
# To set a default device, users must set both name and connstring for their device
# Note: if autoscan is enabled, default device will be the first device available in device list.
device.name = "PN532"
device.connstring = "pn532_i2c:/dev/i2c-1"
- Run
nfc-poll
and ensure you seeNFC reader: pn532_i2c:/dev/i2c-1 opened
- Try reading a tag, use Ctrl-C to stop or just wait 30 seconds
- Ensure you are logged in as
pi
and in the/home/pi
directory. export NFC_HOME=/home/pi/libnfc-1.7.1
git clone https://github.com/coderkevin/mini-nes.git
cd mini-nes/nfc
make
sudo make install
- Run
systemctl status nfc_poll
and ensure you see "Active: active (running)" in the output
In this system, the cartridges don't need to be written to, we configure a mapping to their UIDs, which should already be uniquely pre-programmed to each tag.
- Run
tail -f /dev/shm/nfc_poll.log
- Place a cartridge (NFC tag) over the reader, the log should output "Reading NFC UID: 00000000000000" where the zeroes are the UID of the tag.
- Copy/paste the UID into a text file.
- Continue with all tags you wish to use.
- To exit the log, hit <Ctrl>-C
cd ~/RetroPie/roms
- Start typing
ls <system>/<name of game>
(e.g.ls nes/Super
) to find the rom you want. Hit tab to complete the file, or hit tab twice to show possible matches. Don't forget to backslash things like spaces and parenthesis as you go. - After you finally tab through to the complete file, hit .
- Copy the resulting line and put it and put it next to the UID you want to use in your text file. (
e.g. nes/Super Mario Bros. (JU) [!].zip
) Make sure you don't have backslashes here. - Repeat this process
sudo nano /etc/nfc_poll/nfc_poll.conf
- At the bottom of the file, there's a
[Cartridges]
section. - For each cartridge you want, add a line in this format:
<uid> = <game file>
(e.g.00000000000000 = nes/Super Mario Bros. (JU) [!].zip
) sudo systemctl restart nfc_poll
- Try it out! Place one of your cartridges on the reader and the screen should go black for a couple seconds, then bring up your game. Remove it and it should go back to the dashboard.
- Ensure you are logged in as
pi
and in the/home/pi
directory. - (If you haven't already)
git clone https://github.com/coderkevin/mini-nes.git
cd mini-nes/buttons
sudo make install
- Run
systemctl status nes_buttons
and ensure you see "Active: active (running)" in the output - From here, you should be able to depress the power button to release it, and the LED should stay lit until the shutdown completes, then turn off. At this point, your RPi CPU is completely off. Now press the power button to latch it, and the RPi should come back up. A reset will simply send a
shutdown -r now
instead and reboot the system.
- Ensure you are logged in as
pi
and in the/home/pi
directory. - (If you haven't already)
git clone https://github.com/coderkevin/mini-nes.git
cd mini-nes/screen
sudo make install
- Restart your Pi (try the reset button!) and if you've done all the steps above, everything should be working!