Surfing across the internet, as I am usually found to be, I came across an article to develop your own Retro Gamebox, by APC Magazine (But I have modified the design a bit, to suit to my requirements). Well, it shouldn’t be difficult to guess, what might have happened next? I went scavenging for the parts, and then spent the next day assembling and running the Gamebox. Well and then there were a lot of days of playing on that console.
Although implementing this project itself wasn’t challenging, what was interesting was to understand the interface between the Arduino and the Television both from a hardware and software end. And the excitement increased manifolds as this was my first project on working with graphics on an embedded platform.
Note: None of the games were designed by me.
Video: Demo of the Gamebox
The components used in this Retro Gamebox are as follows:
- Four-way digital switch or 2 Four-way potentiometers
- Push Switch
- RCA Port and Cable for video and mono audio
- Arduino UNO R3
- Television capable of RCA interface and running NTSC/PAL
- Male and Female Connecting cables
The circuit diagram for connecting these components is as shown:
Fig: This is the updated circuit diagram for my design
Although the APC Magazine mentions using an arcade joystick which is essentially a combination of four digital switches which provide direction and movement control. But I am currently using four way potentiometer switches instead. (The kind of arcade joystick mentioned on APC magazine was not available in local markets, and I was willing to experiment with these). These work exactly in the same way as the arcade joystick, and provide the possibility of gameplay where variable speed may be required (But some tweaking would be required). The center position of these potentiometer is kept below the threshold level, so that the Arduino does not pick up false signals. Although two switches are required, one for up and left, and the second for right and down. (And trust me the gameplay doesn’t get affected a lot)
Note: The two potentiometric switches could be replaced by a single one, using analog input pins of Arduino and tweaking input control section of the code. I shall upload the schematics and the updated code library for the same. The two extreme values of the analog input could act as the two opposite direction digital inputs.
Coming to the analog video and audio hardware. The Arduino essentially generates the analog video data and the synchronization pulses on its D9 and D7 pins, which are then combined into a single composite signal via resistors and finally connected to an RCA port. The audio is generated by the Arduino using 8-bit PWM pulses on its D11 pin and are passed on to another RCA port.
These signals from the RCA port can be connected to any TV running NTSC. I had an NTSC running television, but for those having PAL based television you will have to connect the D12 pin of the Arduino to ground.
This is how my final system looked like:
Fig: This is the final designed project
The games and the software required to run the device were built for the Nootropic Design Hackvision board, but work well with this system. While most of the software which pertained to taking inputs from the switches was fairly simple and easy to implement for anyone with an intermediate experience on Arduino, the parts that caught my interest were the games and the TVout Library of Arduino that connected this system to the Television.
I haven’t worked on building games (But this is something, that I am willing to try my hand at, when an opportunity arrives), I tried doing a thorough study of the TVout Library and am writing some details of the same here.
The library is built up of functions that are bundled up into intuitive categories. A short description of these functional categories is as follows:
- Setup Functions
- These functions are responsible for sending the output on the screens at specified resolution and also to set the number of times, time and the line to output the data
- Flow Control Functions
- These are essentially two functions that provide delay in units of ms or frames
- Accessor Functions
- This is a set of three functions that usually access data related to resolution and the number of characters that can fit on a line
- Basic Graphics Functions
- These are a set of functions that let you draw graphics on screen. Pixel draw, basic shapes, lines, and bitmaps can be outputted on the screen using these functions
- Text Handling Functions
- These functions provide you with print functionality for characters, string. Also it helps you set preselected font style or custom fonts and the cursor position
- Audio Handling Functions
- These functions help you set audio tones by setting the frequency and duration of the tone
Note: The code and other details for this project are available on the APC Magazine page for this project.
If you have any questions regarding the hardware or the implementation please do feel free to contact me via the form below.