Tag Archives: Raspberry Pi

Retro Man.

I’ve been meaning to put together a retro-pi for some time. My SNES is getting on and as much as I love the Vega and Mini-NES I haven’t got space for every retro system that kick-starter comes up with.

Over Christmas I started looking into it properly, and realised I’d actually got pretty much everything I need. For the price of a couple of USB controllers (4 quid on eBay for SNES or a tenner the pair on Amazon) and an HDMI cable I could set up a complete system!

I ordered the parts, put everything else together and waited for the postman…

Very little in life has made me quite this happy.

What’s more, having put the photos online at least four people have asked me how they can make their own – so here’s the tutorial!

What You Will Do:

You’re going to install a retro-game emulator called “RetroPie” to a Raspberry Pi. This will allow you to download and play games from a wide variety of systems up to the Nintendo GameCube. (While the software caters for consoles right up to the Wii, I’ve found it struggles with N64 – both Goldeneye and Ocarina of Time were unplayable).

How hard is it?

It’s very easy. The emulator is all pre-packaged and the parts all slot together. The most difficult part is tracking down the games to load on to the Pi once it’s all up and running, but I’ve been able to find everything I’ve looked for to date. Once you’ve found it, installation is as simple as plugging in a flash card.

You Will Need:

  • Raspberry Pi3  *
  • Raspberry Pi3 case. *
  • 16GB micro SD card.
  • USB game controller(s). (You can get most types, so pick your favourite.)
  • 2GB Flash drive.
  • HDMI cable.
  • 5V 2A micro USB adapter.

(*I actually used a Pi2 as that was what I had lying around. The only difference is that you need to also get a USB WiFi dongle as well. And a Pi2 case.)

Also to set up:

  • USB keyboard.
  • Laptop/PC with an SD card reader.


There are three stagesin the setup, and a fourth if you’re loading Spectrum games to ensure your controllers work OK.

Stage One: Prepare your SD Card

Plug the SD card into an PC or Laptop.

  1. If you’re using an old SD card then download an SD formatter and reformat it. (Make sure it formats to the correct size).
  2. Head to the RetroPie downloads page and click on the link for Raspberry 2/3.
  3. Download 7-zip (32 bit for Windows – there are separate links for equivalent Mac applications.)
  4. Open 7-zip, and find the RetroPie download from step 2. Click on EXTRACT. (This will convert your “RetroPie*.img.gz” file into a “*.img” file.)7zip
  5. Download Win32 Disk Imager.
  6. Open Win32 Disk Imager and find the RetroPie*.img file from step 4. Ensure that the DEVICE is pointing at your SD Card, and click on WRITEwin32di

Your SD card is now ready!

Stage Two : Prepare your Raspberry Pi

  1. Insert the SD card from Stage One into your Raspberry Pi. Put the Pi into the case, attach the HDMI cable to a television, plug in the USB keyboard, and one of the USB Controllers. Finally, attach the 5V 2A micro USB adaptor.
  2. Wait. The Pi will unpackage the RetroPie image for you.
  3. After a few minutes you’ll see a WELCOME screen come up. Hold down a button on the controller and you’ll enter the configuration screen. (Don’t worry if you make a mistake here – it can be corrected later on.) Follow the instructions to map your controller to the relevant functions.retpiwelc
  4. When you see the RetroPie menu appear, select it (this is button A on a SNES controller), and then select the WIFI option. Follow the instructions to select your WIFI network and provide your password.
  5. Connecting to WIFI will make it easier to make updates to your system from your PC or Laptop over SSH via Putty or a similar application. This avoids the need to have the keyboard plugged in the whole time. (The RetroPie menu also has an option that confirms your IP address).
  6. You can attach any additional controllers at this point. If you press START button then you will find the option to CONFIGURE INPUT, which will allow you to re-map your controllers at any time.

You’re now ready to import some games!

Stage Three : Loading games

Retro games are stored for emulators as ROMs. RetroPie doesn’t ship with any provided as there is a legal grey-area here. In theory you should only download games that you already own.

This is potentially the most frustrating part of the process. You will find that there are some sites you prefer over others, and you’ll sometimes need to try two or three different sites and/or downloads before you find one that works. It does get less frustrating with time and experience, though.


I’m going to try to find Little Big Adventure. I’ve typed “Little Big Adventure Playstation rom” into Google, and I’ve avoided the first two sites that have come up. The third appears to be a dial-up connection from Mongolia or somewhere, but it’s working.

While that’s downloading:

  1. Make sure that your USB flash drive is blank, and formatted to FAT32 or NTFS.
  2. Create a folder called “retropie”
  3. Plug it into your Pi.
  4. After a minute you can remove it and plug it into your PC, where you’ll find the retropie folder now contains a folder called “roms” which in turn contains directories for all of the systems that are supported.
  5. Check the download folder for the ROM that we downloaded above. There will usually be a zip folder. In this case it’s an RAR which I can extract via 7-zip (see Stage One). This has generated one BIN file and one CUE file, which are good for Playstation.
  6. We need to copy the files to the correct folder on the flash-drive. For Playstation, that’s psx. lbaflash
  7. NB – whenever copying new files to the pi, I recommend deleting any other ROMs from the flash-drive. I’ve found these tend to over-write any existing copies of the files, which means you then have to reload the metadata.
  8. Once the files have copied across, remove the flashdrive from your PC and attach it to the pi. Allow a couple of minutes for the files to port across.
  9. Remove the flash drive, press start, and reboot.
  10. You’ll find there is now a Playstation option on the menu bar! Selecting this will show you the new game file, and selecting again will load the game!
  11. Press SELECT and START at the same time to close out of the game and return to the Playstation menu.
  12. Press SELECT and then EDIT METADATA. Click on SCRAPE. Hopefully your game will come up automatically, (otherwise it may be necessary to click on INPUT and play with different word combinations to force your game details to come up.) Select your game and SAVE!


Repeat Stage Three for as many games as you want to load into the emulator!

At this point the main use for the keyboard is to input details when searching for metadata, so you can put it away until needed.

Stage Four : Controller configuration for Spectrum games

If you’re not going to download any Spectrum games then you can skip this stage.

Some games (like Manic Miner) work fine straight away. Others I’m finding do not. When this happens, try the following:

  1. Load the game.
  2. Hold down SELECT and X
  3. Select Quick Menu
  4. Select Controls
  5. Cycle through User 1 Device Type to Kempton Joystick (ooooh the feels!)
  6. Select Save Game Remap File (NB -make sure you select GAME and not core.)
  7. Press B to go back one menu
  8. Select Resume

This usually seems to resolve any issues, and the system remembers the setup the next time you load the game.


And that’s it! Answers to any additional questions are usually available from the RetroPie site, and MagPi magazine has had a number of innovative projects that embedded a Pi Zero actually into the controller if you want to get really flash.

Knock yourselves out!



It’s about time.

Raspberry Pis remind me of the early days of the ZX Spectrum. There’s that same excitement at learning your first bit of code and realising that a whole world just opened up for you, only this generation isn’t going to re-create Manic Miner. They’re learning to make computers interact with the world around them. I wanted to join in. But what to code? Soon after the Pi was first released I copied a game written in Python from a magazine. (Boy did that take me back…) It gave me a taster of some of the syntax but didn’t offer much scope for hacking. And games felt a long way short of the possibilities that the Pi was offering. The next thing I knew, everyone was building robots without any obvious intermediate step! I have small children! I didn’t have time to build a robot! The peripherals weren’t providing any great ideas, either.

Inspiration finally arrived in the last edition of MagPi (#42 Feb 2016). They had some code to let you turn one of those 8×8 LED displays – that I’d never previously seen the point of – into a binary clock. So I did. Then I created one in Excel using VBA. No-one was terribly impressed. They couldn’t read binary. They also made clear they were actively opposed to learning.

There was only one thing for it. I was going to have to build an actual clock.

You will need:

One of my favourite things about this project has been working out how to use the 64 pixels most effectively. The binary clock included the date as well as the time, but even then had masses of wasted space. I wanted no dead-space, and ideally something a little more visually arresting, but with only 64 pixels to play with I needed to be creative.

To force denominators of 60 I started by dividing the LEDs with a cross, 2 pimage001ixels wide. That reduced the circumference of the display to 20 pixels. My second-hand would just need to complete three circuits for every minute. The cross also reduced the ring inside to 12 pixels, each of which would represent 5 minutes. Ring three bisected the cross in order to provide 12 pixels for the hours. By starting counting in the top-right quadrant* it meant that I’d be presenting the time in the same format as it would appear on a standard clock-face. I also wanted to ensure that the cross was not dead-space, so I decided to make it a sort of AM/PM indicator. It would start off a dark-blue at midnight, which would change imperceptibly (minute by minute) over the course of the day to a light-green at noon, and then back again.

I kept things simple for my first pass, with each pixel individually defined. The seconds gradually filled their circuit, changing colour with each pass. There were five different colours of minute pixel, indicating which of the five minutes it currently was. The cross wasn’t changing colour correctly but that aside I’d done it! My first Python program! Here it is! analog_clock

It’s far from elegant but starting like this has several advantages. It means I don’t have to grapple with too much new syntax at once. I’m also used to a much more linear style of coding, so as I get to grips with this more modular approach it helps to know I’ve got everything in the right section and am working from a functioning base before I start building the complexity. Quite aside from all that, psychologically it always helps to be able to see progress as well, and it means you get a feel for which ideas worked better in your head than reality.

The next night I started working to remove the repetition from the code, one function-definition at a time. The main challenges here were the layout of each data-type (small-squares-with-gaps didn’t lend themselves to simple loops) and the order of logic functions. I replaced the seconds with a single pixel that moved around the perimeter, and also decided that the one-colour-per-minute idea didn’t work terribly well, ditching them for a single colour for minutes 1 thru 4 on each pixel.

By the time I finished I’d reduced the file size from over 9kB to under 3.5kB.

There was just one problem left to resolve: the central cross still wasn’t changing colour as it was supposed to. The theory was pretty simple: I knew the Red/Green/Blue values that I wanted to see at mid-day. I’d adjust them each minute, proportionate to the change required to reach the RGB value I wanted to see at mid-night. The colour was changing, but not gradually. The cross was green in the AM and blue in PM. PRINTing out my ratio calculations to the terminal confirmed that my calculation wasn’t returning a ratio, but either 1 or 0. It was rounding up. I’ve (hopefully) made it sound pretty clear here, and in truth it was. If I hadn’t got bogged-down in checking my syntax and calculations then I’d probably have solved it long before 3am. A quick internet search introduced me to the FLOAT function, and two minutes later it was working.

Here’s the finished code! analog_clock_2-3 It just needs to be copied to Notepad, and saved with a .py suffix to your pi directory and it’s good to go!

Here’s what 10:47pm and 2:37pm look like!



(The LED brightness makes it difficult to manage a photograph does justice to how the thing looks in real life.)

An additional bonus: my six-year-old daughter and I today wrote her first bit of code – playing with the positioning and colouring of an LED on the display – on the back of having played with the colours in the clock code!

I sometimes struggle to find information online that applies to someone of my experience level and free-time so who knows, this may be of interest to someone. On the off chance anyone stumbles across this blog then feel free to use and play around with the code as you see fit. Let me know how you get on!


NB: I’m entirely self-taught. My code would doubtless cause a trained Python dev to splatter comment sections with terse self-importance at my abuse of correct process and form.

That said, I welcome good-humoured, constructive feedback and suggestions as for improvements.


* The inner/hour square on the diagram is incorrect  – it should show the 1 where the 12 is, and the rest of the numbers shifted accordingly.


8-Feb-2016 : Corrected spelling of kernel