Raspberry Pi 240p Analog Output

 

Introduction:

Using a Raspberry Pi is an interesting and cost effective way to build a dedicated emulation platform. It’s not as powerful as a modern PC, but in many cases, it’s good enough to get the job done.  In my opinion, it’s not a replacement for original consoles, but it’s a great alternative for classic arcade games, considering how easy it it.

The one thing that set a Raspberry Pi apart from other emulation boxes is how easy it is to use its analog output on RGB monitors or even basic CRT TV’s!  The video above is a basic summary of how all this works and the page below will guide you through all the details of what you’ll need.

 

What you’ll need (all software is free):

– Raspberry Pi with a good power supply. RPi3’s are the most compatible, but RPi4’s are much faster.  Older RPi’s will work as well, but they’ll be much slower.

MicroSD card.

– Software Image (details below)

SDCard Formatter  I recommend downloading the fat32formatter software as well.

– Advanced options might require access to a Linux or Mac machine, but you can something like Virtual Box to run Linux inside your existing Windows machine.

– Analog Output Solution

Hardware Solutions:

Before starting your RPi build, you’ll need to decide what your target device will be.  Luckily, there’s many options these days that should cover almost all use cases.  Here’s my favorites:

Basic Composite Video Output:  If you’re just looking to use a RPi on a CRT TV, the cheapest option is to simply buy the proper 3.5mm adapter cable and add the proper settings to the config.txt file (if necessary).  Not all adapters are made the same though, so make sure to get something like this that’s the same exact pinout the RPi’s require.  As a note, RPi 1’s have a composite port built in, but those are much too slow to use for emulation.

If you don’t want to buy a cable, you can solder an RCA jack directly to the pins on the bottom of the Pi like this.  Signal is PP24 and I used PP6 for ground (click for full-sized):

RGB SCART Output:

RGB-Pihttps://www.rgb-pi.com/
This is one of my favorite solutions for RPi gaming!  Everything you need is included right in the cable (including audio) and their custom software is the best I’ve used so far.
There’s also a JAMMA version available for use in arcade machines that uses the same software.

RecalBox RGB Dual:  https://www.recalbox.com/
This device can output RGBs through either a SCART port or a HD15 dsub connector.  Only one output at a time is supported, however it’s great there’s a choice:  SCART users can simply use a cable and PVM/Crosspoint users can pick up a cheap “VGA to BNC” cable.

There’s a device called the ‘VGA666RGBs’ that’s essentially the same as an RGB SCART adapter, but it separates the outputs to RGBs via RCA connectors.  This is a good device for people who specifically want separate RGBs outputs, such as for direct connection to an RGB monitor or Extron switch (through RCA to BNC adapters):  https://www.retrorgb.com/vga666rgbs-by-retro-game-restore.html

When I first created this page, there were very limited options for RGB output.  My favorite is still the RGB-Pi for its ease of use, however there’s other excellent ones out there – I suggest searching around and choosing the one that fits your setup the best.

VGA / S-Video / YPbPr Component and Composite Output:

Mike Chi, creator of the RetroTINK line of products created a device called the ‘RetroTINK Ultimate’ that outputs all of these signals.  It can also output both RGBs and RGBHV through it’s dsub connector!  As a note, if you’re simply looking for a SCART solution, it might be easier to get one of the above products.  If you’re looking for multiple outputs including SCART, you can simply get (or make) a custom “dsub to SCART” cable!  As a note, the Ultimate is confirmed to work with the RPi4.
RetroTINK Ultimate main page, including config.txt settings and pre-configured images:  https://www.retrotink.com/post/retrotink-ultimate-where-is-it
Purchase the RetroTINK Ultimate:  https://bit.ly/2QTc5IG

VGA Output:

One of the original RPi ‘hats’ is a VGA output device.  You can find these on Amazon or eBay for around $10 and they’re a great solution for people who want to use VGA CRT monitors as their display.  As a note, I don’t recommend these for use with RGB monitors, as most will require a sync combiner, making other solutions easier and cheaper

HDMI to Analog Converters:

You can configure a RPi to output a CRT-compatible resolution via the HDMI port.  As a result, you can use HDMI to VGA, or HDMI to Component Video converters instead of RPi ‘hats’.  Just make sure to use a converter that’s just a DAC and not a scaler, such as the Zero-Lag Converters linked here:  https://www.amazon.com/shop/retrorgb

Software Images:

You’ll need to flash your MicroSD card (instructions below) with software designed specifically for gaming.  Here’s my current favorites:

RGB-Pi OS:  https://www.rgb-pi.com/#os
This software is designed for use with the RGB-Pi products, however you can make it work with other HAT’s, by editing it’s config.txt file.  A few things to note:  Use with other HAT’s isn’t supported by the team, but is safe to try.  Also, I strongly recommend OS4 (or later), as it offers some really awesome features!

RecalBox:  https://www.recalbox.com/
This OS / frontend has been around for awhile and has always been one of my go-to’s.  It’s not just for the Pi’s either!:  They have versions of the software for many platforms, as well as PC’s.  If you were looking for a consistant experience across multiple devices, this is probably the software for you.

Flashing The Operating System to the MicroSD:

Prepping the MicroSD Card:

Regardless of what software you use, start by inserting your MicroSD card into your computer and load the SDFormatter software.  Make sure to hit the “option” button and set “FORMAT SIZE ADJUSTMENT” to “ON”.

64GB and Larger SD Cards

If you’re using a 64GB MicroSD card, you may want to format a second time using “guiformat” (this is required for some installations with larger SD cards!).  Simply download and use this software to format the card instead of the built-in Windows tool:  http://www.ridgecrop.demon.co.uk/guiformat.htm
64-bit version available here:  http://www.ridgecrop.demon.co.uk/guiformat-x64.Exe

DOS Format (Alternative)

Anyone preferring a command prompt instead of a GUI can use the command-line version of the same software:

– Download the fat32formatter software and extract it to a folder on your computer (I just used the root of my D:\ drive).

– Open a DOS window, navigate to where you extracted the file and run the command “fat32format X:”, replacing “X” with the drive letter of your MicroSD card (mine was “F:” in the pictures below).

– Hit enter after typing the command, then yes to all prompts.  If you get an error, close all Explorer windows (or any program accessing the card) and try again.  Click the picture below for a full-sized view.

Imaging the MicroSD:

After formatting, simply load the image via imaging software.  I use win32diskimager for Windows, which requires you to right click on the icon and hit “run as administrator” for it to launch properly.  All other imaging software should work the same though.

Depending on the size of the image and the speed of your SD card, this can take anywhere from one minute to an hour.

Configuring the software for your Hardware:

The first thing to note, is if you’re using a matching hardware / software combo like RGB-Pi, or Recalbox + Dual, there’s no configuration necessary:  Just insert the MicroSD and boot.  Worse case, you might have to boot to HDMI first, then set it to RGB out (Recalbox sometimes does this), but it’s usually plug-and-play.  That’s right, if you get matching hardware and software, there’s no commandline necessary!

If you’re using another option, or mixing & matching OS’, please read on…

Each software image will create a “config.txt” in the root partition that should be viewable on all PC’s.  This file needs to be configured for use with each of the software solutions mentioned above.  Most times it’s as easy as opening the file in Notepad (although Notepad++ is always recommended), then copy and pasting the data to the bottom of the file.  Then (of course), save the file and eject the card.

As a note:  If you’re using a generic image, I strongly recommend booting the Pi via it’s HDMI output the first time you use it, just to make sure everything else was configured properly.  Then, after verifying the install, change the config.txt file for analog output.  If you’re using a custom image such as the ones provided directly from the software manufacturers, then you can skip HDMI boot and just start with the analog output.

Config.txt Configurations:

Here’s some configurations for common hardware solutions like the ones mentioned above.  These are just a reference and further research might find more tweaks.  If you have any issues, check your hardware manufacturer’s website:

Direct Composite Video Output:

Depending on the RPi model and software you use, you might not need any changes to the config.txt file at all!  Simply make sure there’s no HDMI cable plugged in and a proper, compatible 3.5mm composite adapter is inserted (or soldered on).  If that doesn’t work, try adding this code to enable NTSC 4:3 cvbs output.

enable_tvout=1
sdtv_mode=0
sdtv_aspect=1

GERT666-Compatible Adapters:

disable_audio_dither=1
dtparam=audio=on
dtoverlay=vga666
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87
hdmi_timings=320 1 16 30 34 240 1 2 3 22 0 0 0 60 0 6400000 1 #240p

HDMI to VGA/YPbPr Component Converters:

There’s been different discussion on how to accomplish this.  One theory is to simply take a  stock image, comment out
#enable_dpi_lcd & #display_default_lcd, then add:

hdmi_group = 2
hdmi_mode = 87

Other people have suggested simply adding hdmi_group=1 & hdmi_mode=8 to the config.txt file.

I used this full code for the config.txt file and had luck on RPi 3 & 4’s, however I’d like to spend more time testing.  Another advantage of using HDMI adapters is you can run them at interlaced resolutions as well, meaning you can watch 480i TV shows on a CRT in their native resolution; An excellent use of an RGB monitor.  I’ll revisit this in more detail in the future, but for now, here’s the full code that worked for me:

hdmi_ignore_edid=0xa5000080
hdmi_pixel_encoding=2
avoid_safe_mode=1
disable_overscan=0
config_hdmi_boost=4
hdmi_drive=2
hdmi_group=1
hdmi_mode=8
kernel=zImage
hdmi_force_hotplug=1
gpu_mem_256=128
gpu_mem_512=256
gpu_mem_1024=512
dtparam=audio=on

RetroTINK Ultimate (RPi4 Confirmed):

gpio=0-27=a2,np
#dtoverlay=dpi24
enable_dpi_lcd=1
display_default_lcd=1
dpi_output_format=519
dpi_group=2
dpi_mode=87
hdmi_timings=3840 1 109 343 343 224 1 19 3 16 0 0 0 60 0 7292529

Raspberry Pi 4 Compatible Timings (might not work with all software):

gpio=0-27=a2,np
#dtoverlay=dpi24
enable_dpi_lcd=1
display_default_lcd=1
dpi_output_format=519
dpi_group=2
dpi_mode=87
hdmi_timings=3840 1 109 343 343 224 1 19 3 16 0 0 0 60 0 7292529

RGB-Pi:

disable_overscan=1
hdmi_force_hotplug=1
config_hdmi_boost=0
dtparam=audio=on
display_rotate=0
audio_pwm_mode=2
disable_audio_dither=1
hdmi_drive=2
boot_delay=0
disable_splash=1
avoid_safe_mode=1
dtoverlay=pwm-2chan,pin=18,func=2,pin2=19,func2=2
framebuffer_depth=32
framebuffer_ignore_alpha=1
dtoverlay=rgb-pi
enable_dpi_lcd=1
display_default_lcd=1
dpi_output_format=6
dpi_group=2
dpi_mode=87
kernel=zImage
overscan_scale=0
avoid_warnings=1
gpu_mem_256=64
gpu_mem_512=128
gpu_mem_1024=256
dtparam=i2c_vc=on
dtoverlay=i2c-gpio,i2c_gpio_sda=10,i2c_gpio_scl=11

Controllers:

I think it’s important to mention controllers.  While most OS’ do a good job with easy controller setup, software emulation is still pretty terrible at in-game button mapping.  Good news though!  If your focus is original consoles from the pre-32bit era, there’s almost nothing to worry about: Setup your controller in the main interface and all the buttons should be mapped automatically.

The trouble starts when using arcade games, each requiring their own button mapping.  While this isn’t the fault of the software frontends, it’s still something we need to deal with.  There’s really nothing you can do to “fix” that in the short-term, other than teach yourself how to use the frustrating in-game menus, but you can solve some potential issues by getting a controller with all the buttons you’ll need.  Here’s some chosen from personal experience and verified with the MiSTeraddons latency sheet – Pick the top two if you need analog controls (like with arcade driving games) and the others for a more classic experience.  Modern Xbox controllers connected via USB should be good as well:

Logitech F310:  https://amzn.to/3DtYr5S
SN30 Pro Wired:  https://amzn.to/3qYFwuP
Retroflag SNES USB controller:  https://amzn.to/3LBPw4W
Retro-Bit Genesis USB controller:  https://amzn.to/3NGe2ny
Retro-Bit Saturn Clear USB controller:  https://amzn.to/3J1g4v0
Retro-Bit Saturn Black USB controller:  https://amzn.to/3DusrOZ

Video Tutorials:

Here’s some older tutorials that walk you through some of the software and hardware mentioned here.  Some of the methods are a bit outdated and some of the products shown are no longer made, but overall they’ll still help you get a sense of what to do if the above instructions are confusing.

Summary:

This page makes it look like there are a lot of steps, but it’s actually pretty quick and easy:  Format your card, flash the OS, configure the config.txt file, load your roms and start gaming!

If you’re done, please head back to the main Arcade / MAME page for more information and check out the main page for news keeping people up to date with everything going on in the retro-gaming scene!