diff --git a/DIRECTIONS.md b/DIRECTIONS.md index 955dbc5..611bf9b 100644 --- a/DIRECTIONS.md +++ b/DIRECTIONS.md @@ -1,105 +1,121 @@ -# Mini NES Setup - -## Prerequisites - -1. Ensure Python 2.7 is working correctly and installed in `/usr/bin/python2.7` -2. `sudo apt-get install python-dev python-pip` -3. `sudo pip install python-daemon==2.2.4` (this is necessary to fix an issue with the latest release of python-daemon) - -## Enable i2c device -1. `sudo mkdir /etc/nfc` -2. `sudo raspi-config` -3. Select "5 Interfacing" -4. Select "P5 I2C" +# NES NFC Reader Setup + +Full Video & Photo guide will be posted at: +http://piwizardgaming.com/nfc + +For a premade image with all of the below steps already completed visit: +http://thepiwizard.com > Select Downloads > and locate the NFC Image Download + +## Step 1 - Prerequisites + +1. Download and flash a copy of RetroPie (https://retropie.org.uk/download/) to your SD card And setup your controller. +2. Open the RetroPie menu and then open Raspi-Config +3. Select option `3 Interface Options` +4. Select `P2 SSH` Then select `Yes` to Enable it. then exit out back to the main menu screen +5. Download Putty On your computer (https://www.putty.org/) +6. Once installed SSH Into your PI : `Hostname = retropie` Click Open and then `username = pi` `password = raspberry` *Note* It will not display the password as you type it. +7. Type `python --version` + - Ensure Python 2.7 is working correctly and installed in `/usr/bin/python2.7` +8. Type `sudo apt update` + - Press `y` when prompted +9. Type `sudo apt upgrade` + - Press `y` when prompted +10. Type `sudo apt install python-dev` + - Press `y` when prompted +11. Type `sudo apt install python-pip` +12. Type `pip --version` + - Ensure pip is installed and working (*pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)*) +13. Type `sudo pip install python-daemon==2.2.4` +14. Type `python -m pip install -U pip` +15. Type `pip install watchdog` +16. Type `sudo shutdown -r now` +17. Once your system reboots - Reconnect with SSH and continue to Step 2 + +## Step 2 - Enable i2c device +1. Type `sudo mkdir /etc/nfc` +2. Type `sudo raspi-config` +3. Select `3 Interfacing` +4. Select `P5 I2C` 5. Select "\" 6. Exit `raspi-config` program -7. `sudo shutdown -r now` to reboot with i2c enabled. +7. Type `sudo shutdown -r now` to reboot with i2c enabled. +8. Once your system reboots - Reconnect with SSH and continue to Step 3 -## Install libnfc +## Step 3 - Install libnfc 1. Ensure you are logged in as `pi` and in the `/home/pi` directory. -2. `wget -O libnfc-1.7.1.tar.bz2 https://bintray.com/nfc-tools/sources/download_file?file_path=libnfc-1.7.1.tar.bz2` -3. `tar -xvf libnfc-1.7.1.tar.bz2` -4. `cd libnfc-1.7.1` -5. `./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c` -6. `make` -7. `sudo make install` -8. After reboot, type `lsmod |grep i2c` and ensure that you see an `i2c_dev` in the list. -9. Also, type `ls /dev/i2c*` and ensure that `/dev/i2c-1` is returned. - -## Configure libnfc -1. `sudo nano /etc/nfc/libnfc.conf` -2. 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" -``` -3. Run `nfc-poll` and ensure you see `NFC reader: pn532_i2c:/dev/i2c-1 opened` -4. Try reading a tag, use Ctrl-C to stop or just wait 30 seconds - -## Install nfc_poll -1. Ensure you are logged in as `pi` and in the `/home/pi` directory. -2. `export NFC_HOME=/home/pi/libnfc-1.7.1` -3. `git clone https://github.com/coderkevin/mini-nes.git` -4. `cd mini-nes/nfc` -5. `make` -6. `sudo make install` -7. Run `systemctl status nfc_poll` and ensure you see "Active: active (running)" in the output - -## Configure your cartridges +2. Type `wget -O libnfc-1.7.1.tar.bz2 https://piwizardgaming.com/nfc/libnfc-1.7.1.tar.bz2` +3. Type `tar -xvf libnfc-1.7.1.tar.bz2` +4. Type `cd libnfc-1.7.1` +5. Type `./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c` +6. Type `make` +7. Type `sudo make install` +8. Type `sudo shutdown -r now` +9. After reboot, re-open putty and SSH back into the PI and type `lsmod | grep i2c` and ensure that you see an `i2c_dev` in the list. +10. Then type `ls /dev/i2c*` and ensure that `/dev/i2c-1` is returned. + +## Step 4 - Configure libnfc +1. Type`cd /etc/nfc` +2. Type`sudo wget http://piwizardgaming.com/nfc/libnfc.conf` +3. Type `nfc-poll` and ensure you see `NFC reader: pn532_i2c:/dev/i2c-1 opened`
+![alt text](http://www.piwizardgaming.com/nfc/nfc-poll.png)
+4. Try reading a tag, use Ctrl-C to stop or just wait 30 seconds
+![alt text](http://www.piwizardgaming.com/nfc/tag-read.png)
+ +## Step 5 - Install nfc_poll +1. Type `cd /home/pi` +2. Type `export NFC_HOME=/home/pi/libnfc-1.7.1` +3. Type `git clone https://github.com/thepiwizard/mini-nes.git` +4. Type `cd mini-nes/nfc` +5. Type `make` +6. Type `sudo make install` +7. Type `systemctl status nfc_poll` and ensure you see "Active: active (running)" in the output
+![alt text](http://www.piwizardgaming.com/nfc/status.png)
+ +## Step 6 - Configure your cartridges 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. -### Record your NFC tag UIDs -1. Run `tail -f /dev/shm/nfc_poll.log` -2. 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. +## Step 7 - Record your NFC tag UIDs +1. Type `tail -f /dev/shm/nfc_poll.log` +2. 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.
+![alt text](http://www.piwizardgaming.com/nfc/tag-uid.png)
3. Copy/paste the UID into a text file. 4. Continue with all tags you wish to use. -5. To exit the log, hit \-C - -### Record your desired games -1. `cd ~/RetroPie/roms` -2. Start typing `ls /` (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. -3. After you finally tab through to the complete file, hit . -4. 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. -5. Repeat this process +5. To exit the log, hit \-z + +## Step 8 - Game Download Demo - ### +1. `cd ~/RetroPie/roms/nes` +2. `wget http://piwizardgaming.com/nfc/zelda.zip` -### Write your cartridges in the config +## Step 9 - Write your cartridges in the config 1. `sudo nano /etc/nfc_poll/nfc_poll.conf` -2. At the bottom of the file, there's a `[Cartridges]` section. -3. For each cartridge you want, add a line in this format: ` = ` (e.g. `00000000000000 = nes/Super Mario Bros. (JU) [!].zip`) -4. `sudo systemctl restart nfc_poll` -5. 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. - -## Install nes_buttons -1. Ensure you are logged in as `pi` and in the `/home/pi` directory. -2. (If you haven't already) `git clone https://github.com/coderkevin/mini-nes.git` -3. `cd mini-nes/buttons` -4. `sudo make install` -5. Run `systemctl status nes_buttons` and ensure you see "Active: active (running)" in the output -6. 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. - -## Install screen_manager -1. Ensure you are logged in as `pi` and in the `/home/pi` directory. -2. (If you haven't already) `git clone https://github.com/coderkevin/mini-nes.git` -3. `cd mini-nes/screen` -4. `sudo make install` -5. Restart your Pi (try the reset button!) and if you've done all the steps above, everything should be working! +2. At the bottom of the file, there's a `[Cartridges]` section.
+![alt text](http://www.piwizardgaming.com/nfc/configure-cart.png)
+3. For each cartridge you want, add a line in this format:
+ ` = ` (e.g. `00000000000000 = nes/Super Mario Bros. (JU) [!].zip`)
+4. If you used the Zelda demo from above simply change the UID in the config file to match yours + +## Step 10 - Setup Autostart +1. `sudo nano /etc/rc.local` +2. Scroll down to `exit 0` and press enter twice then copy above the `exit 0` Line +``` +sudo systemctl start nfc_poll +sudo systemctl start nes_buttons +``` +It should look something like this:
+![alt text](http://www.piwizardgaming.com/nfc/rclocal.png) + +## Step 11 - Install screen_manager +1. Type `cd /home/pi/mini-nes/screen` +2. Type `sudo make install` + +## Step 12 - Install nes_buttons +1. Type `cd /home/pi/mini-nes/buttons` +2. Type `sudo make install`
+![alt text](http://www.piwizardgaming.com/nfc/button-install.png) +3. If you have everything wired correctly, your LED should turn on after installing. + +## Step 13 - Finish Up ## +1. Type `sudo shutdown -r now` +2. Once RetroPie Reboots - Try placing a cartridge on the reader diff --git a/Mini NES Wiring.png b/Mini NES Wiring.png deleted file mode 100644 index 28fd4aa..0000000 Binary files a/Mini NES Wiring.png and /dev/null differ diff --git a/Parts-List.md b/Parts-List.md new file mode 100644 index 0000000..159ffe5 --- /dev/null +++ b/Parts-List.md @@ -0,0 +1,18 @@ +# NFC Reader Parts List + +1. Raspberry Pi 3 B+ (B Plus) with Premium Clear Case and 2.5A Power Supply - Amazon $79.99 -
https://www.amazon.com/CanaKit-Raspberry-Premium-Clear-Supply/dp/B07BC7BMHY/
+![alt text](http://piwizardgaming.com/nfc/pi3b-plus.png)

+2. Optional Upgraded Power Supply 5V 3A - Amazon $9.89 -
https://www.amazon.com/gp/product/B01N336XEU/
+![alt text](http://piwizardgaming.com/nfc/upgraded-power.png)

+3. NFC Reader - Amazon $8.69 -
https://www.amazon.com/gp/product/B01I1J17LC/
+![alt text](http://piwizardgaming.com/nfc/nfc-reader-small.png)

+4. NFC Tags - Amazon $6.66(12qty) $10.99(30qty) -
https://www.amazon.com/gp/product/B08NPYD99G/
+![alt text](http://piwizardgaming.com/nfc/nfc-tag.png)
+5. Push Buttons for Power & Reset - Amazon $6.88 -
+You can remove the small metal pin inside the button to become both the Power & Reset Buttons
https://www.amazon.com/QMseller-Through-Self-Locking-Mounting-Switches/dp/B07W887PZV/
+![alt text](http://piwizardgaming.com/nfc/buttons-small.png)

+6. Latching Button for the Cartridge - Amazon $12.99 -
https://www.amazon.com/gp/product/B0169B5468/
+![alt text](http://piwizardgaming.com/nfc/latch.png)
+7. Wire Kit with resistors & LED's - Amazon $13.39 -
https://www.amazon.com/gp/product/B01HRR7EBG/
+![alt text](http://piwizardgaming.com/nfc/kit.png)
+### Work In Progress diff --git a/Wire-Diagram-Updated.png b/Wire-Diagram-Updated.png new file mode 100644 index 0000000..f890c25 Binary files /dev/null and b/Wire-Diagram-Updated.png differ diff --git a/buttons/Makefile b/buttons/Makefile index 5cd73cb..797da3a 100644 --- a/buttons/Makefile +++ b/buttons/Makefile @@ -8,7 +8,6 @@ INIT_DIR := /etc/init.d .PHONY: install install: - -pip install python-daemon install -m 0755 *.py -D -t $(VAR_WORK_DIR) install -m 0755 init/nes_buttons -D -t $(INIT_DIR) -systemctl enable nes_buttons diff --git a/nfc/Makefile b/nfc/Makefile index 2108924..7a1ea40 100644 --- a/nfc/Makefile +++ b/nfc/Makefile @@ -47,7 +47,6 @@ test: $(TEST) LD_LIBRARY_PATH=. ./$(TEST) -v install: lib - -pip install python-daemon -pip install psutil install -m 0755 *.so* -D -t $(INSTALL_PREFIX)/lib install -m 0755 *.py -D -t $(VAR_WORK_DIR) diff --git a/nfc/etc/nfc_poll.conf b/nfc/etc/nfc_poll.conf index 75a2ba1..a674dee 100644 --- a/nfc/etc/nfc_poll.conf +++ b/nfc/etc/nfc_poll.conf @@ -18,8 +18,6 @@ ui_period = 1 [Cartridges] # = - -04fc3bea794d80 = nes/Super Mario Bros. (JU) [!].zip -044d3cea794d81 = nes/Super Mario Bros 2 (U) (PRG 1).zip -042143ea794d81 = nes/Super Mario Bros 3 (U) (PRG 1).zip +d6422030 = nes/zelda.zip +#04fc3bea794d80 = nes/Super Mario Bros. (JU) [!].zip diff --git a/screen/Makefile b/screen/Makefile index 74a4ae8..02d2f98 100644 --- a/screen/Makefile +++ b/screen/Makefile @@ -7,7 +7,6 @@ VAR_WORK_DIR := /var/lib/screen_manager .PHONY: install install: - -pip install watchdog install -m 0755 *.py -D -t $(VAR_WORK_DIR) -sh ./update_autostart.sh