RoadTest: New Year's Grab Bag RoadTest
Author: shwetankv007
Creation date:
Evaluation Type: Development Boards & Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Newer versions of the raspberry pi
What were the biggest problems encountered?: Perhaps the control of GPIO buttons using a matrix layout
Detailed Review:
Hello everyone, I received a Raspberry Pi 1 from the new year's grab bag. I always wanted to own my own Arcade machine and since I knew about the Retropie and emulation station, the urge always increased. Being a design engineer myself it is obvious that I wanted to then build my own Arcade. So what I did? I jumped on the New year's grab bag once I saw the Raspberry Pi there.
I have previously worked on the raspberry pi 3B+ for a side project that involved camera based intrusion detection, so the getting started was not new for me. As soon as I got to know about the selection as a roadtester, I started preparing for the build however couldn't go far. So things I have covered in the roadtest review:-
1. Introduction
2. Hardware setup required
3. Software setup
4. The Cabinet
Introduction
Raspberry pi is a great platform which finds application in a lot of aspects, including an educational kit for schools to get hands on programming experience, hobbyist groups to produce great projects and a very great starting point to dive into the SBC computer interfacing and everything.
I myself found the development board very good and moreover the community support is awesome.
The latest version of Pi is a beast with 1.4GHz processing power and 1GB RAM onboard. It has great many peripherals to interface with including the 4* 2.0 USB connectors, an ethernet and HDMI.
Raspberry Pi 1 falls in the first list of the raspi chain, the features are as follows:-
- 256MB (Rev 1)
Below is the depiction of all the components on the raspberry pi:-
Now as I said earlier, my basic idea behind getting a raspberry pi 1 was to make a retro arcade machine of my own. So I planned to hook up my old TV CRT screen with the RCA to the board.The reasons for using the CRT screen were to have an actual feel of the arcade machine and have the nostalgia of playing it on the analogue screen. Moreover the CRT had been lying around for quite a long time now, and this was a great way to put it to some use.Moving on in the subsequent sections I describe about my build and all the setups required for the same. It includes all the hardware tools required, the software for interfacing the custom button set and the overall planned cabinet build.
{gallery} My Gallery Title |
---|
Raspberry pi 1 (left) raspberry pi 3 (right):- One can see the amount of changes these two went through apart from just the processor and clock speed. |
Hardware Setup
So for the whole build of the arcade machine here are the few things that I wanted the Arcade to have:-
Now the first part was to boot up the system and check the CRT monitor if it is working fine or not, however I had to do one more thing to get the raspberry pi booted up......no its not flashing the SD card. The raspberry pi one uses an SDHC card port, unfortunately I had no adapter laying around so I have to connect a micro SD card holder to get the things going.
So I basically double tapped a micro sd card slot just besides the existing one and made all the connections. You can see I soldered the presence pins permanently which are at the top( it reduced the jumper wires by two). So I basically flashed the SD card with the latest Retro Pie version ( more on this later) and hooked up my CRT TV monitor to see if it works. And voila it is working great and I am really happy with the resolution I am getting. Though it's difficult to see on the monitor for long period of time over short distance. The glare is high even on the low brightness.
With all these things in mind the next challenge was to add buttons for two players. I wanted to have following buttons:-
Player 1
Joystick Up, Down, Left & Right 4
Fire buttons (A B X Y) 4
Start button 1
Select button 1
Player 2
Joystick Up, Down, Left & Right 4
Fire buttons (A B X Y) 4
Start button 1
Select button 1
So in total about 20 buttons are required, and for future operations or features I planned to have atleast 4 reserved buttons for shutdown button, volume control etc. Hence the button count increased to about 24.
The only problem is that Raspberry Pi 1 has only 17 user GPIOs for direct connections. This made me think of using a couple of options for the control of these buttons. The first thing was to use an I2C/ SPI expander and utilize the I2C line which can be used to control 16 buttons at once. This means I can use one such expander and use the remaining GPIOs directly to the buttons.
I found the adafruit library Retrogame which basically uses GPIOs and create a virtual keyboard to send to the retropie kernel and the controls can be used. I planned to use the I2C data and make some changes in the retrogame library.
Later on I thought of using a Matrix keyboard configuration and steal the idea of virtual keyboard to send the tokens to the kernel and guess what I found felix No HDMI matrix keyboard . More on the configurations later.
So I finalized the idea to go with the matrix keyboard layout for the control of buttons. I used a 4*5 configuration that gave me 20 buttons for the control and will be using 4 more buttons directly to the GPIOs for other use.
Below in the representation of the keypad and respected GPIO pins used.
With the above layout I made the connection on the arcade joystick board. As said I used two joysticks and total 12 buttons that counts to 20 I/Os which can be easily connected with the matrix configuration.
{gallery} My Gallery Title |
---|
It all looks messy.... |
So I tried to get the first player connections first so that I can go step by step with the whole thing and guess what it worked ( well sort of). I followed the kernel build and package install and everything which I have discussed in more detail in the software section. However I was not able to get all the buttons working, The 'B' 'X' 'Y' 'start' select' buttons were working fine when I checked the input event utility but none of the joystick buttons worked. Moreover the 'A' button when pressed displays that all the buttons i.e. A B X Y have been pressed which was weird.
I thought this might be a problem with the connections of board or perhaps the buttons itself so I made another 1 player board on a zero PCB ( perf board) but the problem persisted. Now however I am not sure what exactly is the problem but it seems to be some sort of software issue or maybe any update of the utilities used during the compilation of the kernel. So I would be booting the Pi with a new kernel and the required utilities to see what comes up.
{gallery} My Gallery Title |
---|
I checked the buttons press with a multimeter and everything seems to be fine so my interpretation had been an issue during the kernel build. However I am running late on the review submission hence would be posting the updates in the following edits/ write-ups.
Software Setup
This section has been dedicated to describe the software setup required through out the build of the system. So Raspberry pi is generally a mini computer and it is very much capable of running a full fledged modded operating system (generally Raspbian). However a separate software library has been build on top of the linux kernel to support retro game emulation on the raspberry pi system. I followed the general steps to flash the SD card with a retro pie image.
1. Download the latest Retropie image from the official retropie site https://retropie.org.uk/download/ .
2. I used the Etcher balena software for flashing the SD card with the RetroPie image
3. Now that we have an OS to boot from we need to plug our Raspberry pi and make some configurations
4. So I connected the ethernet for internet connection and fetched the IP address to access a remote SSH
5. I just used some basic configurations including the video resolution and enabling the VNC ( if required).
6 The first boot asks for keyboard buttons assignment and I used the generic keyboard to use the buttons
7 On the configuration screen I selected Retropie - setup
8. I installed the retropie manager to add ROMs and BIOS by navigating to 'manage packages' --> 'manage experimental packages' --> 'retro manager'
9. once installed I can get a file manager by simply adding the IP:8000 port
The slide show consist of all the images involved in the setup.
So added a few ROMs to get started with playing and I had a great time playing those 1970s games.....no kidding. I was playing on my keyboard and I was having fun remembering the good old low graphics days over the good for something CRT TV.
Now is the time to connect the arcade control board and test all the buttons. As described in the hardware section, after a few research I found three option to connect the buttons with raspberry pi GPIOs:-
1. Directly connecting buttons to the GPIOs and use adafruit retrogame library to create a virtual board. However this option can only give 17 buttons due to GPIO limitation in the raspberry pi 1
2. Using a serial expander (I2C/ SPI) and make some changes in the library accordingly
3. Use a matrix configuration for 4*5 keypad and using 20 buttons at once with the board. I found an episode of sudo seargent which dealt with making a matrix keypad for a retropie mini by recompiling the kernel with some settings and then running a device tree for the virtual keypad. So I followed this path
Steps involved in the whole setup:-
1. I use a linux machine so I installed cross compiling toolchains for ARM cross compilation
2. I followed the information provided on the raspberry pi website https://www.raspberrypi.org/documentation/linux/kernel/building.md
git clone https://github.com/raspberrypi/tools ~/tools #update path variable echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc source ~/.bashrc #Get source git clone --depth=1 https://github.com/raspberrypi/linux
3. Following the instructions I was able to setup the environment for build and then I followed felix for further addition of the utilities
4. Basically we need to enable device manager and enable the matrix keypad there and build the kernel for it.
5. Now by adding the image so created and updating the config.txt file to load the image on boot we are good to go.
For more information visit:- https://www.youtube.com/watch?v=-AjqBuJuIms&t=1s
This is a thorough video with all the information required.
So according to the schematic above I used following device tree source for using all the buttons over GPIOs.
/dts-v1/; /plugin/; / { compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; fragment@0 { target-path = "/"; __overlay__ { keypad: MATRIX4x5 { compatible = "gpio_keypad"; debounce-delay-ms = <10>; col-scan-delay-us = <10>; row-gpios = <&gpio 27 0 // 4 &gpio 22 0 // 2 &gpio 10 0 // 3 &gpio 9 0>; // 4 col-gpios = <&gpio 13 0 // 5 &gpio 26 0 // 6 &gpio 16 0 // 7 &gpio 20 0 // 8 &gpio 21 0>; // 9 linux,keymap = < // col0 row0 KEY_UP 0x00000067 // col0 row1 KEY_A 0x0100001E // col0 row2 KEY_I 0x02000017 // col0 row3 KEY_5 0x03000006 // col1 row0 KEY_DOWN 0x0001006C // col1 row1 KEY_S 0x0101001F // col1 row2 KEY_K 0x02010025 // col1 row3 KEY_6 0x03010007 // col2 row0 KEY_LEFT 0x00020069 // col2 row1 KEY_Z 0x0102002c // col2 row2 KEY_J 0x02020024 // col2 row3 KEY_2 0x03020003 // col3 row0 KEY_RIGHT 0x0003006A // col3 row1 KEY_X 0x0103002D // col3 row2 KEY_L 0x02030026 // col3 row3 KEY_3 0x03030004 // col4 row0 KEY_ENTER 0x0004001C // col4 row1 KEY_SPACE 0x01040039 // col4 row2 KEY_1 0x02040002 // col4 row3 KEY_0 0x0304000B>; }; }; }; };
Using the above device tree source and building the device tree object and defining the rule I thought I would be able to now control these buttons with my arcade top controller. I made all the required connections and everything but faced a new weird problem
{gallery} My Gallery Title |
---|
Now talking about the problem, I run an 'input event' utility to check whether the virtual keys are working fine or not but I tumbled upon an issue. So for now the plan is to recompile the system and then proceed further. I would also use a prebuilt matrix keypad just for the testing purpose to confirm if the problem lies in the hardware.
For the time being I am working more on the arcade cabinet side since I know I can always move to the I2C option, however I would prefer the matrix configuration. I expected to have the full Arcade Machine by the end of march but due to a bit hassle and relocation of my living space I had to push the deadline forward. And I am now working to atleast end it by April end.
For now I have just been able to work on the controller portion of the cabinet. I am planning to make a bar top version and just the cover and bessel of the monitor are to be made. The Controller board I made already have a strip running hinge in order for it able to mount and easily open while placing with the remaining cabinet.
The plan for the overall design is as shown in the image.
{gallery} My Gallery Title |
---|
The images are of the design that I am looking forward to make. I use tinker cad, it is an online design tool backed by autodesk. Though I am not much into CAD stuff but making a visible model helps to realize the build.
Conclusion
Though the review was about making a project around the Raspberry pi and I am able to just I would say produce about 60-70% output. I am looking forward to building the whole thing. I always liked the SBC dev board raspberry pi since it provided all the required peripheral and exposed GPIO pins for further interfacing. I have earlier used a Raspberry Pi3 in one of my projects which was an intrusion detection using the pi cam. Currently I am also involved in a design challenge Picasso design challenge. I would be utilizing the raspberry pi 3 for making another build. My experience with raspberry pi overall had been a great learning curve including the interfacing and kernel building. I am really intereseted in making the custom kernel in the near future.
I did saw a bit of heating issues while running the games on raspberry pi1. Though there were no noticeable lags or something. I guess I would preferably attach a fan to it and also try the overclocking option to see the difference in the performance.
For now this is all I can produce for the roadtest and would be adding on further posts.
Top Comments
Your modification of the SD slot with a microSD slot piggybacked onto it is lucky to work, as the SD bus does run rather fast signals (25MHz). With extra length, differing lengths, the signal quality might…
Shwetank,
A few typos here and there, otherwise a very solid roadtest review !
Lookin forward to the next update on this !
Eashan