Turn a Raspberry Pi 2 into a Retro Games Emulator

I recently bought 2 new Raspberry Pi 2’s for different projects. The first project was to make a Retro Game emulator using the Raspberry Pi 2 as I’d tried to do this previously on an Odroid C1 and a Raspberry Pi 1 but each had their own issues that made me look to the 2nd model Raspberry Pi.

To do this you will need the following:

– Raspberry Pi 2 (http://au.rs-online.com/web/p/processor-microcontroller-development-kits/8326274/) $48AUD
– Suitable MicroSD Card (8gb or Above) I used one of these (http://www.officeworks.com.au/shop/officeworks/p/sandisk-16gb-ultra-sdhc-memory-card-br190829) $14.95AUD
– Digitech USB2.0 Bluetooth® V4.0 Class 2 Dongle (http://www.jaycar.com.au/p/XC4956) $19.95AUD
– Sony Sixaxis Dualshock 3 controller mine was purchased from Playhard Gaming Greenhills $34.95
– Micro USB Cable (A-B  Type) – Did not purchase as I already had one
– Mini USB Cable (A-B  Type) – Did not purchase as I already had one
– 5VDC 2A USB Power Supply (Or use a 10W Apple one, or Intel Compute Stick Power Adaptor, or Samsung Note 3 Adaptor)
– A monitor/TV with a HDMI input

For me the total cost of this project ended up being $121.50AUD (if you include the RPI case) as everything else I had available so did not need to buy. If you needed to buy a power supply and the USB cables, the whole thing should still come in under $150.

Step 1 – Download the Raspberry Pi 2 Lakka.tv Image

CAUTION: Using the dd command listed in step 1 can have severe consequences if you use the wrong disk number, how severe you ask? Loss of all your data… so please read and understand before you use the command

You can obtain the Lakka image by going to here http://www.lakka.tv/get/linux/rpi2/ and downloading the file. Once it is downloaded on that site if you click next it will explain how to flash the image to your SD card. I’ve linked to the rpi2 page as they update the downloads frequently with bug fixes.

Once downloaded make sure you unpack the *.gz file, as we want just an *.img file for doing the image to SD card.

The next thing you will need to do is determine what disk number your SD card has. The instructions below are for OSX. If you are using windows you should follow these instructions: http://www.lakka.tv/get/windows/rpi2/install/

In terminal run the command diskutil list BEFORE you insert your SD Card. Then, insert your SD card and run the same command again. You should be able to compare the two results of the command and determine what disk number your SD card actually is.

Screen Shot 2016-01-31 at 4.01.09 pm

Once you know your SD cards disk number the commands to run are as follows:

Unmount the SD Card:

sudo diskutil unmountDisk /dev/diskX <—where X is the disk number

You should then see this

Unmount of all volumes on disk2 was successful

You can now image the sd card using the command below:

sudo dd if=pathtolakkafile of=/dev/diskX <—-where X is the disk number of the SD card

Then its best to leave the computer for a good while, because the dd command doesn’t actually give any progress indicators. It simply shows when it is completed. Below is a screenshot of me running each command above.

Screen Shot 2016-01-31 at 4.01.09 pm

Once the disk is imaged – the terminal will return to a standard prompt. At this point you can now eject the SD card using finder or run the diskutil unmountDisk /dev/diskX command again so that you can safely remove the card.

Note: if you read the top of the post you would of seen the caution message about using the dd command like this. If you get the disk number wrong dd will not stop and the command is not reversible it will write over the top of whatever disk you said to write to no questions asked – so please be ultra careful when using this command and make sure you are using the right disk number before pressing enter.

Step 2 – Booting up for the first time

Plug the MicroSD card into the Raspberry Pi 2, connect it to your HDMI screen, plug in the bluetooth USB dongle and connect the Pi to your network using an ethernet cable. When all of those things are connected it’s time to power up the device – so plug that USB cable into the Pi to fire it up.

If you watch the screen you will notice on first boot in the top left of the screen there will be information about the file system expanding, make sure you let the system go through this entire process then reboot. This basically is the system expanding the filesystem on the SD card to allow you to be able to use the full amount of storage space on the MicroSD card.

Once the system as rebooted you should first see the Lakka.tv logo then when fully booted you will see the orange Lakka.tv menu. If you’ve got this far thats great, your system is likely to work as expected!

Step 3 – Find the network address of your device if necessary

Lakka uses the avahi-daemon to allow network discovery via the name LAKKA however trying to connect to a device called LAKKA does not always work. If it does not I suggest reviewing your DHCP clients list on your network to determine what IP was given to the system – this is beyond the scope of this tutorial so I will not go into that process here (tweet me/DM me and I’ll explain it if you need it). You will need to do this so that you can complete the next step

Step 4 – Log into the device using SSH

To login to the device the command is as follows:

ssh root@lakka.local

if that does not work the command is:

ssh root@IPADDRESS e.g. ssh root@192.168.1.16

You will be asked for the password, the password is root.

Step 5 – Pair your Sony Playstation controller

At this step I assume you are already logged into the device by SSH – if you are you should now follow the instructions on pairing the controller here: http://www.lakka.tv/doc/Wireless-Dualshock/ 

Follow the instructions carefully, particularly the part about plugging the controller in by USB – if you don’t do this the controller will never pair.

A few things to note, for me the once I pressed the PS Home button the controller showed its MAC Address but I did not get a message to authorise the controller. If this happens, unplug the controller and press the PS Home button again and you should see the authorise message. Once you have seen that you can simply continue on with the rest of the commands. Make sure you add the local rules so that bluetooth stays on after a reboot.

Once the controller has been paired you should be able to move around in the Lakka menu simply using the controller – it will autoconfigure itself. Your controller should have the number 1 LED lit to show it is connected.

I’ve not tested adding a second controller but have been told that you basically follow the same process for controller number 2 – and the second controller will light the number 2 LED to show it is in fact, controller number 2.

Below is a screenshot of me going through this process, unfortunately my connection dropped during the SSH connection so theres a reconnection in there as well:

Screen Shot 2016-02-01 at 7.06.46 AM

Step 6 – Add your games to the system

Now that you’ve got your controller and everything else ready to go you just need to add games to the system. This part is quite simple, in Finder you should see a device called LAKKA – click on this then open the ROMS folder, you can now simply drag and drop your games into this folder from your computer. Remember LAKKA needs the files unzipped or it can not open them so make sure you unzip your roms before you copy them across.

Remember for certain consoles you will also need a BIOS file (e.g. Sony Playstation) the BIOS files need to be added to the System folder using the same method above to access the folder (click Lakka in Finder, then click the System folder and then drag and drop your BIOS files to it)

I found it was better to do small amount of data at a time instead of a large file transfer of everything at once.

Step 7 – Play!

I found the easiest way to get started was go to load content then press the circle button on the controller, you should then get a list of all the games you added in step six – highlight the one you want to play then press circle again and it should begin to load.

If you want to change games, simply press the PS Home button, then goto close content. In the LAKKA menu’s the circle button is select/next and the X button is go back.

Notes:

I’ve only tested Sega Master System, Nintendo 64 and Playstation one at this point. So far the only games that did not work well were Nintendo 64 – they were a little too laggy to play but everything else worked quite well. Below is a video of me testing PSX with the Sixaxis controller – works quite well!

Once you’ve loaded everything on to the Raspberry Pi you don’t really need network access to it any more so you should be able to safely move it to another device, or take it somewhere else to play.

 

 

Scan to Email Server – Brother Printers

If you’ve replaced a Brother printer recently you probably would have come across this problem. The last two Brother’s we installed we have noticed this:

Scan to Email (Server) option is not actually on the printer from factory. There are two options for enabling this feature:

Option One (Recommended)

If you are lucky, Brother actually has the tool you need available for download in the download section. However – we have discovered that this is not always the case.

Here is the name of the package that will allow Scan to Email (Server) for the models that support it:

Internet FAX* / Scan to E-mail Server/ Fax to Server*/ LDAP* Install Tool

In my case I was trying to enable this feature on a Brother MFC-9340CDW and Brother don’t actually list the tool in the downloads section (or at least they haven’t at this stage, we have emailed Brother Support and asked that they change this).

If you need the tool – which is a firmware update for the Brother MFC-9340CDW you can download it from here. Once this has been installed to your printer – make sure you also set your POP/SMTP settings in the printer, or the function will still not show on the printer. Further instructions on how to do this can be found here (most of the models have the same web interface).

Once you have configured this you can then add things to your Address book and mark them as Mail as well, so bulk adding addresses and group addressing becomes achievable.

Option Two (Not Recommended, but easier)

The other way you can achieve this is by using the Brother web application “Easy Scan to Email”  – the problem with this though is you can only add one address at a time and all the email is routed through Brother’s own servers. If you wish to use this you just need to go to the Web option through the touchscreen of your printer and you can add the Easy Scan to Email service. It will then ask you which email address and settings you wish to use and its just a matter of completing these and adding a shortcut.

Hopefully this helps people that have had the same experience we have had.

 

Repeating Wireless Signals

We get asked this a lot and I think there is a lot of confusion between repeating a wireless network and “extending” it.

Netgear had a few products a while back that did the extending trick, but the issue with them is that they create a second SSID for devices to connect to. Devices that can properly repeat networks will maintain the same SSID and devices that do this particularly well will prevent your device from dropping a connection as they move between the repeating points.

The problem with using range extenders – as listed above is that your device will drop connection from the first network, then reconnect to the new SSID – this works OK, until your device realises the other network and then can’t quite figure out whether it should connect to the first SSID or the extended one then drops out.

There are two manufacturers that we have used for doing repeating wireless networks (there are a lot more than two manufacturers that are capable of this though).

The first is Apple – using an Apple Airport Extreme and an Apple Airport Express. The extreme provides the network that the Airport Express can then connect to and repeat. They are relatively simple to set up using the Airport Utility Tool – however, if you don’t have that they can not really be configured. This setup also allows some other nifty features such as Airplay and USB sharing.

The second is TP-Link. If you have any TP-Link Modems or routers you should be able to repeat them with one of these – a TP-Link WR702N – this nifty device can repeat your existing network and once its configure you can just go and plug it in somewhere that has signal and it will repeat happily. Another advantage of this device and the Airport Express is making connection to a wired device without running a cable to it. Both devices have LAN ports for connecting cabled devices, which can be very useful in apartment buildings or sites where you can’t really knock holes in walls.

We’ve found it best practice to have the main router doing DHCP then assigning the wireless repeaters outside of the DHCP range so that everything can continue talking over the network even back through the repeating points. Be aware though that the TP-LINK WR702N should have its firmware updated before you deploy it, as some of the older firmware versions had issues that caused settings to be wiped or reset.

Chrome No Longer Downloading PDF Files

I got caught out with this myself a few weeks back and have had a few other people ask me about it since. I am guessing that Google have pushed an update to chrome that has caused this.

Anyway – to turn it OFF goto this site in your chrome browser chrome://plugins/ click the photo below to see what this looks like.

About:plugins Google Chrome
About:plugins Google Chrome

You will see in the above photo there’s a button for Enable under Chrome PDF Viewer, you will most likely find yours will say disable. All you need to do is click disable and it will turn of the Preview feature for PDF files and then download them to your computer instead of showing you the document.

 

Run Multiple Instagram Accounts – Android

We have been asked this quite a few times only to find out that Instagram does not really support it but there is a couple of options:

1. Download an alternative app for Instagram that will let you sign into your alternative account, the down side of this is there really isn’t any that are as simple and easy to use as Instagram

2. This is our preferred method, in Android 5.0 Lollipop user accounts is now available on smart phones as well as tablets. So we simply added another user, downloaded Instagram in that user account and then signed in to our alternative. It works very easily because if you want to use your second account – just swipe down the main menu and then tap the other account – you’ll then be able to open Instagram as the other user without having to log out/log in – Happy Days!

On the topic of Instagram, in July they released Layout (Android and iPhone) you no longer need to use InstaPic or similar to get those multiple frame shots – we’ve been using the Layout App and it works really well.

Unfortunately Google Play Services has Stopped Working Fix (CM12)

If like me you run CM12 custom roms you have probably seen this error pop up and read all the articles about clearing caches, uninstalling play store and then realised that none of it worked.

The only fix I’ve seen work is this:

Download libjavacore.so to your phone. Then open root browser or another root file explorer and rename the file on your phone /system/lib/libjavacore.so to libjavacore.so.old

Then, copy the new file you downloaded to /system/lib/libjavacore.so

Thats it – the annoying error should disappear.

Thanks to @arter97 and @temasek for investigating and posting this fix.

Autofill Tracking Category Xero – JavaScript

Recently I was helping out in an office where we needed to add the same tracking category against purchases that were being entered into Xero.

Currently there is no option for Autofilling the field in Xero so I took to tampermonkey and wrote a small script that will autofill the option each time a purchase is opened.

// @name         Xero Autofill
// @namespace    http://twitter.com/insttechno
// @version      0.1
// @description  Autofill Tracking Category In Xero
// @author       You
// @match        https://go.xero.com/AccountsPayable/*
// @grant        none
// ==/UserScript==


//window event listener needed to wait for all elements to load
window.addEventListener('load', function() {
    //Grab and Click Tracking Option 2
document.getElementsByClassName("x-grid3-cell-inner x-grid3-col-colTracking2 x-unselectable")[0].click();
    //Set Variable "track" to be the empty text box
var track=document.getElementById("ext-comp-1013");
    //Fill that box with some text
track.value="Text Goes Here";
}, false);

If you install the chrome extension Tampermonkey and add it as a userscript – each time you go to Accounts Payable and open a purchase it should autofill the tracking category.

I used the elements in the code for Tracking Option 2 but it should only be small changes that are needed to fill a different option.

Please be aware that this script is quite likely to break if Xero change their backend code between releases.

Chrome Freeze in OSX when trying to attach files

I’ve ran across this problem recently and have seen that it happens to quite a few people using chrome.

You are using Gmail, or another online site and click on a button to add an attachment or upload a file and all of a sudden chrome freezes and you see the coloured spinning wheel of death as people refer to it as.

You then need to Force Quit chrome to continue working.

To fix this, you need to delete two files:

com.apple.finder.plist and com.apple.sidebarlists.plist

Seems simple, but they are in the Library Folder which is hidden is OSX. However, to access it all you need to do is Open Finder, Click on the Go Menu then press Alt on your keyboard. Magically, you should see an option for Library appear that you can click on.

Once you have clicked on Library the files we need to delete are stored in the Preferences folder. So open it up, find the files and drag them to Trash, or if you want to keep the files rename them so you can revert if necessary.

The next step is to log out/restart your computer and log back in. This is because upon logging in OSX will recreate the two files we have deleted.

At this point – check if you can add attachments normally as this should have fixed the issue.

 

Plex Media Server Loads XML Sheet

 

Plex XML LoadingThis is actually a fairly simple problem but gets mentioned quite a bit.

Easiest way to fix this is add /web to the url you are using to try and access the server with.

E.g. 192.168.1.7:32400/web

Then you will be good to go with your Plex Server media editing.

 

Recovery is not SEAndroid Enforcing SM-N9005

If you own an Android phone and like messing around with the software on it, you may have seen this error.

This happened to my phone when I flashed a CWM (Clockwork Mod) Recovery that wasn’t for my Android version.

If you are running Android 4.4 and above make sure you flash with CWM 6.0.4.7 to avoid this error.

Download it here

Be aware that this is for SM-N9005 only.