Friday 31 July 2015

Raspberry Pi 2 B Entertainment Centre

Well I've had my RPi2 since it was launched and its been in its box waiting for FreeBSD to release an RPi2 compatible image or Microsoft to release a beta of Windows 10 IoT for it. That was until I decided to turn it into retro gaming box! I've detailed most of what I've done to my Pi mostly for my reference, if this helps other people out, then that's great!

I've also tried to include links to other peoples work that has helped me out, if I've not linked to your content, do let me know and I'll happily edit the post to include your work.

All commands or text should be typed as you see them, this is Linux and its case sensitive.

Black background with green text are commands.
Black background with white text is plain text to copy & paste or type.

What you'll need at a minimum:

  • RPi2 £26 ex-vat
  • 2A power supply with 1m lead £5, using an underpowered supply or too long a power cable will result in a rainbow box in the top right corner and hinder performance, possibly causing damage to the components. So try to use an original Pi power supply.
  • RPi2/B+ case, preferably with fan hole or make your own £5
  • Heatsink, preferably with self adhesive thermal tape £2
  • microSD card, I recommend a class 10, 16Gb or higher. ~£6+ depending on capacity
  • HDMI cable, with VGA/DVI or Display Port adapter if required ~£5
  • Retropi image
  • Controllers, decide what games you'll be playing and purchase the correct USB controllers - or use a PS3 controller with USB cable like I do at the moment (I'll switch over to wireless as soon as I get a USB bluetooth adapter, but wired doesn't bother me at the moment)
  • ethernet cable or wireless USB adapter
  • Know how to find the IP of your Pi.



I turned to Retropie which is a preconfigured version of Raspian which boots straight into emulationstation. You can purchase roms legally from the likes of Sega on Amazon or even rip your own roms with a small device for not a lot of money with the Kazzo or maybe you still own the games and want to source them elsewhere and not go through the hassle of ripping them yourself... well that's your choice. But wouldn't ripping them yourself be so much more FUN?

Starting out with the basics

So anyway, download Retropie and use Win32diskimager and a SD card adapter to write the Retropie image to your microSD card, I've got a 32Gb Class 10 Samsung which works great.
Power up your pi and you'll get emulationstation after a moment which will prompt you to configure your controller, which might even be a keyboard. Wooooooo!

Now you've got a bunch of shareware games to play ... not very exciting. So pop a USB stick into the pi, give it a minute and it will create a directory structure on the stick, now go plug the stick into your computer, navigate to the correct rom directory and place your files there, plug the USB stick back into your pi and give it a few minutes while Retropie copies the files to the correct location, the green LED should stop flashing when its finished copying the files. You could also copy them over the network to the shared folder on the pi.

Note: The beta of Retropie 3 that I'm using doesn't do the autocopy, so use 2.x or copy them manually and the USB stick should also be FAT32 formatted, Windows doesn't allow greater than 32Gb FAT32 disks so use another tool to do that job.

You may need to exit emulationstation to refresh the list of games, so hit F4 then type emulationstation from the command line and check if your games are showing, if they aren't make sure they're not zipped or in another format and make sure they have the correct file extension for the emulator you're going to use. Refer to the emultationstation website for further details if you're stuck.

You can install and configure a bunch of other things if you drop to command line by hitting F4 from emulationstation or SSH'ing using putty then typing:

sudo raspi-config
and expand the filesystem, exit and type
sudo reboot

Once you've rebooted, drop to command line again and type:

cd RetroPie-Setup/
sudo retropie_setup.sh


One thing you might want to do while you are there is to install Kodi under the experimental packages, we'll do more with that later. You should also configure your controllers from here, under Setup then Configure input devices.

Overclocking

This isn't really needed, but hey we're having fun so lets have even more fun! While in the command line you can, if you have a heatsink and fan, overclock your pi safely like this, but I take no responsibility for you choosing to do this. This gives you an extra 200Mhz per core without voiding your warranty:
sudo nano /boot/config.txt

type/paste this at the bottom of the file, check for typo's:
arm_freq=1100
core_freq=500
sdram_freq=500
over_voltage=6

touch checktemp.sh
chmod +x checktemp.sh
nano checktemp.sh

and type or paste this in:

#!/bin/bash
echo "Press [ctrl+c] to end monitoring"
echo ""
while true
do
  vcgencmd measure_temp
  sleep 3s
done

now to check your temps either remotely via ssh or command line - useful for keeping an eye on them while gaming or watching videos with the overclock, type:
./checktemp.sh


Gaming

So by now you should have your controllers configured (let the script time out if you don't have a controller with all the buttons it asks for) and a bunch of games ready and raring to go. If you have any issues with the size and position of the game or if it doesn't perform too well you can press x or m just after selecting the game you want to play, this will bring up a configuration screen where you can change emulator, resolution etc.

I have a PS3 controller I use with USB BT dongle I also have USB NES, SNES and PlaySEGA controllers for when I want the retro feel. Mostly they gather dust.


Note: that the items under Ports will not use the controller but the keyboard, so make sure you've configured that too. If you find a way to enable the controllers here, let me know as I've not had a look at doing that yet.

Note II: If you have everything setup as you like, now would be a good time to take a backup of your image using Win32diskimager again, but instead of using write, use read.


Media Centre time!

So now you've been playing games and you would like to do something else with your Pi to enhance the experience or save having to purchase a second for watching films, TV shows or listening to music.

This is where installing Kodi earlier comes into play.

You can find Kodi under the Ports, you'll need to use a keyboard and mouse here at first. We'll get onto changing that a in a bit.

So under Kodi you can go into System, file manager and add locations, such as a shared drive or NAS so it can see all your TV recordings, family photos and music.

But you can also add other peoples hard work to your Kodi install relatively easily, doing so is likely going to be different depending on how they setup their Kodi. I chose a particularly good custom build I was shown by a friend, its got a lot preconfigured and regularly updated.

Changing the function of the power button so it doesn't shutdown the Pi and rather gives me the options of what I want to do, so I can shutdown or reboot which will get me back to emulationstation. Unfortunately the Exit option doesn't return you to Emulationstation. 

So drop to command line again, you will need to reboot the Pi if you are in Kodi.
and type:
cd .kodi/userdata
sudo nano guisettings.xml
press control+w and type/paste in PowerBtnAction and hit enter
this will find what we need to modify, now delete the word Exit and type/paste the below where that word was between the > and <
ActivateWindow(shutdownmenu)


Using a PS3 controller in Kodi to Navigate your way around:
http://blog.petrockblock.com/forums/topic/kodi-tab-in-emulationstation/

The alternative is to find a Kodi remote on your smartphone's app store, there are  apps on Android, iOS and Windows Phone, and setup the remote control bit in Kodi, to do that go to System > Settings > Services > Web Server and enable the control of Kodi using remote http, set your port, username and password, load your app up and setup the connection using your Raspberry Pi's IP, the port, username and password you set. This won't let you make your way from emulatiuon station to Kodi, so you'll need to use your controller to get to Kodi then your smartphone app to control Kodi or just stick with the controller ...

Unfortunately at this time there is no way of getting Netflix working directly on the Pi, you'll need a subscription service called PlayOn and a Windows computer to install it on in addition to your Pi ... That's not an elegant solution. It's a shame as I enjoy Netflix's content.



Shutdown button

So I decided to do a shutdown button rather than use the reset header pins which cuts the power and juices it up when a momentary switch it used and pressed down and released and solder some pins in there with a switch. Doing this can corrupt your SD card or some files and cause things to go awry.

I won't go into to much detail as its well covered elsewhere on the interwebs, if you decide to go for one, use the Safe Shutdown switch in this link here.

If you want you can then also add the Reset Switch option to completely cut power  to the Pi using a rocker switch instead of a momentary switch.


Well, I hope you've found this helpful and if you have any comments or suggestions just shout! 

No comments:

Post a Comment