Retropie Minicade Journey


  • Member

    Started working on my own little retropie minicade this weekend. Got the enclosure cut out and the software running on the rpi3 so far. For this first prototype I plan on running it as a SNES system with the help of a raspberry pi 3 & arduino uno as a microcontroller for the key mapping.

    The sanwa buttons really add a nice touch on it. Thanks to Grant I understand the power circuit a little more, after asking a bunch of people I think I’m going to gut an old Iphone/Ipad wall plug for the 12v-5v converter as I don’t know if I trust the little usb car charger I got over extended usage. Anyways, here are a few screenshots of my progress so far.

    I’m really enjoying the project, I plan on making more of these babies in the future. Once I figure out this prototype, the next one I want to make a PSX specific system with a clear acrylic/plexi enclosure with a color tint, colorful LED setup, coin slot & full out graphics on the box.

    1. (IMAGE DUMP - RETROPIE SOFT. SETUP - ENCLOSURE LASERED + SCROLL SAW SCREEN MOUNT SUNDAY JAN 8 )

    0_1484120825887_15978099_10155037038241122_194148090845849714_n.jpg

    0_1484120844907_15895209_10155037038341122_8016580943543193242_n.jpg

    0_1484120853819_23123.png

    2. (SCREEN TEST MONDAY JAN 9 - USING 3.5mm TRRS jack for audio & video)

    3. (WIRING DONE FOR THE GAME CONTROLS - ARDUINO UNO PROGRAMMING WIP) JAN 10

    0_1484120969199_333.png

    4. Enclosure finished and minor setback

    0_1485078670525_Untitled-1.png

    At this point I scrapped the uno and got myself a leonardo but the enclosure is finally completed. I have the power supply left to wire up and a few buttons to as well. everything should fit inside with not much extra room. The enclosure is done and definitely a bit beaten up (Dave knows my frustration with this thing). It could of definitely been a lot better, but I’m really happy with it at this point because I can test everything properly.

    ~ derpko/chris



  • cool


  • Member

    This post is deleted!


  • I am interested in make such things.



  • Even the smallest / cheapest computer power supply is a better 12V/5V source than a phone brick. It’ll have clean power, and proper cooling. Put it in the bottom of the arcade console, and it’ll help stabilize it (low center of gravity) and can be set up to pull air through the console to cool the other components.

    Most of my problems with the Pi have stemmed from crappy power.



  • The other thing I have found with using quite a few pi 3’s around the mill is that the microsd cards are quite easily corruptible if for any reason they’re not shut down properly. What we’ve found is that you can use the micro-sd for your boot partition and then install the same image on a usb flash drive and update the cmdline.txt at the root of the sd card to boot off of the usb drive ie: root=/dev/sda1 or whatever it is. We’ve had next to no issues with pi 3’s since we’ve started doing this.


  • Member

    As long as you don’t pull the SD card before powering down it should be ok. Also I found a mini ATX budget power supply that Ron pointed me to that has 3.3, 5 and 12v so I figured that out. Also found a trrs jack at the space thanks to John. So my project is on its way!!!


  • Member

    The 3.5 A/V jack confused me a little at first but I figured out the pin-out eventually and got the audio and video working it. The actual retropie/raspian OS don’t really display nicely at all on the 640p composite screen but thankfully the roms themselves do (my guess is they were meant to run on that res). I think tomorrow I might take a break from the space & setup all my key mapping as well as program the arduino to read them.

    Here’s a quick teaser of what’s to come (screen test):



  • Pay no attention to the Ron_ Ron in the background!


  • Member

    @Ron_Ron who??? :)


  • Member

    Finished wiring the main controls (2 small 12mm buttons left to drillpress a hole for as well as place somewhere on the enclosure.) I’ve now moved on to trying to find / edit an arduino program to run as USB keyboard. From my understanding I need to flash some sort of firmware before I’m going to be able to achieve this. Otherwise today was more of a relaxing session just soldering away the controls.

    Going to glue/bracket up the enclosure tomorrow hopefully and have most of it finalized.

    0_1484120031307_15975091_10155037026356122_3419785207372237478_o.jpg

    so much less of a mess than trying to solder those dental floss sized trrs wires last night lol, not to mention all the crap they were coated with.


  • Member

    So @n0pe and I think we ALMOST have this script working for my arduino UNO R3 (SMD version) working as a HID USB KEYBOARD interface by flashing the mega16u2 (firmware flash and keyboard hex flash). We think the problem probably lies somewhere in the program we wrote for the arduino. I got a script working where it can type random keys at a certain interval, but couldn’t get my actual joystick or buttons to type anything in Windows.

    The arduino does show up as a HID KEYBOARD in the device manager but fails to “type” anything for the keys we have assigned. Our process to setting up the UNO has been the following.

    1. Force UNO into DFU by jumping 2 pins
    2. Writing the uno usb hex firmware via FLIP
    3. Cycle power
    4. Compile the script to the uno (not in DFU mode) *successful compile as far as we know (has worked for a similar script)
    5. Cycle power
    6. Force UNO back into DFU
    7. Flash keyboard hex firmware via FLIP
    8. Cycle Power
    9. Test program

    No actual way to figure out what we did wrong really other than knowing the arduino is being detected as a keyboard. No response from pressing any buttons on the gamepad controls. I’ll paste the code, hopefully someone who is better within the arduino IDE can help us!

    Here is the program we attempted to write (don’t mind the comments they are from a similar script and not what I want to achieve)

    http://pastebin.com/AcHk2LtG]

    *****SPACED out the 8 ) to dodge the emote


    Arduino USB Keyboard HID demo

    uint8_t buf[8] = {
    0 }; /* Keyboard report buffer */

    #define PIN_B 0
    #define PIN_A 1
    #define PIN_RB 2
    #define PIN_LB 4
    #define PIN_Y 5
    #define PIN_X 6
    #define PIN_LEFT 8
    #define PIN_DOWN 9
    #define PIN_RIGHT 11
    #define PIN_UP 12

    int state = 1;

    void setup()
    {
    Serial.begin(9600);
    pinMode(PIN_B, INPUT);
    pinMode(PIN_A, INPUT);
    pinMode(PIN_RB, INPUT);
    pinMode(PIN_LB, INPUT);
    pinMode(PIN_Y, INPUT);
    pinMode(PIN_X, INPUT);
    pinMode(PIN_LEFT, INPUT);
    pinMode(PIN_DOWN, INPUT);
    pinMode(PIN_RIGHT, INPUT);
    pinMode(PIN_UP, INPUT);
    // enable internal pull-ups
    digitalWrite(PIN_B, 1);
    digitalWrite(PIN_A, 1);
    digitalWrite(PIN_RB, 1);
    digitalWrite(PIN_LB, 1);
    digitalWrite(PIN_Y, 1);
    digitalWrite(PIN_X, 1);
    digitalWrite(PIN_LEFT, 1);
    digitalWrite(PIN_DOWN, 1);
    digitalWrite(PIN_RIGHT, 1);
    digitalWrite(PIN_UP, 1);

    delay(200);
    }

    void loop()
    {
    state = digitalRead(PIN_B);
    if (state != 1) {
    buf[2] = 13; // Volume up key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_A);
    if (state != 1) {
    buf[2] = 14; // Volume down key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_RB);
    if (state != 1) {
    buf[2] = 15; // Mute key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }
    state = digitalRead(PIN_LB);
    if (state != 1) {
    buf[2] = 18; // Volume up key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_Y);
    if (state != 1) {
    buf[2] = 128; // Volume down key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_X);
    if (state != 1) {
    buf[2] = 12; // Mute key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }
    state = digitalRead(PIN_LEFT);
    if (state != 1) {
    buf[2] = 4; // Volume up key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_DOWN);
    if (state != 1) {
    buf[2] = 22; // Volume down key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    state = digitalRead(PIN_RIGHT);
    if (state != 1) {
    buf[2] = 7; // Mute key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }
    state = digitalRead(PIN_UP);
    if (state != 1) {
    buf[2] = 26; // Volume up key
    Serial.write(buf, 8 ); // Send keypress
    releaseKey();
    }

    }

    void releaseKey()
    {
    buf[0] = 0;
    buf[2] = 0;
    Serial.write(buf, 8 ); // Release key
    }


    @pierre @arasbm @dhylands @Ron_Ron

    Calling for help :) thank you!!


  • Member

    @n0pe UPDATE IT WORKS BUT NOT EXACTLY — the SOLUTION was that I needed to be on an older version of the arduino IDE. We were compiling from 1.6x for windows and I switched to v1.0.5 R3 and I know have INPUTS typing keys although they are being as a CONTINUOUS key press and not a just when the button/joystick makes contact.

    I think this is a much simpler problem to solve although once again I don’t have enough knowledge about compiling programs to the arduino.
    WE ARE ALMOST THERE!!!




    EDIT: it’s continuously spamming the inputs after i press any other input even if I unplug all my pins. PIN spacing is due to my male header pins being messy, need to redo them tomorrow!


  • Member

    possibly something to do with debounce ?
    https://www.arduino.cc/en/Tutorial/Debounce



  • This is great. I would expect that since it’s supposed to act as a keyboard it should behave the same way as if you were holding whatever key on a regular keyboard ie: place one letter, wait a second, then repeat the same letter at the OS’es repeat rate.

    The other thing, I was thinking @derpko is that maybe we need resistors between the button’s line(ungrounded) side and the power source. Are the inputs being reliably pulled back “up” after the keypress is let go? In my experience it’s better to have a solid high and low signal than to have them float in la-la land neither grounded or at 5V. Someone with more experience may correct me.



  • yes yes there ls that also. To tie it up.


  • Member

    @Ron_Ron @n0pe


    So basically I need to put 10k resistors on every single button INPUTS wire and another one as well on the GND?



  • Just one on each button to pull up the coloured wire on the line side of the button when it is not grounded(pressed).

    Like this diagram shows:

    http://imgur.com/a/lfRwK

    Your circuit will follow the path of least resistance. So when not pushed the path is shortest through the 10K resistor to the 5v source because the button is not connected to your ground lead. Once you press the button it will connect to your ground lead and it has a choice of going through the 10K resistor or straight to ground. The path of least resistance is to ground in that case as there is no resistor. This way there is no floating voltage on the button. It’s either 5V or ground.



  • Here’s a link that will explain it better than me as well:

    https://learn.sparkfun.com/tutorials/pull-up-resistors


  • Member

    Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

    External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

    PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.

    SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

    LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.


    Was looking at the documentation on the UNO R3 SMD - Someone told me to make sure all the pins I am using 0-12 basically are able to be used as internal pull ups – PS can anyone guide on how to include a debounce function into my program?


    Is there a special way to activate the pull up pins on 0 & 1 since those are originally meant for TX & RX? From what I understand those are supposed to be analog pins by default?


  • Member

    So Darren and I decided to scarp the whole UNO microcontroller because it’s too much of a troubleshooting nightmare. We ordered ourselves some Leonardo boards instead to make everything a lot simpler - a break from this project will be nice!


Log in to reply