Showing posts with label Picade. Show all posts
Showing posts with label Picade. Show all posts

Saturday, 9 February 2019

USB Arcade Controllers

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Last  year I built a Picade kit from Pimoroni, it's been great and has had a lot of use by me and my nephews.
The only thing I had an issue with was the buttons and they way they were mapped, the joystick is the cursor keys, which is fine. The keys on the side and enter and escape, which is also fine, but the buttons on the top and the two on the front are mapped as shift, control, alt, z, x, o, i and space, which didn't really make sense and confused a few emulators which used those keys for other things.
I missed the clicky sound of microswitched buttons, so decided to fit some to replace the original low profile switches. They are the same diameter as normal arcade switches, so it was a simple job to swap them over.
I ordered some standard microswitched arcade switches (from arcadeworlduk) and wired those up.
I had ordered a selection of colours, so I colour coded the wiring, with two wires for each switch rather than a common ground.
I also took the opportunity to solder in and heatshrink the wires on the power button as the crimp tags felt a little loose.
I arranged the new buttons to try to match the colours of other four and six button arrangements - the blue and purple are more distinct that they have come out in the photos.
It was all a bit of a tight fit, getting in those six buttons, and four black buttons around the base of the case, but it all fell into place in the end.
Since the button usage was now more consistent, I used the stickers supplied with the Picade kit to label up some of the buttons. Did I get it right, are there better arrangements?
With all of those wired up, it was time to plug them in. I think by adjusting the setup script on the Pi I should have been able to map these to different keys still using the Picade X Hat controller, but decided to go a different way. I have found in the past the best option with Retropie was to use a game controller with lots of buttons and dedicated start and select buttons.
This is the replacement board I designed, it is a USB game controller with inputs for a 4 way joystick and up to 8 buttons.
Each of the inputs has it's own ground connection along the bottom of the board, all are switched to ground, no multiplexing or keyboard matrix is used here.
The original joystick was microswitched, so I left that as is. It was on a connector with 5 pins on, so I fitted a matching 5 pin socket. The buttons are connected to eight 2 pin headers, each with it's own ground. It could have been wired with a single ground wire, but it's neater and easier to swap things around using a 2 pin cable for each button.
That mounted nicely on the side of the case. The power switch and power LED are left wired to the Picade controller as before. With that connected and RetroPie reconfigured, it seemed to work a lot better with two buttons on the controller dedicated to start and select (the two on the front) and the 6 action buttons as X Y A B, left shoulder and right shoulder..
The two buttons on the sides of the case were setup originally as Enter and Escape. This seemed sensible, so I left those plugged into the Picade X HAT controller.
I had thought I might need to add more buttons, so I also designed an extension board, which has 64 inputs to act as 64 keys on a USB keyboard. As before, these are all individual inputs switch to a common ground.
That would allow individual arcade buttons to press any key you want, such as keys for coin up, player selection, F1 or F12 for menus, any of the letter or number keys etc. You could wire up a joystick to WASD, or to 5678 for Spectrum fans or anything else you can think of.
These are plug in and go, just wire a switch between any of the ground pins and "A" and when you press the switch it will be like you pressed "A" on a normal USB keyboard. I can see this would also be useful for creating those massive controllers people have for flight simulators etc. or adding buttons for menus, changing games, coin up etc.
These boards are available from my Tindie Store, with or without the keyboard extension.
In the usual DIY kit form with the built, programmed and tested controller board, mounting pillars and a USB lead.

Sunday, 19 August 2018

Pimoroni Picade build

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

Behold the new Picade from Pimoroni (for the record, I am pronouncing that Pie-cade from Pim-moroni, but you can please yourselves).
I've been tempted to build a table top arcade type thing for a long time now, but when I saw this, and it was on an introductory offer, I couldn't resist and ordered it straight away.
I wouldn't normally mention packaging, but this kit is really nicely presented. Each selection of parts is in it's own box, all coloured to match the theme.
There is also a massive poster with the instructions on the back, which is a nice idea, but a bit unwieldy to work with, a smaller booklet or a PDF version would probably have been easier to follow.
The parts are all pre-cut, pre-drilled, pre-painted, and just need bolting together, so it didn't take too long for me and my little assistant here to put it all together. The only issue we had was working out which screws to use for each bit, as they weren't labelled, and we either missed some or they supplied too many.
Pimoroni have rolled their own display board, which bolts neatly onto the back of the display. A nice 8" 1024x768 panel, slightly smaller than their previous Picades, but a higher resolution. And also the proper 4:3 aspect ratio, as it should be.
That is powered via USB with an HDMI input, the panel flat flex fits in the top, and there is a small button board which connects with a second flat flex and is mounted on the back (although I didn't need to use any of the controls on there).
I'm doing my best here to avoid scratching the LCD panel and the perspex screen, or getting fingerprints all over it. The screen, marquee at the top and the control panel have paper inserts with the artwork on, so you could print your own if you wanted to customise your Picade. (templates are available on their github)
The control panel is all setup to just push in the buttons and bolt on the joystick unit. The joystick is microswitched, an all in one units with a single connector to make wiring up easier.
The buttons are the low profile ones, which don't quite have the same feel as a clicky microswitch. They are standard size, so I may end up swapping them out at some point. (see update below)
The buttons are all handled via GPIO to a custom Pi hat, the Picade X HAT, which also contains an audio amplifier and soft power switch control for the Pi. There is no provision for a volume control on the hat, and it is quite loud, so maybe their install script could set the volume to 50% before starting, or add some volume buttons?
The connections are all 0.1 headers apart from the speaker which is a type of connector I hadn't come across before, and didn't get on well with. Apparently you are meant to just push the speaker wires in, but I couldn't get them to stay in place. Not a fan of that, but I can see they were trying to avoid screw terminals or things like that.
I'm also not a fan of the new Pi packaging with just a cardboard box. It feels wrong without an antistatic bag, but that's apparently how they ship them these days. (update: apparently it is ESD cardboard, still feels wrong through). The arrangement for attaching the Pi was a little fiddly (it took three of us!) it would maybe have beeen easier with male-female standoffs for the Pi rather than long screws and spacers.
The Pi isn't included with the kit, so you need to supply your own, and your own microSD card. They recommend RetroPie, as would I, so I downloaded that and set it writing to the SD card whilst we finished the build. You also need a power supply, and one of the official 2.5A power supplies is recommended.
The rest of the wires from the buttons and joystick pushed into the 0.1" headers with no problems as you may be able to see from this terribly arty terrible photograph.
And that was it put together, it took a couple of hours, ably assisted by my Nephew, who quite enjoyed building something more than his usual Lego. Then came the fun part, lets plug it in.
First off, I got nothing on the screen. I wasn't sure if I had switched in on right, as the power LED wasn't very bright (shouldn't be a problem normally I had just picked a very rare day with sunshine). Checking the Pi, the lights were on, but there was nothing on the display. I tried various things at this point. Everything worked separately, just not together. It seemed it needed a bit of help detecting the HDMI screen, so uncommenting 'hdmi_force_hotplug=1' in the config file fixed it. Right, it's booted, time to run the script to install the Pimoroni settings.
Ah. Not good. Segmentation fault? (and it's my turn for a self portrait, the screen is quite reflective on camera, but you don't notice it much when using it). I think what had happened is when I wasn't sure if the power was working I might have turned it off again during the first boot when it resiszes the partition? Anyway, I wrote the card out again, and that worked fine.
Sorry the photos on here are a bit rubbish, I didn't have much of a chance to take them, and I'm not going to get much of a look in now my Nephew has taken the controls.
A couple of suggestions, for future versions. It seems the power to the LCD panel is slightly delayed as it is powered via USB from the Pi, this caused the problem with initial detection. It would maybe be better to add a USB socket (or better, a custom power connector) to the Pi Hat to power the LCD direct from the switched power supply. That would also free up a USB port on the Pi (not that you need them), but would also save power going through the GPIO header into the Pi and back out again.
I also have some issues with the key mappings. The GPIO wired buttons are mapped to the keyboard, as things like space, shift and control keys, and the 4 buttons around the side the escape, enter, two letters (I think they were i and o, where 1 and 5 would have been more useful for MAME). That didn't quite make sense, and I had a few goes at mapping the buttons to avoid the buttons triggering other things in the various emulators on Retro Pie (i.e. the NES one kept going into a fast forward high speed mode). I think I might be installing one of my USB game controllers in there instead, so I can map the keys without conflicting. (see update below)
Oh the whole, a very nicely presented kit, that can be built in an afternoon with minimal tools (and optionally, the assistance of a small child), and I am sure will keep us all entertained for some time. You can build it as intended, as I have done here, but there is a lot of opportunity for customisation (there's even seen one with a full RC2014 system fitted into it, but that's another issue). The introductory offer price has finished, but the normal price is still pretty reasonable, under £200 all in.
https://shop.pimoroni.com/products/picade

Update:

I have now fitted standard arcade buttons with microswitches, and designed a USB Aracde Controller and fitted it to my Picade.
That maps the buttons and the joystick as a USB game controller and that is working much better with RetroPie.
Available from my Tindie store, with or without an extension that adds 64 more individual key inputs mapped as most of the keys on the keyboard, for those really massive arcade controller builds.