Friday, December 28, 2012

'Tis the Season for Pi(e)

So it's been a while.  Sorry about that, I've been lacking the excess energy blogging requires, but from here on in I'll endevour to do better.  I'll even make it a New Year's Resolution.

I haven't had time to do much new stuff with the Raspberry Pi, but I have found a new image that I now use as my base.  It has XBMC already installed, and though I haven't played with it much, it plays all my videos and music out of the box, so I'm pretty happy.  I used the instructions to install the precompiled version, as I've managed to break my original SD card (the physical card, not the install, which is new for me).  Though he's since created his own archive so you can 'apt-get install' XBMC from there:

If you're really geeky and keen you can try and build it yourself, but it takes about 12 hours on the pi, and is kind of tricky (I am not really up to trying it myself, but would love to hear from you if you have).

I've done a little playing with Arduino since we spoke last.  I love the Arduino microcontroller, so noob friendly.  Most of my code is stolen, which is not just allowed on the Arduino, but encouraged.  They have massive libraries of code for use with almost any sensor / servo / thingy / or doodad you can think of.  Most of my 'coding' has involved stealing code for the whatsits I'm using and mashing them together, and then asking our resident guru (Pix again) why it doesn't quite work.  I've just discovered the 'mapping' function (thanks Simon) which involves reading the input from a sensor, and mapping it to some kind of output device (so far I've used a speaker and a servo).

I'll post some more info soon, but to tide you over here's a picture of my claw which maps the distance you are away from the sonar to the how far apart the fingers of the claw are:
I highly recommend Arduino if you are looking for a brain for your next project.  The language is 'c-like' - whatever that means (coders know).  But it's relatively simple, even for non-programmers, once you've looked at a few examples.  In future I'll be posting more Arduino, as well as more Pi stuff, and hopefully getting them to play together nicely in the not too distant future.

Sunday, November 4, 2012


Now for the pretty pictures.  Well, a little less pretty now we're used to high definition gaming, but what they lack in pixels they make up for in gameplay.  Plus they're fun.  I like the dry wit present in many of these games.  Tasty.


Also relatively painless to install:
apt-get install scummvm

But sound can be an issue if you're using HDMI.  If I haven't mentioned it before (sorry) you should force your Pi to use HDMI for sound if you can (ie aren't using a composite screen / analogue sound out).  To do so open the config.txt file located in the boot folder.  You will need to be a super user to save it, and so the easiest way is to open it in terminal:
sudo leafpad /boot/config.txt
or, if you've shelled in like I taught you a couple of posts back you will (for now) need to use a command-line text editor:
sudo nano /boot/config.txt
And 'uncomment' the line:
Easy, peasy, just remove the hash - #.
Then save the file and reboot.  Sound sorted.  Remember to change it back if you want to go back to using the sound out port.

Now you are ready to open up ScummVM (in your Games folder in the Programs menu - press the Windows Key, or click the square in the bottom left corner, go up to the Games folder, and go from there).  You should see the bright yellow ScummVM screen.  Click the 'Options' button and tick the checkbox for fullscreen mode.

Now to add the games (ScummVM, like Gargoyle, is just the engine used to open and play games).  If you've used ScummVM before then you're set.  This is the same no matter whether you're using Windows, Linux, Mac, or some unholy hybrid.  If you already own the game you can just copy the files across from your CD or floppy to your hard disk. Click 'Add Game,' from within ScummVM, select the game file, and add it and you're ready to go.    Detailed instructions on buying the games legally can be found on the official ScummVM website.  You can grab Beneath a Steel Sky free from the repositories:
apt-get install beneath-a-steel-sky
And it will either open directly, or you can add it to ScummVM.  It is in "/usr/games/sky".

 Now for the final step - stay up all night reliving (or creating) awesome childhood memories.   And remember...

Now What - Old School Gaming

The Raspberry Pi is good for so much more than watching the movies and tv shows you've recorded though. I love being able to use my computer from my couch, and here are some of the things I've been up to.


Old school style. No, that doesn't mean Doom - Before that, a long way before. I was born in 1978, so grew up with text adventures (though not as many as I'd like) and point-and-click adventure games (ditto). Actually, though I played them at school occasionally, and was totally obsessed with a couple of Infocom games my mother bought me, it wasn't until I 'rediscovered' them as a teenager (in the bargain bin in game shops) that I really got into these games.  Coming back to them yet again, in my 30s, they still hold up remarkably well.

Text Adventures / Interactive Fiction

Gargoyle was easy. Just type:
sudo apt-get install gargoyle-free
into the command line. After that you will need to run it (gargoyle from the command line, or there will be a link in your your programs bar, under 'Games').

Gargoyle is a front end for text adventure formats (just like XArchiver is a front end Archiving tools). It plays:
  • TADS games (a newer format for amateur writers,
  • Z formats z3 - z8 (Infocom, also popular with the new IF (interactive fiction) breed),
  • SAGA (Scott Adams Grand Adventure)
  • Level 9
  • Magnetic Scrolls
  • A heap of others.
Chances are, though, if I haven't piqued your interest by now you should just jump down to the adventure games section (or skip this post altogether if, immersive, story based gameplay isn't your thing) :p.

There was a bit of chatter on the forums about Zork.  Yes, gargoyle will play it (it's in the z-code formate).  Now that it's been released into the wild it's easy to source too:
Just download the files from the Interactive Fiction archive.  Make sure you grab the z-machine files.  When you can either click on the name of the game you want to play, and choose to open it in Gargoyle.  I recommend ticking checkbox to always open those kinds of files in Gargoyle, so that in future all you need to do is double click on the game file.  Though opening a game from within Gargoyle is also easy.

The IF database is a good place to go for games.  You won't be able to find copies of other old favourites from the commercial realms because, while they're not still in 'print' (more's the pity) they are still covered by copyright and haven't been released by their makers.  You may be lucky like me and be able to grab a few from ebay, or source them elsewhere.  You can read details about the game on the archive, but you can't download it.

What the archive does well, though, is make the great output of 'amateur' IF writers available to play.  Though many of these writers are only 'amateur' in that they never got paid.  The four and five star games are at least as high in content, quality, and polish as the games of yore, and many of the 3 star games are also great fun (if a little lacking in polish).  Look through the lists, or do a more detailed search if you're looking for a certain type of game.  Heck, you can even start your own list, or get recommendations based on other games you like - just look down the bottom of the game description.

If you're new to all this (good on you for stretching your horizons) or it's been a while I highly recommend a play through of The Dreamhold by Andrew Plotkin.  It's an engaging game, lots of fun, and it has an 'adaptive' tutorial (ie the tutorial can read the info about how you've played the game so far and give you hints based on that.  Feel free to type 'help' at any time to get more info though.

Hopefully that's enough (too much???) to get you started.  Now, on to the pretty pictures.

I've decided to split these posts up, as I may have waffled on a little too much to include them both in the one update.

Saturday, October 27, 2012

Transferring Files to the Raspberry Pi over the Network

Hmmm, I'm going to have to do something about those titles.  They're descriptive but, really, very boring.  Maybe I should be chanelling GaGa.

I was having trouble getting file transfers working from within PuTTY, so like all good noobs I gave up and did it the easy way.  FileZilla is probably the easiest option.  You can download it from here.  Then click on the .exe file to install it (like all good easy-to-use windows programs it comes as a self extracting file).

Now open it.  Remember how to get the IP address using Angry IP Scanner?  Good, do that again.

Now enter the number into the Host box (top left) and enter your Username and Password.  If they're pi and raspbian, then you should really think about changing the password.

Wow, look, the contents of your computer is on the left, and the contents of the Pi will be on the right.  You can just drag on drop files from here.

Thanks to Pix from the Adelaide Hackerspace for his help working this out.

First Step: Changing the Default Password

Okay guys, I think this is probably the most important first step you can do on the Pi, so sorry for the delayed how-to.  Hope it's useful - all the info is from the site.  There's some pretty good tips there on setting up your Pi, but changing your password should be easy.  Just open the terminal program and type:
sudo passwd
You'll be prompted for your original password (raspbian if you're running Raspbian as your OS).  Then you'll be asked for your new password - make sure it's something you'll remember.  Enter it once more.  You're done.  Your Raspberry Pi is now a lot more secure - and you only had to type five words.

Shelling In from Windows

So I'm guessing that you may have heard the phrase 'shell in' before.  No, it's not betting on a rigged shell game on the streets of New York City.  I had heard 'shell in' a lot of times (I hang with geeks), and vaguely understood that it meant controlling one computer from another computer (via a network) - but that was about as far as I went before owning a Pi.  It is a very useful ability to have, however, as it will let you do things on the Pi with only an ethernet cable, power, and your internet router.

Firstly you will need to scan the IP addresses on the router.  This will tell you what is connected (including the Windows machine you are using, and the the Raspberry Pi).  The program I use is called Angry IP Scanner.

Step 1:  Download it here.  I am using version 3.0 beta-6 (if you don't know what that means, don't worry about it).

Step 2:  Run the program (it's called ipscan-win32-3.0-beta6 in my case, yours will be ipscan-win...? where the ...? is whether it's 64 or 32 bit (32 bit will run in 64 bit windows, so it's easier to just use that one unless you have issues) and the rest of the ...? is the name of the version.  I use it enough that it was worth pinning a shortcut to my taskbar.

Step 3:  When you first open it it'll scan only a range of 1 IP address (shown at the very top of the screen).  That is the address of the computer you are running the program you are working on.  The IP address of the Pi will probably be within a few numbers of this, depending on how many devices you have joined to your router

So in the first box of the IP range (highlighted in blue) put a number 10 below and in the second box enter a number 10 above your computer's address.  Press 'Start.'  Since it's plugged directly into the router the 'Ping' will be very low.  Yup, the Pi's address on this router is '' - remember that number, you'll need it in a minute.

Now that you know where your Pi is on the network.  You need to connect - for that we'll be using PuTTY.

Step 1:  Download and run it.

Step 2:   Enter the address of the Pi into the Host Name (or IP address) box:

Leave the Port as 22 (no changes there) and click the Open button (highlighted in blue).

Step 3: Then the PuTTY window opens you will be asked who you want to 'login:as' - This is your user name.  If you are running Raspbian the default is:

You will then need to enter your password.  Hopefully you've changed this from the default, but if not, this will be:

Congratulations, you've successfully shelled in to your pi.  You will only be able to use the command line tools from here (since anything else will require a monitor to be plugged into the pi), but that's enough to install software, and do cool stuff like 'Dark Pi Rises' or creating an IP camera to watch your animals.

 Wow, exciting.

A bit shout-out to Tim for teaching me how to shell in and helping me grab the software.

Thursday, October 25, 2012

Unrar ra rar raaah!

/channelling Lady GaGa.  Wow, that was unexpected.

So I needed to 'unrar' an archive...

Do I need to take a step back from that statement?

Fair enough, so 'RAR' is a kind of archive (where you shrink, or 'compress' a file, document, program, etc so that it takes up less space).  Most Windows users will be familiar with ZIP files, well RAR does the same thing, only using a different compression algorithm.

XArchiver is a pretty good front end, and will automatically extract archives using the installed programs.

The only problem is that there is no 'unrar' installed.  Normally I'd just 'apt-get' it, but that didn't work, so here is how:

Step 1: Open the sources.list file in leafpad:
sudo leafpad /etc/apt/sources.list
and add the following line:
deb-src wheezy main contrib non-free rpi
 Then save and close leafpad.

Step 2:  Enter the following into Terminal, in order:
sudo apt-get update
sudo apt-get build-dep unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar_4.1.4-1_armhf.deb 

Now (once you've rebooted) you should be able to use XArchiver to unrar your archives.  Or you can do it from the command line (in Terminal):
unrar file.rar
(where 'file.rar' is the name of the file you want to unrar).

Getting 'Flash' 'Running'

Sorry for the quotation marks, but it's not really Flash, but rather an open source version, called Gnash, that you will be 'running.'  Yeah, the quotation marks around 'running' are important too.  Remember that the Pi is not a very powerful machine, and any Flash heavy page is going to bog it down - especially since most browsers already max out the Raspberry's CPU and RAM.  You certainly won't be able to use it to watch Youtube videos.  :(  If you still need to run Flash, for whatever reason, here's how.

Step 1:  Type the following into the terminal:
sudo apt-get install browser-plugin-gnash

Step 2:  You will need to restart the browser (if you have it open).

You can now play (very simple small) Flash Games and view annoying advertising.  Congrats!  :)

Sunday, October 21, 2012

Surfing the Web

Not something the Pi does well, but it can still be improved.  Firstly Midori is not a bad browser, but Iceape will probably be better.  It is less intensive, and has an adblocker which is pretty damn handy given the state of the web these days.  You can even switch off java and images to save bandwidth / processing power.

Step 1:  sudo apt-get install iceape

That's it, iceape is now installed.  I recommend the adblockplus plugin as a bare minimum

Step 2:  Go to 'Tools>Add-ons Manager and search for adblock.  When it comes up click on the install button.  You'll need to restart the browser to make it work.

If you think you'll need flash then I recommend gnash (an open source alternative):

Step 3:  sudo apt-get install browser-plugin-gnash
Don't try and view / play anything too big though - the RPi's not built for it.  Youtube is still a big fail.  Sorry.

Watching Movies on the Pi

A word to the wise.  Don't even think about trying to get VLC working.  I have one of the new 512 meg of ram RPis and it is still super chunky and slow.  Omxplayer is your best bet (once it's working) and, based on my reading at least, is the only viewer able to utilise hardware acceleration.

Step 1:  Buy the MPEG-2 license key.  No really, not affiliated with the store or anything, but it makes such a huge difference for high resolution DivX, Xvid, MPEG-2, etc, files for such a small price, why wouldn't you?  To get your serial number type cat /proc/cpuinfo into the terminal.

Step 2:  Enter the licence key they send you into the config.txt file in the boot folder.  You can do this from the terminal by typing sudo leafpad /boot/config.txt
Then pasting the text from the email into its own line (it'll be all 'one word' and begin with 'decode_MPG2=' followed by a string of numbers and letter).

Step 3:  Reboot

Presumably you want to be able to control your movies without 'shelling in' (I know, right, I only vaguely know what that means, let alone am able to do it).  In that case just opening a file using omxplayer won't cut it.  Also, their is a good chance that there won't be any sound.  To fix these issues...

Step 4:  apt-get install xterm

Step 5:  Right click on the movie file you want to play and select 'Open with...'  Tick the box that says 'Set selected application as default action for this file type.'  Then click on the 'Custom Command Line' tab and enter the following:
xterm -e omxplayer -o hdmi -r %f
and click OK.

Step 6:  You can control the video (skip forward, back, pause, etc) using the following commands:

Space or p Pause/Resume

- Decrease Volume
+ Increase Volume

Left Seek -30
Right Seek +30
Down Seek -600
Seek +600

1 Increase Speed
2 Decrease Speed

j Previous Audio stream
k Next Audio stream

i Previous Chapter
o Next Chapter

s Toggle Subtitles
n Previous Subtitle stream
m Next Subtitle stream

q Quit

Connect to the Internet Using your Mobile Phone

So my ethernet worked easily and simply.  The only drawback?  I don't have a router at home.  I do all my internet surfing by tethering my mobile phone to the computer.  Something that didn't work with the RPi.  At least not yet.  Luckily I had access to a friend's router, and so installed wicd that way, but if you're not so lucky here's how to do it (you will need to install libpcap, ppp, and pppoeconf anyway).

Step 1:  You will need to download libpcap0.8, ppp and pppoeconf.

Step 2:  Open LXTerminal in the same folder where you have the files saved and type dpkg -i libpcap then press the 'Tab' button (the rest of the name should auto-complete - if not, then you'll have to type it in full (or copy and paste the name).

Step 3:  Do the same for ppp and pppoeconf.

Step 4:  Open LXTerminal in the root folder and type:
sudo leafpad /root/interfaces.txt and add the following line:
iface usb0 inet dhcp
then save and quit.

Step 5:  Enter ifup usb0 in the terminal

Step 6:  Make sure your phone is connected, and tethering is switched on.

Step 7:  Type sudo ppoeconf and follow the prompts

Step 8:  Reboot.

You should now have networking (or at least I did).  You can now apt-get install wicd which will give you better access to your networking.

Step 9:  Open wicd, and from the drop down menu on the right select 'preferences' and replace eth0 with usb0 in the wired interface box.  Tick the 'always show wired interface' box.

You can also turn wireless on and use your phone as a wireless dongle - just as handy, but without using your bandwidth.

Thanks to Mast for his instructions on getting a Network Manager working and Plugwash on getting usb tethering working.

Set Up

Congratulations!  You've got an operating system installed, and a working Raspberry Pi - now what?  This blue screen doesn't look particularly useful.  Well, it is and it isn't.  This is the raspi-config menu, and it's for getting things organised before you get down to using your raspberry pi.

The main step here is to select 'expand_rootfs' so that you can use your whole card as your hard disk drive (not just the 2GB in the image you downloaded).  Next you might want to 'change_timezone' and select yours (so that the pi knows what time it is where you are, and displays it correctly).  Finally, as a noob, you will want to arrow down to 'boot_behavious' and tell your computer to start the desktop on boot.  Then arrow down (or press tab) until you get to the <Finish> menu.  You will be asked if you want to reboot.  You do.

When the RPi has finished rebooting you should be looking at your nice neat Raspbian operating system.  Even if you haven't used Linux before this screen should be similar enough to Windows for you to feel at home.  Where you go from here will depend upon what you want to do with your RPi.

Getting Started

First things first, we have to get some kind of operating system running so we can use our Raspberry Pi.  I chose Raspbian because it has hard float, is recommended by the Raspberry Pi Foundation, and (this was the clincher) because portmanteaus make me smile (I am an English major after all).  If you are a complete and total noob, then it might be easier to buy an SD card with Raspbian (or one of the other operating systems) already installed.  If you'd like to know how to make your own, though, here is a step-by-step.

Step 1:  Download the latest Raspbian version from here:

(it was for me).

Step 2:  I'm going to assume that most noobs will be running windows on their home machine, and thus will need to download and unzip Win32DiskImager.

Step 3:  Insert a blank compatible SD card in your SD card reader, open up Win32DiskImager, and select the image you downloaded in step 1 (it should automatically select your SD card as the write destination).

Step 4:  Click the "Write" button.

Step 5:  Wait (patiently or impatiently) for your SD card to finish writing.

Step 6:  Eject it from your SD card reader, insert it in your (unpowered) Raspberry Pi, then connect everything up and go!

Step 7:  Set Up.

What do you think you're doing?

It's been harder than I thought - getting the Pi up and running the way I want. Lots of trawling and trial and error (oh, the errors). Then I had to do it all again! when I corrupted the SD card (more about avoiding that later).
Raspberry Pi
So here we are, the reason for my blog. I figured I might as well document my experience getting pi up and running for others as well as myself. Hope it's of some use.

A big thanks to the folks at the Adelaide Hackerspace who've helped me get my baby up and running.  Especially Pix, Tim, and Jon.  I promise to mostly use my new skills for good.  :)