One of the most immediate feelings that hit me when I was emulating on a computer was not that I missed the era-correct controls for game, but rather they did not look like I had remembered them to look. Playing these games on any modern monitor, even at lower resolutions, leaves a fair amount to be desired. Sprites looked washed out and the colors were brighter than they should be, which was directly related to the shift in technology away from CRT displays. As technology evolved to the point where modern monitors were smaller and lighter than CRT displays, it was only a matter of time until CRT displays started to disappear from the market. Today’s monitors are primarily either LED or LCD, and they are getting thinner, lighter, and less expensive every model year. Reproducing an arcade experience on such a monitor presents a number of challenges. Resolution aside, most class arcade games were displayed on CRTs that had a 4:3 aspect ratio, and not on widescreen LED/LCD displays with a 16:9 resolution. With a little bit of hardware, and a few adapters, it is fairly easy to capture a bit more of that retro experience, including scanlines.
Evolution Away From CRT Displays
The Cathode Ray Tube, or CRT, was the foundation of every television and monitor for decades. When we hear the phrase “boob tube”, the latter part originates from that specific technology. As to the former part, it has nothing to do with human anatomy, but rather a reference to someone who acts foolishly. From an operational standpoint, a CRT works by emitting electrons directly at the screen from behind through what is known as an electron gun. Color CRTs would have three electron guns, one each dedicated for red, green, and blue. Pictures were created on the screen by these electron guns zigzagging from top to bottom, shooting electrons into a single horizontal line, before moving down to the next. Each electron gun had a very calculated trajectory, to prevent the beam of electrons from crossing with other beams. Pass after pass, these horizontal lines would appear in the same place on the tube, with a small gap between those line locations, at regular intervals, which is commonly known as a scanline.
A lot of times, it is described compositional makeup of a CRT is described as containing a fixed pattern colored and black lines – and that is how some software scanline generators operate. In actuality, however, the black area which was not being hit with a stream of electrons, was not truly black. While it is true that there is not an image actively drawn at that position, careful inspection would show that there was bleed-through between colored lines. Since this was a known and established factor of how CRTs worked, game designers took advantage of this to provide shading effects that would make an image appear more detailed on a CRT display than it actually was. These same coloration and shading effects used by classic games in the golden era of the CRT are the same reason that those same games appear so washed out and blocky on modern displays. Essentially, we are seeing parts of the image that were never expected to be displayed.
Liquid crystal displays, or LCDs, work on an entirely different principle. For every pixel that we see on one of these displays, there are multiple sub-pixels. These sub-pixels consist of very small apertures that a white light is passed through, at all times. To regulate the colors and the amount of light that is passed through the display, itself, each sub-pixel has a shutter which controls the intensity of the light passing through, as well as the familiar red, green, and blue filters, which filter out all other colors apart form the color of the filter, itself. By varying the light intensity through the filter and which filters are currently active, these subpixels appear to have distinct colors and intensities. These subpixels are placed so close together, that it is often difficult to even distinguish individual pixels. And, since this is done through a singular backlight, there is no need for something similar to the electron gun arrangement of the CRT, hence the elimination of physical depth of the display (as well as a majority of the weight).
That all means that scanlines were an artifact of an older technology. It is a good thing that modern displays do not have scanlines, as there is less overall loss in the quality of the picture from the original source. When building an arcade cabinet, however, it does present challenges in capturing that specific retro look. Some enthusiast will insist on using CRT displays to provide as near-accurate a representation as possible, through using older monitors, actual arcade displays, or even older televisions. The immediate drawbacks for a lot of people, in choosing this path, is that there are issues in sourcing the displays, they are more prone to developing issues over time, are most costly, require specialized equipment to downsample, and weigh a lot. Despite all of that, when everything is working, the result is top-notch. Generally speaking, it is more cost-effective to forgo that part of the experience, than it costs from a time and materials perspective.
VGA Scanline Generators
While a majority of today’s monitors have digital input, a large number of them also have analog input, in the form of a VGA input, more correctly identified as a D-Sub 15 input. VGA describes the form-factor of the connector, rather than the resolution. HDMI is the most common type of digital input now, and it is capable of not just carrying video signals, but also audio and networking capabilities. Most video cards on the market today have some form of digital output, whether that is HDMI, DVI, DisplayPort, or a combination of them. Specifically, a Raspberry Pi has HDMI output, which is the basis of my build. Most of what I am doing will also directly work with any device which provides a digital output, providing that there is a means to convert that output to analog and that there is a display that is capable of interpreting that analog signal. The following items represent the configuration that I am using, although there are certainly other options available for the components listed.
My monitor of choice is a Dell 1908FP. From a specifications standpoint, it is a 5:4 aspect LCD monitor, which is capable of resolutions up to 1280×1024. It has both analog and digital inputs, in the form of a VGA input and DVI input, respectively. Additionally, it does contain several USB ports, which I will be looking at removing when I decase my monitor. As to the 5:4 aspect ratio, this is quite common in non-widescreen monitors between 17″ and 19″. It is not a true 4:3, but the difference is very minor. If I were to scale the horizontal aspects between a 5:4 and 4:3 display to their lowest common denominator, that yields aspect ratios of 20:16 versus 20:15. For my bartop cabinet, this is completely acceptable. I was able to get mine Dell 1908-FP through Amazon, listed as being in “like new” condition. Total cost was $45, including shipping. As of this writing, there are still some available, albeit at a slightly higher pricepoint. When searching for a monitor, the brand and model were not nearly as important to me as condition and price. I will ensure that my cabinet is adequately sized so that I can easily replace this with another monitor easily, should I ever need to.
Source: Amazon · Dell 1908FP UltraSharp Black 19-inch Flat Panel Monitor (Price: Varies)
HDMI to VGA Converter
In trying to find a proper HDMI to VGA converter, I learned that there are all levels of quality and quality control issues between the available options. Unfortunately, two of the converters that I tried did not work. One of them would not provide a signal to my monitor and a different one worked for all of ten minutes before failing. With some trepidation, I picked up a third converter, after having sent back the first two. Three times, lucky, thankfully. I ended up ordering the UGREEN HDMI Female to VGA Male Adapter from Amazon. Originally, I had passed on this particular model because it was active, as opposed to passive. It requires an external power source of 5V through a USB port to power the 3.5mm audio output that this model features. In retrospect, however, this is a great option for a Raspberry Pi, as it allows you to get 3.5mm audio output from the HDMI output, which is much higher quality than the onboard 3.5mm audio output. It is a more attractive alternative over a dedicated HAT for a DAC, and considerably less expensive (depending on what HAT I was looking at). I can easily hook this audio output to a miniature amplifier, either directly or through a 3.5mm to RCA adapter. As to the power requirements, for now, I will power it through a USB port. Eventually, however, I will have a dedicated switching power supplies, some of which will be relay controlled, when I determine how I will enclose the electronics inside of the cabinet.
Source: Amazon · UGREEN Active HDMI Female to VGA Male Adapter Converter (Price: $15.99 USD)
VGA Scanline Generator
There are multiple options for scanline generators, and they all operate on the same general principal. For boards that exclusively focus on generating scanlines, they will be analog in/out. The data contained on a digital signal is not easily convertible, without translating the signal to analog and then back to digital. In doing so, additional hardware is required to go back to a digital signal, and there will be some level of quality loss. Additionally, it really would not make much sense to go back to digital for lower resolution video sources, as that runs contrary to the purpose for which people would want to introduce a scanline generator in the first place. After comparing different products and reading people’s feedback on which scanline generators had the best apparent configuration and quality, I decided to use a Focus Attack SCAN.DL VGA Scanline Generator. It is highly-configurable, including potentiometers for trimming the red, green and blue channels, plus allowing for setting different scanline sizes for dialing in on a specific resolution, switching between even or odd scanlines, along with vertical sync adjustments to display scanlines on higher resolution displays. Add to that, it is one of the more compact scanline generators available, measuring a scant 2.1″ x 1.5″ x 1.0″. In today’s Amazon-centric marketplace, I always wonder what the experience will be in purchasing from a merchant directly. The experience with Focus Attack was great, complete with fast shipping and solid packaging.
Source: Focus Attack · SCAN.DL VGA Scanline Generator (Price: $19.99 USD)
What remains, apart from the Raspberry Pi or other HDMI video source, is simply any cables and adapters required to bridge the components. The HDMI to VGA converter that I chose has connects directly to the input side of my scanline generator. That left me needing a short HDMI cable to go between my Raspberry Pi and the converter and a short VGA cable to go between the output side of the scanline generator and the monitor. Optionally, a 3.5mm to RCA adapter can be used to hook the HDMI to VGA converter to an amplifier with RCA input. These are usually the types of cables that I have in moderate supply in my cable drawer. When sourcing the analog cables, it is important to use as few cables as possible and to keep them as short as feasible. Analog signals are lossy, due to things such as running through connections, the length of the cords, and are also subject to interference. Considering not everyone hoards cables, the following are comparable (and in some cases exact) to the cables that I am using:
- HDMI Cable: Amazon · Monoprice Commercial 1ft 24AWG CL2 High Speed HDMI Cable (Price: $3.38 USD)
- VGA Cable: Amazon · Monoprice 1.5ft Ultra Slim SVGA Super VGA 30/32AWG M/M Monitor Cable (Price: $2.24 USD)
- 3.5mm to RCA Adapter: Amazon · iXCC Premium Gold-Plated 3.5mm Male to 2 RCA Female Stereo Audio Y Adapter (Price: $6.99 USD)
Even including the monitor, this project can easily be put together for under $100. It is a very cost-effective solution and will approximate the look of an older display without the higher investment (and weight) of an actual CRT. Once I get my Raspberry Pi off of the temporary workbench, I will include comparison pictures of both the converted and non-converted analog signals. In the interim, the lead-in image in this article is an actual picture of the quality of the output of the SCAN.DL VGA Scanline Generator from Focus Attack’s product page. As to the actual connected components, themselves, they are pictured below, sans power cord to the HDMI to VGA converter.
Standardizing Output Resolution
While everything discussed so far has been agnostic of the source of the digital signal, there are some Raspberry Pi specific settings that can improve the quality of the illusion created by the scanline generator. Specifically, one issue that is present is that emulators may run at different resolutions to each other, and that Emulation Station on a RetroPie install will run at the maximum resolution. It is very tempting to let all emulators run games at their native resolutions, but it is fraught with a few issues. Most notable is that any overscan settings that might work for full resolution may actually have a magnified (and negative) impact at other resolutions. This is not related to the Raspberry Pi hardware, Raspbian, or RetroPie. Instead, this solely comes down to the individual monitor. Most emulators will have a setting which will prevent resolution switching, that is to say that it will use whatever resolution is enabled for the system and perform some form of upscaling to match a resolution which is higher than the native resolution of what is being emulated.
Instead, it is more prudent to determine what the base resolution of the system, as a whole, should be. It should be a common resolution, to ensure maximum compatibility with as many emulators as possible and high enough to show higher resolution images in the emulator frontend software, be that EmulationStation or some other package. Since a lot of the themes for these frontends will have higher resolution artwork than the games themselves, it is about striking a balance. Seeing as the scanline generator will apply a fixed pattern of scanlines, finding that balance will ensure that the scanlines appear consistent between all of the different applications that is housed in the cabinet. For me, I find that 800×600 meets the needs of the classic games that I want to emulate, while still providing enough to let the frontend have a enough “pop”, to bring out those finer details.
Before proceeding, it is important to realize to things. First, read through all of the supported display modes of the monitor to find what resolutions are supported and what refresh rates that monitor will run at for a given resolution. My Dell 1908-FP, for example, has two display modes for VESA 800×600, with one at 60Hz and one at 75Hz. Between those two modes, the 75Hz frequency generates a cleaner and more vibrant image without any flicker. The 60Hz frequency works just fine, as well, but with a lack of crispness to text and images. Once the display modes are known, they should be cross-referenced with the Video Mode Options section on eLinux.org’s RPiconfig page. For most older monitors, the VESA attribute in the display modes will indicate the timing mechanism used for displaying at the proper frequency. The RPiconfig documentation will refer to to modes of resolution, signified by hdmi_group=1 (CEA) and hdmi_group=2 (DMT). CEA is a standard of timing, as defined by the Consumer Electronics association. It is the newer of the two standards, with DMT being Display Mode Timing, which is a subset of the VESA standard. For practical applications, CEA is more current and is focused at television devices, and DMT was originally intended to describe monitors. As the technology for current displays continue to evolve, a large number of monitors support both CEA and DMT modes, while older monitors are more likely to support DMT modes. Again, the user manual for the monitor should point out if a display mode is VESA or not. If it is VESA-compliant, chances are that the settings will involve hdmi_group=2.
For my specific monitor, the two matching display modes that I am interested in are hdmi_mode=9 (800×600 @ 60Hz) and hdmi_mode=11 (800×600 @ 75Hz). According to the documentation, I need to uncomment and modify four lines in my /boot/config.txt.
hdmi_drive=2 hdmi_force_hotplug=1 hdmi_group=2 hdmi_mode=11
It helps to understand what each of those lines are supposed to accomplish. Starting with hdmi_drive=2, this setting will force HDMI move, instead of DVI mode. Even though the signal will be converted to analog, it will be converted to analog after the audio is branched off from the HDMI to VGA converter. After that, hdmi_force_hotplug=1 tells the system that we are forcing a potentially unrecognized display mode. From there, the remaining two settings are ones that were previously covered, hdmi_group=2 saying that the display is a VESA-compliant DMT display and hdmi_mode=11 being the target resolution for my display.
Once the changes are made, a sudo reboot will confirm if the settings are, indeed, correct. In the event that no display is visible, or it is not readable, simply SSH into the Raspberry Pi and either revert or modify the settings, accordingly. Once the display mode is set, it is possible that there will be a requirement to adjust overscan, so that the full picture fits within the confines of the display area.
Modifying Overscan to Recenter Display Area
In the same /boot/config.txt, there are four settings that control overscan, being overscan_left, overscan_right, overscan_top, and overscan_bottom. They are very simple to adjust, but will require reboots to continue to check the impact of the changes. Premise for all of the adjustments is that if any one of the directions are off of the edge of the display, increment it by positive values for that direction until it is no longer going off of the edge. If there is a visible margin and it needs to be closer to the edge, start decrementing the value (even if it means that you go into a negative range). Repeating this process for each of the directions should yield a centered and full-screen use of the display that will work in any frontend or emulator. Depending on which frontend is being used, it might be beneficial to modify a theme to use a background image which contains a full-resolution image with a single-pixel white border on a black background. These edges could easily be used for reference, and would prevent having to install X to use any sort of image viewer just for alignment.
That Adapter Sure is Ugly
It sure is! The initial focus is making sure that it works, and it does. This is apparent in the small sampling of captures that I have taken, which can be viewed in the article: Sample Output from Focus Attack SCAN.DL VGA Scanline Generator. The “frankencable”, as I have come to refer to it, will eventually find a new form factor.
Whenever dealing with an exposed circuit board, that board should either be securely mounted or enclosed. Inside of a cabinet, there are many mounting surfaces, while used outside of a cabinet, a project enclosure is a must. Regardless is the circuit is carrying any significant voltage, proper precautions are as much about protecting the circuit as it is about protecting a person, with both being equal. All it takes is shorting two pins to fry a board and you are out at least the cost of that board, at best. At worst, a short can damage attached components, as well.
My plans for enclosing this is something that has been on the forefront of my mind for the last few days. This is just one circuit board that will be used, apart from the Raspberry Pi, itself. The current plans include a relay board, a keyboard encoder, switching power supplies, as well as high voltage wiring. As I source the components, I am starting to lay out rough sketches of the footprint of what an enclosure for everything might look like, how I will be isolating components from each other, and how to do all of this with safety as a primary concern. There is not going to be an off-the-shelf solution to all of this, most likely. Perhaps I can find an enclosure that meets the footprint of it all, but I have the feeling I will be calling upon a laser cutting service for some custom acrylic at some point, in addition to possibly 3D printing some of it.
Needless to say, with each delivery of another component, my mind is going off in multiple directions. Both integrating all of these components into a cohesive project and making time to provide write-ups are at the forefront of my mind, whenever I am not actually keeping up with my day job.