ZeroBoy – A poor man’s retropie “portable”

tl;dr

You know when you see something and it give you instant inspiration and you also see a few ways you would also improve it. The thing I seen was wonky resistor score zero it’s basically a raspberry pi “hat” that has buttons in the layout of a nes controller. What I first thought was to make my own “hat” but flip it 180 degrees and add pass though pins so I could add a screen on top of that. Joint me below for my journey I went though.

Hardware

As I was saying I wanted make my own controller but have it as a pass though “hat” After a bit more thinking I decided I could do better than just A NES layout. After building my pigrrl 2 I remembered that you can have a SNES layout and still have enough pins for a SPI screen.

Screen

The screen I’ve wanted to use with this project was a clone of the waveshare 3.2″ screen, This can be found on ebay for about £8-£9. The first port of call with this screen was to see if any of the pins needed for clashed with the pigrrl 2 button layout. Luckily for me there wasn’t any pin clashes other than one of the buttons on the side of the screen so this wasn’t problem.

To get the screen working with retropie I followed this forum post. Once the screen was working I installed the pigrrl controller drivers, This is where it all fell apart and I spiraled into a pit of despair.

Because the screen had to same footprint as a raspberry pi 1/2/3 it had to use those extra long female headers. I wanted to replace them with just normal male headers so I could attach it to the PCB. First thing I did was put the existing female header in a vice and pull the plastic off the button exposing the female pins. Next I needed to remove the screen from the PCB. With these screen the screen is only stuck to the PCB with double-sided tape, All you need to do is carefully pull it off. The screen ribbon cable is soldered to the PCB but its got enough slack to let it fold open like a book. To completely remove the female headers I secured the screens PCB and screen in the vice again. This would allow me to hold each pin individually then with a pair of pliers pull each pin out. You will need to use a solder sucker to get the remaining solder out of the holes you pulled the pins out of.

Buttons

The thing was with this project I was against the clock. I wanted the PCB back before Xmas so I knew I had to get it sent off as soon as because it normally takes 16 days after being sent to fab to being derived from Oshpark. Since it was the run up to Xmas the post starts to get clogged up with presents. I made a school boy error by not checking that the button drivers would play well with the screen drivers. So after putting the screen and buttons on the PCB the buttons wouldn’t work. The buttons would work fine as long as I didn’t install the screen drives, The screen drivers must over write something under the hood.

I fell into a week-long frenzy of looking for alteratives to map the buttons. First I thought I would use wonkey resistors example code but It didn’t seem to work. I did notice that on the website it would be adding retropie support so I reached out to them on twitter and got this reply

Lets see if they come thought on their promise.

Next  up was mk arcade joystick rpi this looked like it would work. So after installing it I tried to do the custom configuration option but I just couldn’t get it to work.

After even more searching and falling deeper and deeper into the pit of despair I came across gpioneer This looked a bit more promising. After the rather lengthy install I was asked if I would like to configure the button layout. All I had to do was push the buttons I wanted mapped to the buttons shown on-screen twice. With this you don’t have to make sure the buttons are mapped to the right rpi buttons just that all the buttons you want to use are mapped. After a reboot retropie recognised the buttons and let me configure them at start-up.

Finally I had the buttons mapped and the screen working.

Shoulder buttons?

So you my be asking yourself how do you do shoulder buttons on PCB. Well its simple all I used were 90 degree mounted push buttons mounted on the under side of the PCB. I was worried that with the buttons being on the underside of the board that they might clash with the mini HDMI port or power micro USB port but they didn’t.

Hotkeys

You may notice like I did there wasn’t a hotkey for saving with the buttons, normally on a controller you press the hotkey (select) then L shoulder button to load and R shoulder button to save. You will need to edit a file to enable this.

The file you need to edit is

/opt/retropie/configs/all/retroarch.cfg

open this file with your favour text editor.

To set the save buttons. First search for

input_player1_r

make a note of what key has been set, Next you need to search for

input_save_state

uncomment this line by deleting the # at the start of the line then add the key that was set at

input_player1_r

To set the load buttons. First search for

input_player1_l

make a note of what key has been set, Next you need to search for

input_load_state

uncomment this line by deleting the # at the start of the line then add the key that was set at

input_player1_l

Power

I’m not going to lie this is where my idea is lacking. I had look around for battery solution for the raspberry pi. I couldn’t find one that was cheap and easy to implement. I could have used the powerboost 1000c but its £20, well over my budget. I also looked at the lipo shim from pimoroni which was fairly cheap at £10 but it wouldn’t let me charge the lipo so it was useless.

In the end I just settled for an external power bank or until I could make my own power solution for the raspberry pi

No sound

Another downside to this portable retropie is the lack of sound. This is a bit more complicated to do on the raspberry pi zero since it doesn’t have a headphone jack to tap off. Again if I had more time I could have researched a solution to this but I was up against the clock. It’s not all that bad playing without sound anyway.

Emulators?

So because you can only really use this with a raspberry pi zero this does limit you to what emulators you can run. I have found that N64 and PS1 are out of the question but it will easliy play upto A SNES/Genesis/Master system also Gameboy Advance.

Keyboard anyone

So what I love about this is you can just swap out the sd card to change the OS. So you can carry with you a hand-held console plus a development environment. I wrote a python script to emulate keyboard presses. I mapped the d-pad to up, down, left, right arrow keys and A button to enter B button to delete X button to ctrl + c and Y button to type EXIT. This will let me develop pygame code that needs to be run on the pi not just over SSH on my computer.

You will need to install uinput to get this to work under raspbian but other than that it works great. Follow the instruction below to get it up and running

To install you will first need to install PIP then install uinput

  1. sudo apt-get install python-pip python-dev build-essential
  2. pip install python-uinput

Next you will need to make it start at boot. First you will need to move the .service file

  1. sudo cp joyboard.service /etc/systemd/system/

Next make joyboard.py executable with

  1. sudo chmod +x joyboard.py

To make it start at boot run these 2 commands below

  1. sudo systemctl start joyboard.service
  2. sudo systemctl enable joyboard.service

Github link – https://github.com/facelessloser/joyboard

Video

Retropie demo

Python keyboard presses demo

Gerber files

Gerber files – https://github.com/facelessloser/zeroboy

Oshpark link – https://oshpark.com/shared_projects/BjnesmbI

Advertisements

4 responses to “ZeroBoy – A poor man’s retropie “portable”

  1. Pingback: Bare bones portable RetroPie gaming console with a Raspberry Pi Zero – Raspberry Pi Pod·

  2. Pingback: Bare Bones Portable RetroPie Gaming Console with a Raspberry Pi Zero @Raspberry_Pi #PiDay #RaspberryPi « Adafruit Industries – Makers, hackers, artists, designers and engineers!·

  3. Pingback: Zeroboy – A Poor Man’s Retropie Portable #piday #raspberrypi @Raspberry_Pi « Adafruit Industries – Makers, hackers, artists, designers and engineers!·

  4. Pingback: ZeroBoy: A poor man’s retropie “portable” – OSH Park·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s