Showing posts with label Raspberry Pi. Show all posts
Showing posts with label Raspberry Pi. Show all posts

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.

Sunday, 10 June 2018

ZXBaremulator - Bare metal ZX Spectrum emulator for Raspberry Pi

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

ZXBaremulator is a bare metal ZX Spectrum emulator for the Raspberry Pi by José Luis Sánchez , and something I have been meaning to look at for a while.
This runs directly on the Raspberry Pi, using it as a single board computer, rather than a linux box (in a similar way to the RISC OS Pico I used with the Acorn Electron). Without any operating system in the way, it boots within a few seconds of powering on, and you are greeted with the familiar copyright notice.
From here, you can type away and run BASIC programs.
Press ALT+K to see a cheat sheet of all the keys available.
As nice as that is, you're probably going to want more. Press F1 and you get a menu that allows you to select tap or tzx images (but not z80 it seems).
Once one is selected, you press F1 to go back to the Spectrum, and type LOAD "" as usual.
The tape image then loads as normal (although it is speeded up a bit).
After a short while, the game is loaded and you can play to your hearts content.
CTRL+break resets the Spectrum, and you can then go and select another game.
You can also select 48K, 128K and +2A using ALT+F2, F3 and F4,
I have been running these for a while, through all my usual test titles and it seems to be running well.
Even passes all the diagnostics tests in 48K and 128K mode.
The only issues I found were the top and bottom of the screen, on power on, the top line appears to have a small section missing in the top left.
After selecting a program to load, the gap at the top is gone, but there is now a thin blue line along the bottom of the screen.
The other issue I had was lack of sound, I think that is because I was using version 2.0 of the software. V3.0 apparently has sound, but doesn't work on the Pi Zero.
One of the reasons I wanted to look at this was to check compatibility with my ZX Spectrum USB keyboard kits. I have been using these for many years, mainly with the Fuse emulator, so I expected it to work.
All seemed fine, until I tried to type LOAD "". It seems that symbol shift wasn't being recognised. I had seen a similar issue with an unusual emulator for older Macs that used the right alt key for symbol shift, rather than either control key, as most other emulators use. However, I had been using ctrl+p on a standard USB keyboard during testing.
After further investigation, it turned out that when my Spectrum USB keyboards are switched into emulator mode, I was only sending keypress codes for the shift keys. This isn't an issue normally, and was required by another unusual emulator someone was using. When I set it to send the key as both a keypress and a modifier, it started working.
The ZX Spectrum USB keyboards come with a button on the back to change between modes. In the 'normal' or 'desktop' mode, the keys are remapped to be most useful. Caps lock + keys on the top row give some extra functions, which are handy for starting and selecting games in an emulator for example.
I have produced a revised version of this which includes keys used by ZXBaremulator, F1 to load the menu, Alt+F2/3/4 to select a machine, F8 to stop and start the tape. I've used caps shift+enter to show the keyboard shortcuts, and caps shift+space to reset the Spectrum. Those are all available in the normal mode, press the button on the back to enter emulator mode, where all the keys are passed directly to the Spectrum, and press the button again return to the alternate layout and use the extra keys.
I have build many versions of the 'Raspberry Pi inside a ZX Spectrum' over the years.
These often involved extra power boards and cables, and with the Pi zero, usually a USB hub.
Today, however, I went for a more basic approach. There are many ways to mount a Pi zero, but you could just use a sticky foam pad.
There is an option to use the 4 pin header to wire up the USB keyboard, but you can just use a right angled cable.
The ZX Spectrum USB keyboard kits are available from my Tindie store.