Tiny Software for TinyPi

So your TinyPi is all built, but your going to need something on that SD Card for it to really shine!!

I have made a basic RetroPie image for speedy deployment. It can be found here and is basically a simple RetroPie image modified to use the screen and the buttons.

There is a TinyPi edition of PicoPie in the pipes, and as soon as it is available I will update this guide. Until then, you can build your own using raspbian lite as its base, and following the same guide below.

So if you want to make your own build, I will guide you down the rabbit hole 🙂

Your first job is to go and get yourself a base image. You can try here for RetroPie, or here if you want Raspbian Lite for some pico-8 goodness.

Once you have downloaded the image, you need to ‘burn’ it to the SD Card. There is much more info here and its probably best to let the pro’s explain it!!

Now your SD card is ready, you have 2 options. You can either reach for a keyboard and monitor and connect to the pi directly, or use SSH to control your TinyPi remotely. The rest of the commands in the guide will still work in the same way. Now the keyboard and monitor option is simpler, and the ssh option is more advanced, however if your willing to build your own TinyPi image, then maybe ssh is commonplace to you.

So by this point in the guide I am assuming that you have your build, and you are connected via your method of choice, lets start off by doing some housekeeping. Firstly lets make sure linux is up to date by typing these commands

sudo apt-get update
sudo apt-get upgrade

with the last command, you may be prompted to confirm the installation of the update. Simply enter ‘Y’ and it will continue. It may take a few moments to complete and get back to the command prompt. Next up we need to adjust some of the pi settings by typing

sudo raspi-config

here you will be presented with a nice menu system where we can tweak a few things.

  • First one to check is ‘expand file system’ to ensure that all your SD card is being used for storage. This should run automagically on first boot, but there is no harm in checking.
  • Next up is to enable ‘SPI’ inside ‘Advanced Options’ and then ‘SPI’. You will simply get a yes/no option for the ‘SPI’ setting.
  • Now you want to make some audio adjustments. Back in the ‘Advanced Options’ section, select ‘Audio’, which will allow you to decide where the sound goes. In here, you need to select ‘Force 3.5mm (‘headphone’) jack’ to make sure the correct part of the Pi is being used for the audio.
  • One final change in the ‘Advanced Options’ section is ‘Overscan’. When asked ‘Would you like to enable compensation for displays with overscan?’ you can select No, which will disable overscan.

Now that these settings have been altered, its probably best to restart. The raspi-config menu may ask anyway when you exit, but if not, there is a reboot command

sudo reboot

So you have everything set ready, its time to get that tiny screen working. We start by enabling some modules, and so need to edit a config file. If you type the command

sudo nano /etc/modules

you will be presented with the ‘nano’ text editor, which you will be quite familiar with by the end of this guide! now there may already be some text in this file, and it may have comments, which start with the hash symbol ‘#’. if you add the following into the file (if the lines are not already there)


the first line is to make sure the SPI connection for the screen is up and running, and the seconds command is to actually start the screen. You will need to save your newly edited file. The command for this is to hold the ‘ctrl’ key on the keyboard, and press the letter ‘o’. you will get a prompt to confirm the filename which you can just press enter on. Now to close the file and get back to the command prompt, you can press ‘ctrl+x’. Now that we are telling the Pi to start the screen, we need to make sure that the Pi knows what kind of screen we are using. Have no fear, there is a config file for that!! Try typing this

sudo nano /etc/modprobe.d/fbtft.conf

Now this file will be blank by default, so we will need to fill it with some text

options fbtft_device name=fb_ili9163 gpios=reset:25,dc:24 speed=40000000 bgr=1 fps=60 custom=1

now this file sets the type of screen in use (ili9163), specifies some of the additional gpio pins in use, sets the speed of comunication, sets the colour mode (bgr = blue/green/red), fps sets the target update speed, and custom says that we have tweaked a few settings. Press ‘ctrl+o’ to save the file (with enter to confirm the filename) and ‘ctrl+x’ to close the file. Now this should be enough to get the screen working, but now we need to give the screen a way to display whats going on. First off, we need to add some tools to work with

sudo apt-get install cmake git

and now we have the tools, we can grab the code from github, and build it

cd ~
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
sudo install fbcp /usr/local/bin/fbcp

With that installed, we can move on to making the buttons work. Lets grab some more stuff from adafruit on there github

cd ~
git clone https://github.com/adafruit/Adafruit-Retrogame
cd Adafruit-Retrogame/
sudo make install

Now the retrogame program needs an additional config file to make it work properly, so we will need to create that by typing

sudo nano /etc/udev/rules.d/10-retrogame.rules

And then furnish this file with the following information

SUBSYSTEM==”input”, ATTRS{name}==”retrogame”, ENV{ID_INPUT_KEYBOARD}=”1″

Save the file (‘ctrl+o’ and then enter) then close the file (‘ctrl+x’) and we are on the home straight!! We have one more config file left to change now, and this is the file that sets what happens while your TinyPi is booting. So type this

sudo nano /etc/rc.local

There will be something in this file, so we need to take care where we start typing. Basically there is a section that will print your IP address to the terminal, then a gap, then an exit command. In that gap, you want to add a few lines, then insert the following commands

sudo retrogame&

Now these 2 commands have some meaning. The first one is fbcp and is the first program we installed. This is the program that copies the game output to the tft screen. the ampersand is there to force the command to run in the background so the next line of code can run. This next line of code is the retrogame code. This will read the status of your TinyPi buttons and will convert them into something that the games will understand. This one seems to need the addition of the sudo command for some reason. Your files should look something like this

_IP=$(hostname -I) || true

if [ “$_IP” ]; then

printf “My IP address is %s\n” “$_IP”


sudo retrogame&

exit 0

save your file (‘ctrl+o’ and then return) and then close the file (‘ctrl+x’) then take a deep breath!! You have only one step left, but we now need a computer for this!! Shut your pi down by typing

sudo shutdown -h now

and wait for it to properly shut down (the activity led will flash 3 times then go off) cut the power, and remove the SD card. Place this SD card into the computer and open the ‘boot’ folder that should appear from inserting the card. Once in this folder you will see there are plenty of files. The file we are interested in here is called ‘config.txt’. If you open this file, you will see there are lots of commands and settings here. Scroll to the bottom of the file and add the following lines

hdmi_cvt=128 128 60 1 0 0 0


The first line is to set the audio correctly, and the rest is associated with the screen. We are forcing the HDMI port to be active, setting the screen size and resolution, setting some other screen parameters, and finally flipping the screen, as by default the screen likes to work upside down!! Save this file, and close it, and then there is only one job left!! There is a config file that the restogame program needs to make it know which pin from the pi is associated with which button. This file is called ‘retrogame.cfg’, and while you could create one yourself, i have done the job for you!! Simply copy the file from here and drop it into the boot folder, alongside the config.text file you edited before. Safely remove your SD card, and give yourself a pat on the back!! You can drop the card back into your TinyPi and fire it up and enjoy some gaming !!! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *