I just got a Pimoroni Picade, an arcade mini-cabinet for use with small board computers like the Raspberry Pi. It's a great match for PICO-8!
See also a short video I posted to Twitter.
The cabinet is $240 / £180, not including the Raspberry Pi and power supply. The cabinet goes together with a screwdriver (no soldering) and is fun and easy to build. (Be sure to refer to the assembly video in addition to the written instructions.) The result is solid and gorgeous.
I used a RaspPi 3 for my Picade. I strongly recommend the USB audio adapter that Adafruit sells, a major improvement in sound quality over connecting the Picade speakers directly to the RaspPi headphone jack. RaspPi 3 has built-in wireless Internet, but if you're using an older model you'll also want a RaspPi-compatible USB wifi dongle.
- Raspberry Pi 3 Model B at Adafruit
- 2.4A power supply at Adafruit
- USB audio adapter at Adafruit
- USB wifi dongle at Adafruit (for RaspPi 1/2)
RetroPie is an easy-to-use software package of the best retro-gaming projects for the Raspberry Pi. It includes emulators for many platforms (arcade and home computers) as well as media center software, and a master menu called Emulation Station that you can manipulate using just the joystick and buttons so you don't need a keyboard connected once it's all set up.
Setting up RetroPie for Picade
I won't go through the RetroPie set-up procedure in detail. There are plenty of guides on the web, including at Adafruit. What follows are a few notes from my build.
Download the RetroPie image, in my case "retropie-v3.8.1-rpi2_rpi3.img".
Format an appropriately-sized SD card, at least 8 GB. I used a 32 GB card, which takes a while to format.
Write the image to the SD card. I have a Mac laptop and I used the command line to do this, as follows:
- Determine which disk device (e.g. "disk2") is the SD card.
diskutil list |
- Unmount the SD card, substituting "disk2" with your actual device name.
diskutil unmountDisk /dev/disk2 |
- Write the image to the SD card, substituting "rdisk2" with your actual device name with a "r" in front of it ("rdisk" instead of "disk"). This command can take a while.
sudo dd bs=1m if=retropie-v3.8.1-rpi2_rpi3.img of=/dev/rdisk2 |
With the SD card still connected to the laptop, edit "/boot/config.txt" (accessible on the Mac as "/Volumes/boot/config.txt"). Uncomment this line so that Picade's screen will work correctly:
hdmi_force_hotplug=1 |
-
Unmount the SD card then remove it from your computer. Put the SD card in the Pi, hook it all up, and supply power. It should boot to Emulation Station and let you set up the button bindings. I mapped the D-pad controls to the joystick, and took a guess at the six top, two front, and two right buttons. (The two left buttons are for the speaker volume and are not seen by the Pi.) This is easy to change later.
- From Emulation Station, go into the RetroPie menu and set up wifi. You'll need a keyboard connected to the Pi to enter your wifi password.
Once wifi is set up, select "show IP" from the RetroPie menu. You can use this IP address to connect to the Pi over the wireless network, transfer files, and make config changes. To get to a remote shell from your laptop, use the "ssh" command, substituting your IP address, and enter a password of "raspberry":
To copy a file to the Pi:
scp pico-8_0.1.8_arm.zip [email protected]:~/ |
- The USB audio interface needs to be configured from the command line. Guides like Adafruit's tutorial and RetroPie's sound docs get us started. Mine came up as the CM-Headphone type.
For Pico-8, we also need to fix an issue with playback speed. The solution presented here is to configure a virtual device that converts the sampling rate, then pipes it to the actual USB audio device.
Create or edit the file "/etc/asound.conf" to contain the following:
pcm.card { type hw card 1 } pcm.!default { type plug; slave { pcm card; rate 48000; } } ctl.!default { type hw card 1 } |
Reboot the Pi:
sudo shutdown -r now |
The Emulation Station menu plays sounds, and RetroPie comes with Doom pre-installed (see the Ports system menu). Test the audio. Use the volume buttons on the left of the cabinet to adjust as needed; it may start out too quiet to hear.
PICO-8 on the Picade
You can run the Raspberry Pi version of PICO-8 with this set-up. Copy PICO-8 to the Pi and unpack it into the ~/pico-8 directory:
# (starting from your computer:) scp pico-8_0.1.8_arm.zip [email protected]:~/ ssh [email protected] # (now on the RaspPi:) unzip pico-8_0.1.8_arm.zip |
On the Picade with a keyboard connected, exit Emulation Station (Menu button, Quit, Quit Emulation Station) to get a shell prompt, then run the pico8 command:
~/pico-8/pico8 -splore |
Controls, fullscreen graphics, sound, and Splore over the Internet should all just work.
Launching PICO-8 from Emulation Station
Of course, it'd be better if you didn't need the command line and a keyboard to start up PICO-8, especially since Splore lets you download and play PICO-8 games using just the joystick and buttons. I wanted the ability to launch PICO-8 from Emulation Station, as in this video. It turns out this wasn't too difficult, but it involves a few steps.
I made two versions of the PICO-8 logo, one with light text and one with dark text, based on the one I made for the PICO-8 wiki (which in turn is heavily based on the official logos). You can get these here:
On the Pi, create a new pico8 theme directory for Emulation Station:
cd /etc/emulationstation sudo mkdir themes/carbon/pico8 |
Copy the logo files to the Pi and move them to this directory. (You will need to use "sudo mv ..." to move the files into place.)
You also need to create a "theme.xml" file in this directory. Copy the one from .../themes/carbon/amiga/theme.xml, then edit it (such as with the "nano" editor):
sudo cp themes/carbon/amiga/theme.xml themes/carbon/pico8/theme.xml sudo nano -w themes/carbon/pico8/theme.xml |
Make these changes:
-
Replace all instances of "./art/controller.svg" with "./../amiga/art/controller.svg".
- Change the logo for the main system screen, using the dark text version:
<view name="system"> ... <image name="logo"> <path>./p8logo_dark.png</path> </image> </view> |
- Change the logo for the system detail screen, using the light text version:
<view name="basic, detailed"> ... <image name="logo"> <path>./p8logo.png</path> ... </image> ... </view> |
Now you need to add pico8 to the list of systems. Edit the system config file:
sudo nano -w /etc/emulationstation/es_systems.cfg |
Inside <systemList>...</systemList>, add these lines:
<system> <name>pico8</name> <fullname>PICO-8</fullname> <path>/home/pi/pico-8</path> <extension>.sh .SH</extension> <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 "/home/pi/pico-8/pico8 -splore"</command> <platform>pico8</platform> <theme>pico8</theme> </system> |
Emulation Station expects to find a directory of game files under <path> whose names have an extension specified by <extension>, so it can list them all in its menu and launch them individually. If you really want to use this feature with PICO-8 carts (and not use Splore), you could use <extension>.p8 .p8.png</extension>, <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 "/home/pi/pico-8/pico8 %ROM%"</command>, and an appropriate <path>. Every cart you put in your cart directory will appear as a menu option in Emulation Station.
For my configuration, I just wanted Emulation Station to launch PICO-8 in Splore mode. My configuration says to look for ".sh" files in the "/home/pi/pico-8" directory and create a menu entry for each one it finds. Emulation Station will not show the system in the main menu unless there is at least one such file. I created an empty file called "/home/pi/pico-8/+Start PICO-8.sh". When I select this option from the Emulation Station menu, it runs <command>, which in this case ignores the selected menu option and just starts PICO-8 with Splore.
Another way to do this is to make "/home/pi/pico-8/+Start PICO-8.sh" a real script that starts PICO-8, like this:
#!/bin/bash pushd "/home/pi/pico-8" ./pico8 -splore popd |
Don't forget to make the script executable:
chmod a+x "+Start PICO-8.sh" |
Change the command to <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 %ROM%</command>. This runs the script itself as the command when the menu option is selected. Doing it this way lets you add more items to the PICO-8 Emulation Station menu simply by adding more scripts to /home/pi/pico-8, such as to have multiple configurations (such as a non-Splore gamedev mode) or jump straight to your favorite carts.
Reboot ("sudo shutdown -r now") and you should now have PICO-8 in your list of systems. Select the PICO-8 system, then select the "+Start PICO-8" option. PICO-8 starts in Splore mode, and you can browse the BBS, play games, and add them to your favorites all using Picade controls. You only need a keyboard connected if you want to do text searches in Splore, or if you want the ability to exit to the PICO-8 command prompt or code editor.
Thanks!
I'm about to for a Pi + Picade screen into an old Macintosh Classic case. So essentially this setup.
Why did you use USB Wi-Fi? Doesn't the RasPi3 come with built-in Wi-Fi?
You're correct, RaspPi 3 has built-in wifi. I only mentioned it for earlier RaspPis. I edited to clarify. Thanks!
Good tutorial, can't wait to get my own arcade cabinet and get Pico-8 up and running on it.
Thanks for writing it up!
Nice one @dddaaannn, thanks for taking the time to write this up.
Does this mean you've managed to avoid the issue of PICO-8 "freezing" when exiting (via Splore menu), if it was launched from Emulation Station?
Or have not got to that part yet?
[Update 2016-08-11: The article now uses chris's suggestion of wrapping pico8 in runcommand, which solves the freezing problem. Discussion preserved below.]
@Liquidream: I can repro the freeze-on-shutdown problem with this configuration and I don't have a solution. There currently isn't a way to exit back to Emulation Station without a keyboard, and with a keyboard all methods of shutting down Pico-8 freeze as of version 0.1.8. This includes "shutdown pico-8" from the Splore escape menu, "exit to console" then typing the "shutdown" command, and pressing Alt-F4 at any time.
For what it's worth, the Pi is still running, and I can ssh to it and kill -9 the pico8 process. Doing so returns to Emulation Station. So I imagine it's a PICO-8 bug.
... More data points on the freezing issue:
-
If I quit Emulation Station and run PICO-8 from the command line directly, I can shutdown without an issue.
-
The freezing issue occurs whether <command> is "pico8" or "%ROM%" (with the startup script as described above). One thing I haven't tried yet is getting it to launch via the runcommand.sh script that other emulators use. As far as I can tell this just adds a runtime configuration shim for some emulators, but maybe it provides some necessary process fork feature?
- If I cause PICO-8 to freeze with shutdown, kill the process over ssh, and then quit Emulation Station, the keyboard is unresponsive. (No idea.)
A small correction: Picade does assign an Esc to a righthand button, so it is possible to open the Splore exit menu and hit the freezing bug from the console itself. If it worked, it would work just like exiting out of MAME and other emulators, so it'd be nice if it did. This also means that you have to disable or remap that button for Picade to be a proper PICO-8 kiosk.
Looks nice - I recently built a Adafruit PiGRRL and added Pico-8 to the Emulation Station menu (except the theming stuff yet).
I had trouble exiting Pico-8 properly as well. The way I solved it was to modify the stock runcommand.sh and store the command name of the launching process.
TCMD=`echo "$command" | cut -d' ' -f 1` echo "$TCMD" >/tmp/runcommand.cmd |
In addition I created a simple script called /opt/retropie/supplementary/runcommand/killcommand.sh with the following contents.
#!/bin/bash CMDFILE="/tmp/runcommand.cmd" if [[ -f "$CMDFILE" ]]; then TCMD=`cat "$CMDFILE"` TPID=`pidof "$TCMD"` kill $TPID rm "$CMDFILE" fi |
So this can act as a generic panic button that kills ES commands - it's a bit annoying to SSH in to the device or connect a keyboard for killing.
It requires a way to actually run this command. Since I'm using the Adafruit retrogame GPIO program, I added an extra kill key command that runs this script. Check an example commit for my fork on GitHub.
Thanks for the guide.
It took some fiddling but for anyone interested, the easiest way to solve the crashing issue with -splore is to follow dddaaannn's instructions but use this line for the <command> entry:
<command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 "/home/pi/pico-8/pico8 -splore"</command> |
Note both the 0 which is the run parameter and the quotes around the pico 8 command. Both are required. This will launch pico with the retropie wrapper.
Have fun :)
Once you "exit" Splore, just type CLS. It's just that the exit function doesn't do a clear screen, so all that's replaced is the few characters that appear on the prompt screen.
Thanks chris! I reproduced this and it works fine. I'll add it to the main article.
For those interested, Pimoroni have Picades again, plus there's 15% discount this week-end. It makes the Raspberry Pi 3 and 2.5A power alim almost free.
It's been days I'm both salivating and wondering about getting one. I must say that it's first with Pico-8 in mind, for both playing and creating stuff with added keyboard & mouse. With the hopefully soon to be delivered pocketCHIP, the Picade would make another nice Pico-Play&Create-Station. I'm into this stuff since only one week, but that Pico-8 and all this hardware stuff is quite exciting, I'm 14 again in front of my first Amstrad CPC computer!
But I still have questions only Picade owners can answer, so @dddaaannn, or anyone, I'd be really glad to read you :)
- The 8" screen is 800x600 pixels. As Pico-8 is 128x128, it should not go beyond 512x512 to keep a perfect pixel on this screen. I suspect it fits all 600 pixels height though, am I right? Does Pico-8 look a bit blurry, or is it really crispy?
- Did you swap the 8" screen for the 12" version, or are you planning to? A 12" would be nice, but I fear it would be too big for Pico-8 and make pixels look really huge. Unless you can tell Pico-8 its max resolution (as previous question).
- Once a keyboard and mouse is connected, can we make Pico games on the Picade as we do on a computer? I'm planning on buying wireless keyboard & mouse so that I can keep the dongle inside the Picade (the Pi 3 has 4 usb ports). Ideally a Logitech Unifying set so that it takes only one usb port for both keyboard & mouse, but it seems that's not easily working on Linux.
- My last concern is the screen tilt. Does it faces you well, or is it a bit too vertical? Do you feel you should lower yourself a bit to face the screen?
Thanks in advance for your replies, and for your tutorial above @dddaaannn. I have absolutely no experience in Raspberrys, Arduinos or Linux, so that'll be the most useful.
The photo at the top of the article is the 8" screen and demonstrates the aspect ratio well. It's crisp. You can pass arguments to pico8 for desired resolution but I didn't have to to achieve a good result on this display.
Yes you can use a Picade as a Pico-8 dev machine! You can connect keyboard and mouse to the RaspPi and run the cables through holes in the door in the back. I haven't tried a wireless Logitech with dongle in this specific instance, though I recall a while back that I didn't have too much trouble with a Logitech and a RaspPi. (I've lost my dongle or I'd test it. :) )
As for screen tilt, it's quite comfortable, especially for playing while seated. I haven't tried using it as a dev machine for an extended period of time, which might make a small difference since you'd be using the keyboard instead of leaning in for the joystick. In general the case is very well designed for a desktop unit.
Thanks @dddaaannn, your answers and the 15% discount on pimoroni convinced me! I just bought Picade + Raspberry Pi 3 + 2.5A alim. I didn't get the USB audio adapter yet, because they don't sell this. So I'll see once my Picade is ok, I'll get it on Adafruit, along with other stuff I may quickly feel the need for: a backlight marquee and LED lighted buttons. Let the Picade shine!
Very cool! The "Picade" top panel that it comes with does allow some light through, so that might also provide some options. I tried it with a flashlight to see what it'd take, but haven't done a mod yet. Post pics when it's done!
They were out of the Picade stand-up unit, so I got myself a Picade Console instead. Just got the controller part put together, now I'm configuring the software for RetroPie, and... wondering how to config an external screen to the Pi... I'll probably work on that tomorrow or something.
Still giddy af!!
PS: TFW you're asking yourself "so where's the fancy wiring between the board and the Pi?" and then after 10 hours at work, it hits you: "Try the microUSB cable, dumbass!"
Hi, I just completed assembling the Picade, installing Retropie and so on. I'm a noob on Linux and Pis but most things look fine. I only launched Pico-8 from the shell for now, will (try to) add it to the Retropie menu quickly.
But for now, I have a question about the numeric pad: none of its keys work in Pico-8. Even the numlock key won't change its state if I press it. But everything's ok in the shell though. Is this normal? Is there a way to get it back? Does that happen too if Pico-8 is launched via Retropie?
Not a very big deal though, I'd just like to know if my future wireless keyboard will have a numeric pad or not :)
Just got everything running in retropie. I'm new at linux, so I didn't know that I needed to set permissions on /home/pi/pico-8/pico8 to get it to run.
Trying to think of a way to be able to exit Pico-8 without having to use the keyboard. Is there a way to bind a command to the select button to do this?
One last thing that's pretty frustrating. I'm not getting any audio. Emulationstation works fine, just no audio when running Pico-8. Not using a picade, so I skipped the USB audio step. Just have a Pi3 hooked up through hdmi.
Tried setting hdmi_drive=2 in /boot/config.txt but that didn't work. Anybody else have this problem?
I got audio, but it's coming straight from the Pi jack (horrible hiss) and not HDMI. But everytime I launch pico-8 (or raspbian?) the sound volume is set at minimum. I guess you checked this?
Yep. Been doing a lot of trial and error.
As far as I can tell, I followed everything to the letter, but I have something weird going on.
In the command line, entering ~/pico-8/pico8 -splore will start Pico-8 with sound.
Running from an empty "+Start PICO-8.sh" with the pico8 - splore command in the settings cfg starts Pico-8 without sound.
Adding commands to the SH file and changing the systems cfg as instructed results in Pico 8 failing to load.
TLDR; Running from the command line gives me sound. Running from the ES menu doesn't.
I'm missing the permissions thing too, maybe that's why I can't get mine to load. But IIRC, as long as you're running it from RetroPie/ES, the "Start + Select" is a soft reset that exits whatever emulator is running. Try that.
/still setting this part up, too
Any tips on getting RP/ES to launch other Linux-native games in it's own list? I'm sure it's just a matter of extension .sh/.SH, right?
UPDATE: Did the permissions thing. Still can't get it to launch PICO-8. Either in Splore mode or via local carts in the ROMs folder. Adding "sudo" didn't fix it, either.
As @dddaaannn stated in is 1st post, the sound provided directly by the Pi jack is terrible, so I bought this USB adaptator which is also a 3 ports hub. The hub worked as soon as I plugged it in, but not the sound of course; yet I had hopes, that just shows I'm too much of a Windows user :). So I followed this tutorial to get sound.
It works well in Retropie, as well as the mp3 playing test, but in Pico-8 I have a strange problem that I had not when the sound came straight from the Pi jack: the sound is played at 200% speed. Any game sounds like it's sung by chipmunks on helium, unless I can double its "spd" value in the editor. Even the little sound that plays when Pico starts is played twice faster than normally. I'm launching Pico manually from the shell; didn't try launching it from Retropie as others like @HimsyPimsy has no sound at all.
Anyone else has that issue? I'm still trying to figure what to do, but it looks like a Pico bug and if so, I'm afraid there's little hope. If anyone has any idea, my Picode and I will be so happy!
[Update 2018-03-06: The USB audio issue has been fixed in the original guide. Discussions preserved.]
I can tell you that I have that exact sound issue and I don't have a solution yet. It's specific to Pico-8 in this configuration and not the other emulators. Pico-8 is playing sfx and music at a higher pitch and tempo of a fixed multiple, I think 400%.
Thanks for your reply @dddaaannn, I guess there's not much we can do then. A pity though as my main reason for the Picade was Pico-8. It's strange also that it happens only with USB (clear) sound, not with the Pi onboard (noisy) sound. The opposite would have been less a problem. I hope @zep may fix this.
Could it be a bug in the Pi version of PICO-8? That maybe sound processing is unrestrained, unlike the framerate? Or that it's processing sound in _update60() instead of _update()?
In fact, if it's exactly 200%, then I'll bet THAT'S what happened here.
I'm not even seeing a "pico8.sh" anywhere in the install directory, btw. Could this be the other problem (of launching it in Picade, I mean)?
Thanks for these instructions @dddaaannn, they were so helpful in getting mine set up.
Now if only the pico could be exited using the gamepad...
the instructions work great. i can't get the start button on my controller to work though. any ideas?
Hello, great tutorial, thank you very much.
I use a gamepad, and how exit to back in Emulationstation without keyboard ?
It's possible?
I'd be thrilled if EmulationStation/RetroPie came preconfigured with Pico-8 as a supported system, but I'm unlikely to be the one to add it any time soon. If you know your way around their repo (or know who to ask), I say go for it! :)
i'm not really sure how to do it, i'll try to search more when i have time,
but i don't think they would mind adding it to retropie, there is already a section featuring lots of indie games & clones (which isn't really emulation related)
Ahh so cool thanks for sharing, I want to make one and bring it to work :P
Someone has been able to list the carts for individual launch? i configured the es_systems.cgf file and i think i'm using the correct command (using the Terminal works) but i have only one game in the path folder for test and it seems that RetroPie can't recognize or find it :(
<system> ... <path>/home/pi/RetroPie/roms/pico8</path> <extension>.p8 .png .p8.png </extension> <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 "./home/pi/pico-8/pico8 -run %ROM%"</command> ... |
Nobody? btw, i forgot to tell that i have the latest version of Retropie (4.2), if relevant
Hi, @Gekko!
To achieve such a result I've put in my es_config file:
<system> <name>pico8</name> <fullname>PICO-8</fullname> <path>/home/pi/RetroPie/roms/pico-8</path> <extension>.sh .SH</extension> <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 %ROM%</command> <platform>pico8</platform> <theme>pico8</theme> </system> |
And then here's an example of .sh file (one customized for each game):
#!/bin/bash pushd "/home/pi/pico-8" ./pico8 -run /home/pi/pico-8/lua-pico-8-pong/pico-8-pong.p8 popd |
I think that your solution is more elegant, I'll try it and post results.
Was anyone able to quit PICO-8 from gamepad in Retropie?
It also works using this way:
(be sure to check all your paths with attention)
<system> <name>pico8</name> <fullname>PICO-8</fullname> <path>/home/pi/RetroPie/roms/pico-8</path> <extension>.p8</extension> <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 "/home/pi/pico8/pico8 -run %ROM%"</command> <platform>pico8</platform> <theme>pico8</theme> </system> |
Hi @Itpitt, thanks for your response! :D
Unfortunately i'm not having any luck with this :/
I tried both ways, made a recursive chown on the carts folder, and reread the retropie docs but i still can't figure why Retropie are not showing pico8 in the main menu :(
Maybe i'm missing some permission or addicional configuration?
Sorry I was a bit busy lately, @Gekko...
Did you solve this?
I can share my config files if that helps...
Hi @Itpitt!
No prob, i haven't been here in a while too. I just tried again with your last config posted and... it finally works!
Surely i made some mistake and since i was so stubborn i wasn't able to see it.
Now it's time to get some carts and enjoy them :P
Lot of thanks dude, really! :D
Yey!
It is a pleasure :D
If you want i also wrote an updater that pulls my games on Github and puts the new versions on Retropie so you can update your games without using keyboard :)
Where do the .p8 files go if I tell pico8 to save them? They aren't in the same directory with the pico8 binary!
BenMcLean: On Linux and RaspPi, carts are stored under ~/.lexaloffle/pico-8/carts.
In the context of the instructions on this page, note that some of the configurations discussed put carts in a different directory to be loaded when Pico-8 is launched by Emulation Station. That's a different deal and doesn't change where Pico-8 attempts to save carts.
Pico-8's cart location can be changed with the root_path configuration option. http://pico-8.wikia.com/wiki/Configuration
Thanks for the info! I want to make a proper setup where EmulationStation correctly recognizes cart files and adds them to the menu like ROMs for other systems, without needing to make an .sh for each one. Preferably, the carts should be living in /roms/pico-8/. After I've figured it out, I'll post a new tutorial :)
I haven't tried it but this should be as simple as using <extension>.p8 .p8.png</extension> in the config and changing root_path in Pico-8's config.txt. Pico-8 would launch in arcade mode, and you'd be able to use a keyboard to switch to the editors, make changes, and save back to the cart dir. New files would be available from the Emulation Station menu automatically. And naturally you could also match on .sh and have a menu option to launch Pico-8 without a cart with this same configuration.
Ok let's make this crazier...
Has anybody ever tried PICO-8 with a Gameboy Zero (Super AIO)?
Problems I have:
1) Super tiny resolution for PICO-8
2) Music and SFX going... Super fast?!?! :D
3) Key configuration problem (I think I can solve it in PICO-8 with key_config but I still have to try)
The music/sfx going too fast occurs in my set-up when using a USB audio device (and not the RaspPi's built-in audio device). I would love a solution but haven't had time to work on it myself. It's the last broken thing in the set-up I documented here.
[Please log in to post a comment]