Retropie N64 With Working Cartridges

by ryanjslingerland in Circuits > Raspberry Pi

187 Views, 2 Favorites, 0 Comments

Retropie N64 With Working Cartridges

RetroPi Screenshot 1.JPG
retropie-2016.png

For this project, I created a functional retropie n64 emulator in an n64 style 3d printed case. This emulator takes a more retro approach by implementing working cartridges. It works by using two buttons placed inside the cartridge slot and three unique cartridges (each one made to press a different button or sequence of buttons). Each unique cartridge will load and launch a unique game.

Supplies

Here is the list of the supplies you will need.

  • Raspberry pi
  • sd card (32gbs or more)
  • usb (8gbs)
  • 4 male to female gpio wires
  • 2 large buttons
  • usb controller
  • 3d printer

Setup Raspberry Pi

Flashing retropie to the sd card

  • First download the retropie software from retropies website that matches your pi model
  • using a sd card flashing software such as balenaEtcher, flash the sd card with the retropie os
  • connect the raspberry pi to a monitor and using your keyboard, run through the setup instructions.


Installing Roms

  • To start, insert the usb into the raspberry pi and wait a few seconds
  • next, remove the usb and plug it into your pc.
  • visit any legal roms download site and install games that match your interest.
  • drop the downloaded roms onto the usb in the folders that match the games console

For example, a game from snes would be placed in /RetroPie/roms/snes

Creating a Case

RetroPi Screenshot 3.JPG
RetroPi Screenshot 4.JPG
RetroPi Screenshot 5.JPG
RetroPi Screenshot 6.JPG
RetroPi Screenshot 1.JPG

This step is very personalized.

  • choose a modelling program of your choice and create a case for your retropie

In my case, I used fusion 360 to create a case that would perfectly fit my pi and somewhat resembles an n64.

  • make sure the raspberry pi's ports are assessable so that they can be used with the usb controller
  • also keep in mind where the power cord is going to be.

If you wanted to create working cartridges, make sure to make a slot for that with room for two buttons two sit on each end inside the slot.

Additionally for two buttons, you should create three cartridges. Each one should have unique tabs so that one of them has tabs that align and press one button, one cartridges presses the other and the last cartridge presses both buttons. This way we can launch three different games with three different cartridges.

Programming

j8header-3b-plus.png

For this step you will need to have access to the retropie with a keyboard.

  • to access the terminal on the pi, press f4 while in retropie
  • first test that you can swap games using the terminal by entering this
/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ "game console" "/path/to/ROM"

make sure to replace the game console and rom path to match the game you want to lanch

  • quit the game by pressing f4
  • once in the terminal create a new file called buttons.py
sudo touch buttons.py


  • open the file using nano
sudo nano buttons.py


  • create new code to work with the buttons you have set up
import RPi.GPIO as GPIO
import time
import os


# GPIO pins for the buttons
button_pin_1 = 17
button_pin_2 = 18


# Setup GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(button_pin_1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(button_pin_2, GPIO.IN, pull_up_down=GPIO.PUD_UP)


try:
    while True:
        # Check if button 1 is pressed
        if GPIO.input(button_pin_1) == GPIO.LOW:
            os.system("/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ 'game console' '/path/to/ROM1'")
            print("Button 1 pressed")


        # Check if button 2 is pressed
        if GPIO.input(button_pin_2) == GPIO.LOW:
            os.system("/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ 'game console' '/path/to/ROM2'")
            print("Button 2 pressed")


        # Check if both buttons are pressed simultaneously
        if GPIO.input(button_pin_1) == GPIO.LOW and GPIO.input(button_pin_2) == GPIO.LOW:
            os.system("/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ 'game console' '/path/to/ROM3'")
            print("Both buttons pressed")


        time.sleep(0.1)  # debounce delay


except KeyboardInterrupt:
    GPIO.cleanup()


  • next, save this by pressing ctrl x and enter twice
  • then using bash, have the program run on the retropies startup


Wiring

  • lastly connect your button wires to gpio pin 17 and 18 and then the other two to a ground pin
  • place the buttons inside the cartridge slot on each side

Your Done!

Have fun epic gaming.