Introduction: RetroPie - Overclocked Raspberry Pi 3 for Video Game Emulation

Picture of RetroPie - Overclocked Raspberry Pi 3 for Video Game Emulation

Enjoy a blast to the past with retro video games! N64, Super Nintendo, NES, PS1, the gaming classics are still lots of fun.

This Instructable provides detailed directions for every step to make a fully optimized RetroPie meant capable of playing N64 games smoothly, and older systems (SNES, NES) flawlessly.

Cost is marginal, generally $90-120, but the ability to pull out a computer the size of a deck of playing cards for a world of fun is well worth the cost.

Enjoy, have fun, let me know if this Instructable helped you or you have any constructive comments -- it is always exciting to see what creative people are up to!

Step 1: RetroPi Emulation - Parts

Picture of RetroPi Emulation - Parts

Below are the parts you'll need to pull off a premium N64 Emulation System

  • Raspberry Pi 3 Model B, and 2.5A 5v PSU
  • MicroSD Card, Class 10 Minimum
    • Samsung 64GB U3 (effectively "Class" 30)
    • $22 - https://www.amazon.com/gp/product/B06XX29S9Q (May need to click "Other Sellers" for a lower price NEW)
    • I recommend a minimum of 16GB, 32GB is the sweet spot for not having to worry about enough space. If you are planning at add countless MAME ROMs or PS1 games, you'll want as big a MicroSD card you can get.
  • Official Microsoft Xbox 360 Wireless Receiver
    • Get the official Microsoft OEM version. There are third-party receivers that *can* work fine, but I've had bad experiences in the past. The official Microsoft labeled device works the best.
    • $20 - https://www.amazon.com/dp/B000HZFCT2/
  • Official Microsoft Xbox 360 Wireless Controllers
  • Computer Keyboard
    • Any keyboard will work, for running more intense menu commands
  • Case with Fan
    • If you are planning on playing N64 games, I highly recommend purchasing a vented Raspberry Pi case with fans so you can overclock the system, which is absolutely necessary for smooth N64 emulation. Below is what I use.
    • $10 - https://www.amazon.com/dp/B01LXSMY1N/

Step 2: Installing Operating System

Picture of Installing Operating System

You'll need a way to format the MicroSD card. This is usually done with the included SD Card (full size) adapter, and plugging it into a laptop/desktop/memory-card adapter.

Go download and install Win32DiskImager from Sourceforge. This lets you write a downloaded .IMG file directly to the MicroSD card.

  • https://sourceforge.net/projects/win32diskimager/

Download RetroPie v4.X

  • The OS is about 600MB. They seem to choose random mirrors for downloads, some go at 30KBps, others at 20MBps, if it's slow, cancel and re-download.
  • https://retropie.org.uk/download/

The image file will be a .img.gz (GZIP) file. Extract the .IMG file inside with 7Zip or WinRar to somewhere on your local PC.

Run Win32DiskImager from Start as Administrator (right-click > Run as Administrator) Select the MicroSD card drive letter, browse to your extracted .IMG, and write. -- This will completely erase the selected device (which should be the MicroSD card). Make sure it's the right one. Wait until the write is complete.

Once complete, remove the MicroSD card, and connect it to the Raspberry Pi memory slot. Connect everything together:

  • MicroSD
  • HDMI <> TV
  • Ethernet Cable <> Switch
  • 360 Wireless Receiver
  • Power MicroUSB

Plug in the power and the system will automatically start.

Step 3: Basic Configuration and Updating Operating System

Picture of Basic Configuration and Updating Operating System

Let the Raspberry Pi boot up and wait until you get to the main interface. You will need a controller input

We need to define the base controller button definitions via Emulation Station.

First Boot - Linking an Input

Now that the system is powered up, link your Xbox 360 Controller, to the Xbox 360 Wireless Receiver. Hold the button on the top edge of the 360 Controller until the circular light begins spinning. Then press the sync button on the receiver. The controller should have all four lights blink together -- the controller is now linked.

You can hold any button on the 360 controller to start the "Configure Input" screen. Alternatively, you can connect a keyboard and browse to:

Start > Configure Input > Are you sure? > Yes


After mapping the buttons per the references below (see photo), we can now make any changes per-system as needed.

Reference 1: https://github.com/RetroPie/RetroPie-Setup/wiki/C...

Reference 2: https://github.com/RetroPie/RetroPie-Setup/wiki/r...

Note -- You are intentionally Mis-Mapping the Xbox 360 Controller Buttons -- this is intended.

For example, the Green button on a 360 controller (A), is being mapped to B for EmulationStation's RetroArch default config. This is correct, it will make your life easier. From there -- the buttons will be remapped again by each core (NES, SNES, Genesis) to match the "feel" of that controller -- automatically.

As an example, on a NES Controller, the B button is to the left of the A button. The "feel" should be the same -- A (360 Button) > B (RetroArch Default Input) > Auto-Remapped to A (NES Controller).

It's an odd system, but it can work really well as long as you follow the mapping below. Some emulators (looking at you N64 non-RetroArch cores Gles2N64 and Mupen64Plus) may require controller customization, as their mappings cannot load the built in RetroArch input file. (The default RetroArch input file is stored at "/opt/retropie/configs/all/retroarch-joypads/Xbox 360 Wireless Receiver.cfg"

Updating OS Packages

Updating the RetroPie OS and packages can provide a 50%+ performance improvement in some cases. Absolutely do this step.

  1. Open RetroPie
  2. RetroPie Setup > Update RetroPie-Setup Script > Yes
  3. Update all installed packages > Yes > Would you like to update the underlying OS packages? > Yes
  4. Wait 25 minutes (I timed it)That was easy enough...

Step 4: Adding ROMs / Games

Picture of Adding ROMs / Games

If you've got the ROMs, it's easy. Just remove them from their ZIP files, and copy them to a network share. If you don't yet have ROMs, go find a torrent site and get your game on! Generally releases are call "ROM Collections" or "ROM Packs", so for example go on Google and search for, "N64 ROM collection torrent".

Hop on your PC, and browse your local network. If you can't find anything and you're on Windows, Start > Advanced Sharing > Enable Network Discovery You can also find your IP on RetroPie by going RetroPie > Show IP Then browsing to \\192.168.0.X\ or \\retropie

Go into the roms folder, and start copy/pasting in ROMs for each system. They will need to be unzipped, so a NES game would be something like: Super Mario Bros.NES, a N64 title would be Super Mario 64.z64, and a PSX game would be either a Crash Bandicoot.BIN/Crash Bandicoot.CUE combo, or a combined Crash Bandicoot.PBP file.

If you have systems available in the list you do not want -- remove the content of any game files inside (e.g. ScrummVM)

Step 5: Configuring System

Picture of Configuring System

Raspberry Pi Config

We are going to configure some core OS settings that are related to Raspberry Pi Operating System, rather than the RetroPie FrontEnd Interface. You will likely need a keyboard for this to work, controller buttons can go weird in Raspi-Config.

From the menus, open RetroPie > Raspi-Config

You can also open this by using Putty, SSHing in, and typing "raspi-config".

  1. This step should not be necessary as of RetroPie v4, but if you find yourself running out of space much earlier than expected:
    1. Expand FileSystem", this takes the 600MB image you flashed to the MicroSD, and lets you have all of the free space of your 64/128GB MicroSD card.
  2. Boot Options > Wait for Network at Boot > Would you like boot to wait? > NO
    1. This makes the Raspberry Pi boot MUCH faster if a network connection is not available. Otherwise you will sit for 30s while the Raspberry looks for a DHCP server and times out.
  3. Advanced Options > Overscan > Would you like to enable compensation for displays with overscan?
    1. Select No if you have a modern, 1080p or higher HDTV, or are on HDMI.
    2. Select Yes if you have an older TV that zooms in on devices so there are no black bars (but it cuts off detail with HDMI/DVI).

Disable Run Command Editor

Whenever you load a ROM, you have 5 seconds to press any button to load the Run Command Editor. That means if any person presses anything during those 5 seconds, time to pull out a keyboard or reboot the system to try again while everyone gets confused. I highly recommend turning this off once your system is dialed in, so if guests or children are playing on the system they can enjoy a better experience.


You will want to leave it enabled to select a per-game Emulator Core setting. For example, StarFox64 runs best under GlideN64. If GlideN64 is not your default, the Run Command Editor lets you select that specific game's default emulator core, which the setting will keep even after you (later) disable Run Command Editor.

  1. Launch Menu > Disabled
  2. Launch Menu Art > Disabled
  3. launch Menu Joystick Control > Enabled
  4. Select Cancel (should really be named Quit or Exit) > A (or Yes)

Upgrade Theme / Interface

I personally prefer Tronkyfran (#32 at the bottom of the list), pick whatever you prefer :-)

RetroPie Setup > Configuration / Tools > esthemes (Emulation Station User Interface themes) > 32 - Install Tronkyfran

Go back to home > Start > UI Settings > Theme Set (at the bottom) > Change from Carbon (default) to Tronkyfran (or whatever you use). Some themes may require a reboot to go into effect.

Scrape for Details

A scraper scans all of the games in your system for metadata like year of release, rating, description, title, cover-arts, etc. Very worth the time to run it, makes the system look MUCH prettier. For running an scrape of 2500 games, it took 3 hours to complete.

Do this after copying over your ROM files.

  1. Plug in a keyboard, hit F4 to close Emulation Station - if it is open, the scraping cannot succeed.
  2. sudo -i
  3. sh /home/pi/RetroPie-Setup/retropie_setup.sh
  4. Configuration Tools > Scraper > Scan All Systems

Change Default N64 Emulator

This file lets you select the default emulator. You have the option to assign different emulators to different ROM files with the Run Command before a system launches.

I have personally had better stability and performance with Gles2N64 than GlideN64. Officially, GlideN64 is supposed to be the best current graphical plugin and may one day be the best (isn't everything linux like that though ;-).

At the time of writing this (June 2017) glitchy graphics, stuttering audio, and random buggyness with GlideN64 says otherwise, so I recommend Gles2N64.

Connect via Putty

  1. sudo -i
  2. nano /opt/retropie/configs/n64/emulators.cfg
  3. Change the following line
  4. (Before) default = "mupen64plus-GLideN64"
  5. (After) default = "mupen64plus-gles2n64"
  6. Ctrl + X (Exit) > Y (Yes to save changes)

Step 6: Performance Improvements

Picture of Performance Improvements

f you want to play N64 or PS1 and have a good experience, you will want to get a case with a fan, and overclock your Raspberry Pi 3. If you are not emulating PS1 or N64, do not worry about overclocking.

This is surprisingly important. I normally don't overclock any equipment, ever, but overclocking really does make a massive improvement on your RetroPi setup, it's the difference between some N64 games working great or being completely unplayable -- if you want to play Goldeneye or Super Smash Bros and have a good time, you'll need this step.

These settings are for a Raspberry Pi 3 in a case with minor ventilation, and the cheapo 14mm x 14mm x 4mm heatsinks on top that come with cheap kits (they only drop temps by 5-8C). A fan however will make a HUGE impact, heatsinks for the Raspberry Pi make a minimal impact once under load. Temperature can be verified by SSH'ing in with Putty, and running the below command.

Temperature can be verified by SSH'ing in with Putty, and running the below command:

#Check temperature. Hit Up-Arrow > Enter to keep checking.
vcgencmd measure_temp

The most important setting oddly enough, is the v3d_frequency. This seems to provide more performance improvements than anything else I've found. disable_splash=1 just speeds up the boot process.

  1. sudo -i
  2. nano /boot/config.txt
  3. Use Ctrl+K to delete the matching lines, Right-Click to "Paste" in the content.
  4. Ctrl+X to Quit > Y (Yes) to Save)

arm_freq=1350

gpu_freq=525

core_freq=525

sdram_freq=500

over_voltage=6

v3d_freq=525

force_turbo=1

avoid_pwm_pll=1

disable_splash=1

Resolution

This can be a tricky category. Different games run better, and look better, at different resolutions. The higher the resolution, the greater the process/performance demands on the RaspberryPi. In general, I've found it best to have the default video mode for any emulator to be 640x480 (CEA1). For example, even the emulator GLes2N64-HighRes, will look more "HD" running at CEA-1 (640x480) than say, CEA-4(1280x720) and run smoother on Jet Force Gemini. For GLes2N64, CEA-1 though a 4:3 resolution is scaled properly to fit a 1080p 16:9 display -- it looks really good on many games!

Step 7: Configuring Controllers (Optional)

Picture of Configuring Controllers (Optional)

Only needed if your buttons are not matching up between systems, especially on N64.

There are three ways controller configurations are saved in a RetroPie.

  1. From the initial setup configuration file
    1. nano "/opt/retropie/configs/all/retroarch/autoconfig/Xbox 360 Wireless Receiver.cfg"
  2. From the "live" setup configuration file, what you can change via EmulationStation
    1. nano "/opt/retropie/configs/all/retroarch-joypads/Xbox 360 Wireless Receiver.cfg"
  3. From a system-specific configuration file (N64)
    1. nano /opt/retropie/configs/n64/InputAutoCfg.ini

Here are two mapping images that may be helpful. The stock-mapping works perfectly for NES, SNES, Game Boy, (which all use the RetroArch Input File you created through Emulation Station, but goes absolutely bonkers with non-RetroArch cores).

These input mappings were figured out via the RetroCore GUI Configuration Tool (While in a RetroArch game, press Select + X).

Example Code of a default"/opt/retropie/configs/n64/InputAutoCfg.ini" N64 setup (Wrong).

; Xbox 360 Wireless Receiver_START
[Xbox 360 Wireless Receiver]

plugged = True

plugin = 2

mouse = False

AnalogDeadzone = 4096,4096

AnalogPeak = 32768,32768

Mempak switch = button(11)

Rumblepak switch = button(12)

C Button D = button(0) axis(3+)

C Button L = axis(2-)

Z Trig = button(4)

Start = button(9)

Y Axis = axis(1-,1+)

DPad U = button(15)

C Button U = button(1) axis(3-)

A Button = button(2)

DPad D = button(16)

X Axis = axis(0-,0+)

R Trig = button(5)

DPad R = button(14)

B Button = button(3)

DPad L = button(13)

C Button R = axis(2+)

L Trig = button(6)

; Xbox 360 Wireless Receiver_END

Issues are:

  1. Button (0) [The A button on a 360 controller)], is auto-mapped to C-Button Down AND Right-Stick Down.
  2. Button (1) [The B button on a 360 controller], is auto-mapped to C-Button up AND Right-Stick Up.
  3. Button (2) [The X button on a 360 controller], is auto-mapped to A.
  4. Button (3) [The Y button on a 360 controller], is auto-mapped to B.

If you are using a 360 Wireless controller, feel free to use the below mappings. Edit your config file with a command such as:

"nano /opt/retropie/configs/n64/InputAutoCfg.ini"

Use Ctrl+K to delete by line rather than holding down backspace, a bit faster.

Right-Click in Putty to paste in the code box below:

; Xbox 360 Wireless Receiver_START

[Xbox 360 Wireless Receiver]

plugged = True

plugin = 2

mouse = False

AnalogDeadzone = 4096,4096

AnalogPeak = 32768,32768

Mempak switch = button(11)

Rumblepak switch = button(12)

C Button D = axis(3+)

C Button L = axis(2-)

Z Trig = button(4)

Start = button(9)

Y Axis = axis(1-,1+)

DPad U = button(15)

C Button U = axis(3-)

A Button = button(0)

DPad D = button(16)

X Axis = axis(0-,0+)

R Trig = button(5)

DPad R = button(14)

B Button = button(2)

DPad L = button(13)

C Button R = axis(2+)

L Trig = button(6)

; Xbox 360 Wireless Receiver_END

Step 8: Interface Controls - ROM Compatibility for N64

Picture of Interface Controls - ROM Compatibility for N64

Controls

Within RetroPie as the Front-End Interface that lets you select your games, the following are most helpful:

DPad Left / DPad Right = Select between systems

A (Right-most button) = Select Game

B (Down-most button) = Cancel

Start + Select = Quick game currently being played, go back to menu

Left Bumper / Right Bumper = Page Up / Down (Scroll quickly)


Configuring N64 Compatibility

For that first unit, I've always customized each emulator for the most important N64 ROMs. You can define a single ROM to use a specific emulator video-plugin, you can also define the default settings for each plugin. I recommend going lower res for all of the plugins: CEA-1will give you the best performance for modern monitors/TVs. You may want to reduce the frame buffer to the native 320x240.

For the below list linked on Google Drive/Docs, I have personally tested all three emulators: Gles2N64, Gles2Rice, and GlideN64, to see which is the most stable and has the most playable performance. Some games simply cannot run smoothly on the RetroPie, others it's a toss-up. You'll need to enable the Command Editor temporarily when you save these changes. Once done, turn it back off. List below, hope it helps.That should be enough to get you a fully operational RetroPie. Enjoy, and have fun!

Using the Run Command editor can be helpful for changing specific setting -- per-ROM. To do so, you would enable the Run-Command editor in RetroPi Setup.

RetroPie Setup > Configuration/Tools > Run Command > Launch Menu (Enabled).

From here, you can define a default emulator overall, and specific settings per ROM. You rarely need to touch the framebuffer, it's usually just the emulator choice, and possibly what resolution you want to run at. Again, Using 640x480 rendered on the RetroPie, will be scaled up to your 1080p screen, and can look better than a 1920x1080 rendering by the RetroPie

RetroPie N64 Compatibility List - Raspberry Pi 3 - Overclocked

I spent a little over 15 hours developing this list since all of the others I found were outdated, conflicting, or not applicable for an overclocked Raspberry Pi 3, hopefully you find it helpful!
https://docs.google.com/spreadsheets/d/12JtPecqKpC...

Final Note

Thank you for reading this far, I hope this guide has helped you in some way, whether that is enjoying gaming classics for yourself, with your kids, with friends, or just tackling a new technical challenge, good luck on your adventures and keep exploring!

Comments

james7313 (author)2017-11-21

Hi there, I am trying to work with Retropie 4.3 and I cannot get the overclocking to work when I add the lines to the config.txt file. Has anyone figured out how to overclock with the new Retropie? Thanks!

QuackMasterDan (author)james73132017-11-25

Hi there, thank you for your comment. RetroPie is merely a program that runs on top of the Raspbian Operating System. The overclock is under Raspbian -- RetroPie would not affect it. You may need to run your command in superuser mode. When editing config.txt, a protected file, you may need to use "sudo nano config.txt". Make your changes, then hit Ctrl+X (quit) and then Y (yes to overwrite existing file). After you reboot, the overclock will go into effect. Note that if you don't have active cooling (a case with a fan), you may see worse performance with the overclock after loading a game for even 30-60 seconds -- the system heats up so fast, it ends up underclocking itself to keep from overheating/damage. Hoping that is helpful, Google is your friend if you need more details on the Overclock of a Raspberry Pi. Good luck!

james7313 (author)QuackMasterDan2017-11-25

I tried it and inserted the instructions but it is still showing as 1.2GHz for the CPU. So I was unsure of how to force the overclocking.

Thank you for your reply!

MatthewM435 (author)2017-09-25

I had a lot figured out, but not proper overclock settings. This helped a severely stuttering Mario Kart 64 go from 50cc to 150cc. ;)

barrymossel (author)2017-09-13

You might want to mention that apparently the setting force_turbo=1 voids warranty...

https://github.com/retropie/retropie-setup/wiki/Overclocking#lifespan-and-warranty

Dirty DeedI (author)2017-07-19

Man, thank you. This was the first guide, that is ''fresh'' enough to have to current version of Retropie and Raspi config on it, so the overclocking information worked immediately, when I tried them. And amazingly, PS1 games can be run with 2xsal-shader, with mild OC, I could reach over 50 fps. I'll now tweak those values a bit more to hit stable 60 fps. Thanks from this topic.

barrymossel (author)2017-07-07

Thanks for the heads up about the N64 compatibility and overclocking. I am in the process of building an arcade cabinet and never thought of overclocking. Just ordered the case + fan!

rmartori (author)2017-07-04

Silly question, would this work with wired logitech controllers and a USB hub?

barrymossel (author)rmartori2017-07-06

Yes, they will work.

FrankB161 (author)2017-07-03

Very, very cool! I've done similar, but never thought of over clocking it. That should help tons on the crusin world N64 game. Thank you for sharing all of this!

Redjeep0 (author)2017-06-27

Thanks for this Instructable! I had wanted to get the NES classic but missed it...then saw the SNES classic was going to be released, but I think instead I will build this! I'd been looking for a reason to start a foray into the Raspberry world!

badtheba (author)2017-06-27

Sweet tutorial! Is that OS pretty accepting of any USB controller types? I have several N64 to USB "Adaptoids" that aren't made any more, but they would always install on Windows PCs as standard joysticks and I could program the buttons. I wonder if something like that would work to play 4 player games with the original N64 controllers?

QuackMasterDan (author)badtheba2017-06-27

The RetroPie is extremely flexible when it comes to controller inputs. Other very viable options are Wii U Pro controllers or PS4 controllers (bluetooth). There are a large number of varied gamepads that can work with RetroPie -- many people use specifically a N64 > USB adapter and connect it to their RetroPie for a more natural N64 feel. Hoping that is helpful, thanks for your comment!

gravityisweak (author)2017-06-27

Wow, this is the most comprehensive step by step I've seen on RetroPie. I've never used a Raspberry Pi but have been thinking about building one for emulation for a while now. But I've got a question, once you go through the process and have a working RetroPie system going, is it possible to duplicate everything to an identical raspberry pi by copying everything on the SD card to another card and save some time making another one for a friend? Or is each one of these builds just as time consuming as the first?

Build it once, get it dialed in just the way you like it, and copy/paste that image to multiple SD cards. These make great gifts by the way. After the hard work is done it's just a 10 minute copy/paste.

You actually use the same tool -- Win32DiskImager -- instead of writing an IMG to the MicroSD card -- you read/capture an image from the now completed MicroSD card. As long as you insert it into another same model (e.g. Raspberry Pi 3, not a Raspberry Pi zero), it will work the same, no need to redo work.

odellkevin (author)2017-06-27

Just an FYI...the Pi 3 has built in Wi-Fi, so you don't really need an ethernet cable as long as you have a wireless network in your house. Also, for people new at this, they may want to start out using recalbox (there are instructables on this site), it's a bit easier / noob friendly, but it's no where near as advanced and configurable as retropi. Just another option.

andersoon_fm (author)2017-06-27

Beautiful setup! Awesome work

eppfart (author)2017-06-27

Can a wired 360 controller work?

QuackMasterDan (author)eppfart 2017-06-27

Yes, a wired 360 controller should work. Note that the mapping may be named different on the AutoInput .ini file the N64 emulator uses, but it is fully supported.

iamchrismoran (author)2017-06-27

Great ible! One question though, in case I missed it. When using the wireless receiver for the controllers, what needs to be done so they don't turn the actual X360 on? Do you even need the "power" button on the controller for the RPi setup?

andybiker (author)2017-06-27

Nice write-up!

I used a 32GB card
(class 10 13UKP) and a PS3 sixaxis controller - it needs no adapter! the
PI3 has bluetooth and connects perfectly!

billioncash (author)2017-06-27

I've looked around, and this guide seems to be the most in depth explanation about how to overclock your rpi 3. A great read and nice work! But the real shining star here is the amazing list of compatible games! A VERY handy document!

Absolutelyautomation (author)2017-06-26

Humm good, have no idea about N64 emulators for Rpi

It can do a few games, there's a list on reddit somewhere of games that do and don't work. Even overclocked, it doesn't really have the video playing power to pull Mario Kart or Zelda games.

QuackMasterDan (author)ckellingc2017-06-26

Good golly, check out the bottom of the guide under "Compatibility List", I just made a new list from scratch. It absolutely can play Mario Kart 64 and Legend of Zelda Ocarina of Time and Majora's Mask -- get the overclock dialed in.

Last weekend, some friends and I spent far too many hours in Mario Kart 64 and Super Smash Bros with no issues, go for it and have fun!

About This Instructable

33,024views

410favorites

License:

Bio: I have a passion for tweaking things. Whether it be modding video game consoles, creating custom laser displays, or any creations with lights I love ... More »
More by QuackMasterDan:RetroPie - Overclocked Raspberry Pi 3 for Video Game EmulationTesseract Infinity DeskPower LED Light-Bar Ambient Lighting
Add instructable to: