Thursday, January 27, 2022

RetroPie with NFC Cards for my son

I've been playing video games since I was 3 or 4 during the late 80's starting with the Atari 2600 and NES. Easy to handle cartridges and consoles were a simple means to engage with video games that doesn't really exist anymore outside of the expensive retro collector's world. While you can just get a giant collection of ROMs today, dropping $40-60 for a single SNES game made buying and playing each title feel substantial. Reading the manual on the car-ride home and slotting the cartridge into the system was a fun ritual. I feel this physical action requires you to focus on what's in the system rather than jumping to another game in a giant list after a few minutes, and it makes the experience more accessible to engage with the system and games. To recreate this scenario for my own son when he's old enough (who just turned 2 at the time of this writing) I devised a system with off the shelf parts, a Retropie installation and a little Python scripting.






It’s made up of:

  • Raspberry Pi 3b (can play up to NeoGeo, GBA, and most PS1)
  • 5.25V - 3A power supply (needed extra juice for NFC reader and case IO board)
  • 64gb micro sd card with Retropie installed (not pre-loaded. All games were hand selected by me)
  • Waveshare Raspberry Pi PN532 NFC HAT (just slots onto the Pi’s GPIO pins. Additional info and drivers here: https://www.waveshare.com/wiki/PN532_NFC_HAT)
  • Retroflag NESPi Case+ (Had enough height to fit everything inside. Power and Reset buttons work, but Reset reboots the whole machine instead just of the game. Easier to just take the game out and put it back in. I did have to solder the Pi's power and ground to the case's switch terminal since the GPIO header plug was causing a drop in power. Also I know the Mk III or PCE would be more appropriate with cards but I don’t have a 3D printer)
  • transparent credit card holder for smartphones (just sticks onto the top of the case)
  • 2.4 Ghz NES style controllers (will eventually introduce SNES and 6btn Genesis. PCE and MK III games can use the NES pad)
  • generic PN532 NFC cards and label stickers (same as hotel key cards)

YMMV depending on Pi and case. The power and reset buttons work, but the reset reboot's the system and not the active game, so you'll just have to take the game out and re-insert it (or use a controller with the Retroarch hotkey enabled if you want to break the illusion). Also the GPIO header was too tall and the power was getting reduced (many low voltage warnings) so I ended soldering the Pi's 5v and ground connection near the micro-usb port directly to the case's switch terminal. This way the power and reset buttons still work, but the power going to the pi is more direct and eliminates the low voltage warnings.

I took the generic testing Python script that the NFC hat came with and modified it to load the games using some examples I found online. Using the Retropie's run command I load the script at boot instead of loading EmulationStation. You can still load up ES by attaching a keyboard and comboing Ctrl+C to escape to the terminal and typing "emulationstation". You can even use the Splashscreen setting to make a cool loading video on boot! I use the "fbi" image tool to load the "Insert Game Card" image and with a loop I wait for a card's UID that I've put in (the UID can be read from the script or on a smart phone). If the UID matches it loads the game and if the card is removed, it kills the process and waits for another card. To add a game I just add a new entry into the "games" dictionary variable {"UID":"core;rom",...} and it looks up the UID then loads Retroarch with the UID's associated core and rom.

I put the scripts folder into the \\retropie\configs\all\ directory so you can easily access it from windows over wifi and add games to it (or the json file) with NotePad++.

Here my Python script: copySave/nfc-retropie: Retropie script to load games with an NFC card reader (github.com)

Update: Made a video demo along with a CRT at 240p. Pretty much as close to the true retro experience that you can get with a RetroPie!





Overall this has worked out very well. I plan to introduce SNES and Genesis games and controllers as he gets older until I give him real consoles and a PC. Depending on the Pi you could possibly do up to PSP games. I've also been working a list of games that I feel are best to introduce and why. I may post each one here as a guide for games parents can introduce to their kids (which has been a time consuming process even for an experienced person like me). 

Obviously this won’t last forever, and I’ll eventually just have it boot to ES with all the games, but while he’s too young to really know about modern gaming stuff I figured I’d take advantage and play a bunch of great 8 and 16-bit games with him and do it in an orderly and progressive fashion (thinking a new game every 2 weeks for a few years).

I hope this helps out other DIY parents who love video games and want to share them with their kids.

No comments:

Post a Comment

Random Old Computer Memories

 My first computer experience (aside from the Atari 2600) was with a Macintosh Classic (https://en.wikipedia.org/wiki/Macintosh_Classic) in ...