Getting Started with Raspberry Pi

So the hype around Raspberry Pi has been quite a sustained thing – with initial pre-orders exceeding all expectations (so came the “queuing in line” system with limited quantities), with supply only just beginning to catch up with demand. In fact, not quite – since I wanted to buy another one, only to find that element14 is now OUT of Pis, have to wait a month for the next shipment.

So lets say you’re thinking about a Raspberry Pi – a commonly asked question is, what can you do with it?

  • Low powered, cheap media centre. It’s probably not that good of a job for it, as the CPU itself is a bit weak for software decode of non-accelerated formats, however, it’s more customizable than off-the-shelf players, it’s cheaper, it has Ethernet (actually, it’s fed off USB) and USB. So I guess it could make a viable media centre for the tinkering and customizing inclined – don’t expect it to be perfect and work out of the box.
  • Low powered server of sorts – again, the CPU and RAM aren’t that great, and ultimately, if you’re expecting loads of performance (say as a SAMBA server), you will be disappointed (especially because Ethernet is from USB, and USB is quite CPU bound). It’s important to keep in mind that the Raspberry Pi was intended as an educational device for teaching coding and embedded hardware, so I guess if one is willing to accept that, then maybe they could use it for this. Just don’t expect it to be as fast as an old laptop – some people compare it to a Pentium II, with better graphics but limited RAM. Even running torrents can be quite taxing on this hardware given the need to perform lots of I/O, hash checking – it’s not impossible, but don’t expect amazing speeds from it.
  • Low powered desktop computer replacement – again, the low powered nature (in terms of computing power) really makes it a bad choice for someone (advanced user) to use as a desktop replacement. To augment it, do single purpose tasks, make displays or drive TVs with latest RSS feeds – that’s all fine and dandy. But to browse the web on it is somewhat painful, so don’t expect it to even match a modern Android smartphone in terms of speed.
  • Learn about hardware interfacing and ARM CPUs – now this is where the Raspberry Pi really “excels”. The reason I say that is – most finished systems don’t have accessible GPIO pins. How the hell are you going to hook up your LCD, Servo, etc to a finished tablet (some ARM based tablets can be had at twice the price with similar specs – Allwinner A10 tablets retailing at about $99 have 1Ghz-1.5Ghz ARM core, can run Linux if you install a special image to it – I did it on my Ainol Novo7 Elf). So, for hobbyists, they can think of it as a much more powerful Arduino. Just be very very careful. Unlike the Arduino, this runs on 3.3v logic and is NOT 5v tolerant in any way. Short out a few pins and you’ve got a burnt Pi. So design carefully folks! (I should probably get to doing this sometime soon, but with my lone working Pi serving this webpage, I won’t tinker around with it!)

It may seem I’ve said many negative things so far – that’s because in my opinion, it’s the truth. If one thinks back to why so many people were dissenting of netbooks, it’s because people were trying to use them for purposes for which they were not designed. Similar to netbooks, these are cheap, almost disposable “bottom end” devices intended for single-purpose applications. If you expect it to replace your desktop computer, you’re gonna have a bad time (yes, meme reference). If you keep the price in mind, and you keep the original purpose in mind, it’s a refreshingly useful device to automate a few things around your home, get them online, etc.

Furthermore, it does have one thing up its sleeve to redeem itself. Overclocking. Thanks to the RPi foundation’s work, we now have the ability to overclock the Pi without sacrificing any of the warranty. At this price, you could probably overclock it anyway and sacrifice the warranty without too many worries, however, there are always caveats with overclocking. As devices aren’t tested to operate at above their rated speeds, each device may have its own limitations, and will become unstable when overclocked too much. The downside of this is that it often causes SD card filesystem corruptions beyond repair, system hangs and higher current consumption, with associated increased heat and possibly shortened device lifetime. For the price, I think it’s worth a try if you have the time – at the moment, I’m running at 950Mhz and mine seems to cope just fine, for the record.

Lets say you’re lucky enough to have a Raspberry Pi, how does one “get started” using this non-descript green board, roughly the size of a pack of smokes (bad reference, I know)?

  • My recommendation is to start with the current version of Raspbian. Download the .zip file image, unzip, and find an SD card to put it on. The image must be written raw to the card, so use a Linux machine and dd it over, or on Windows, apparently there’s W32diskimager one can use. I however, used my favourite hex editor/forensics suite WinHex – it can also do it just fine. Make sure you get used to writing the image on the card, because you might need to do it several times.
  • Gather your HDMI lead, display, power supply, USB Keyboard and Mouse and microUSB cable. Put in your SD card into your Pi, plug in all peripherals and then the power lead. The Pi should start immediately. I recommend you also get an ethernet lead and plug that in now – when raspi-config boots, you get a text menu, and the first thing I’d do is update raspi-config as some of the overclocking settings have changed.
  • If you intend on playing with overclocking, I suggest you establish the limits for your Pi early on. Incrementally push-up the Overclock level in raspi-config, and boot into X, install a few packages to test stability. Don’t bother yet with expanding your root partition (lengthy operation on the reboot), or anything else, you just need to be able to test the stability. Once you find it’s stable at one level, run sudo raspi-config again, and up the level. At one point, you may find the package manager’s database is corrupt, the filesystem shows dirty on the boot up fsck, or it just fails to boot reliably – you have reached the limits of your Pi. Note the last stable setting, then reimage your card to eliminate any corruption which may have accured (to ensure your setup is stable) and update raspi-config again. While you’re at it, if you’re having stability problems – screen blanking out, ethernet going down, etc – measure the voltage over TP1-TP2 with a multimeter. Values less than 4.75v are questionable from a stability standpoint and may indicate you have a faulty polyfuse, or a recently tripped one which needs some rest.
  • Now use raspi-config to expand your partition to fill the card (to use the space), disable overscan (if not using on a TV, so the image fills the monitor screen), set your keyboard layout to English (US), Locale to English (AU) UTF-8, Timezone to Sydney (or wherever you are), enable your stable overclock, enable SSH and (if you’d like) start X as soon as it boots. Press Tab twice to highlight Finish and hit enter, and agree to reboot.
  • Now it will reboot and resize the partition – a lengthy operation. If the screen goes black, that’s because of the power saving, press the CTRL key and it will wake up and not interfere with the operation. Do not assume it has crashed, it probably hasn’t, especially if your card is large or slow. This will only happen once, so don’t panic, further bootups will be faster.
  • You should eventually be greeted with the LXDE desktop. Congratulations, your Pi is now running – it’s time to get the packages you need onto it, and get it working hard.

If you’re not so lucky and encounter trouble, there are many sources of potential issues. The new Raspberry Pi Troubleshooting FAQ covers a fair deal of them, and does a good job of it, so please give that a read.

My tips for a good Pi, as opposed to a burnt Pi or half-baked Pi:

  • Don’t buy from RS. You’ll wait forever for it to come from UK, and it’ll be a bad Pi.
  • Don’t unplug the Pi to shut it down. Just like a normal desktop computer, you do need to shut it down properly, or risk filesystem corruption and an unbootable SD card (necessitating repair/rescue using another Linux-running machine or a full re-image causing data loss and the need to reconfiguration). To shut it down properly, execute (via SSH or direct to a terminal) ‘sudo shutdown’ or ‘sudo halt’
  • Back-up your SD card periodically when you think you have something good going on. Most people will be using SDHC cards up to 32Gb, so a backup (especially after compressing the image) isn’t necessarily too onerous. Do a full image of the card – using dd under Linux, or using something like Winhex (my favourite multi-purpose hex editor). It seems easier for me just to image the whole card, that way you can even clone cards to run multiple Pis (but watch your network config, especially for those who’ve opted to go for static IP).
  • Want to serve something? Setting a Static IP is best, else make sure your DHCP server supports reserving or binding MAC addresses to a given IP address so that your port forwards continue to work.
  • Plugging in things – best done when Pi is off. USB devices, especially those with high current requirements or large filter capacitors are not supposed to be run off the Pi. At the least, they cause a reboot of the system upon plug-in which (just like an unexpected power-down) can have nasty consequences to your filesystem. High current devices will also place additional strain on the F3 main Polyfuse of 1.1A (for the whole system totalled) and could cause it to trip, meaning some time-out while it recovers. Best to put those on an externally powered USB Hub.
  • Power supply and USB cable quality cannot be overlooked. Thick cables and generous power supply ratings, no fake China made no-brand supplies (as most will not deliver their rated current cleanly) will definitely avoid annoying troubleshooting sessions which end up with the conclusion of a hardware fault outside the RPi board. Reading TP1-TP2 voltage is an indication, but not necessarily a guarantee, of the power quality as transient spikes and dips will escape the detection of most multimeters.
  • Use the biggest SD Card you can afford, with the highest class rating if you want to do serious stuff, or multimedia stuff, otherwise you will find yourself annoyed and running out of space. A 2Gb card will just hold the present rasbian-wheezy image, but leave you no room to move, given the actual OS eats up more than 75% of the card already. Running sudo apt-get update and sudo apt-get upgrade alone will run you out of room.
  • In case of running headless, it’s wise to have at least ssh enabled. For those who like interacting with the X environment, setting it to autostart is a nice feature, and then work on getting x11vnc server running on autostart. This will allow you to login remotely and view the screen, control the keyboard and mouse. Doing this can prove to be a bit of a challenge – my suggestions are:
  1. Get x11vnc by ‘sudo apt-get install x11vnc’
  2. Make a directory in ~ called .vnc
  3. Generate a password by ‘x11vnc -storepasswd YOUR_PASSWORD ~/.vnc/x11vnc.pass’
  4. Make a script called in ~/.config/autostart with the command ‘/usr/bin/x11vnc -forever -rfbport 5900 -rfbauth ~/.vnc/x11vnc.pass -o ~/.vnc/x11vnc.log -display :0’
  5. Make the script executable with ‘sudo chmod +x’
  6. Make a file called x11vnc.desktop also in ~/.config/autostart containing:

[Desktop Entry]

Name=X11VNC Server

Comment=Desktop VNC Sharing







  • Running headless will cause you some issues too – particularly screen resolution. The solution to that – go and edit your /boot/config.txt – change to the framebuffer size often will get you a larger remote screen even with nothing plugged into the HDMI/composite ports, otherwise you’re stuck at something tiny (720×480).
  • Want to install and search for packages easier – well go with the trusted and proven Synaptics Package Manager by issuing ‘sudo apt-get install synaptic’ from your nearest terminal. While you’re at it, setting up a LAMP server is easy, you’ve already got the L part, the rest – just add apache2, mysql and php5 to the mix. You might find php5 doesn’t work out of the box – that’s because you will have to install an apache2-mod to enable php5 – solve this by ‘sudo apt-get install libapache2-mod-php5’. Why not install phpmyadmin as well to make your life easier?
  • Don’t want your screen blanking? Well I find that installing xscreensaver, and disabling it from there seems to do the trick.
  • Wrong keyboard keys coming up for the symbols? Change the mapping from English (UK) to English (US) via raspi-config. While you’re at it, you might want to change the time-zone, and the locale to Sydney and English (Australia) respectively (or wherever you are).
  • Multimedia is a bit of a mixed kettle of fish. With raspbian, unfortunately, traditional media players like vlc don’t work quite as expected due to how the drivers seem to work. Instead, you will have to use omxplayer, built by the guys who ported XBMC to Raspberry Pi. Get it by ‘sudo apt-get install omxplayer’ – and invoke it to play a file using omxplayer -o hdmi <file name> or omxplayer -o local <file name> (first for HDMI sound, second for sound from local audio output). There are no controls as far as I’m aware and it is launched from command line, although a front-end probably exists somewhere. Media acceleration really only works for H.264, with other codecs requiring purchases due to royalty requirements, however, I’ve had 1080i at 9Mbit/s play back flawlessly.
  • Want to get it working with a VGA monitor? Be careful of the adaptors you use – those which are not externally powered will overload a schottky diode and cause a burnt Pi. Only used powered adaptors, compatibility will be a YMMV thing, playing around with overdrive values and modes in /boot/config.txt might help.
  • Want to know the temperature of the CPU or its current speed? Just add applets to your bottom toolbar and it will give you a readout. How nifty! My Pi is sitting at 53 degrees C – who doesn’t want to know that!?!
  • Don’t be afraid to play around with other distributions – depending on what you want to do, OpenELEC may be more to your liking if you’re using it as a media centre. Image your card in-between or just use a different card. It’s not so hard.

And finally, enjoy your Raspberry Pi adventure.

In owning this Pi, I’ve learn more about setting up a LAMP server, an x11vnc server, an FTP server, etc than I would have otherwise. It can be frustrating at times, but it’s like a game – with every set-back overcome, progress is made towards achieving something – and that something can bring quite a bit of pleasure from the sense of accomplishment one may get from such self-educational endeavours. And don’t forget, there’s always heaps of support online, should one wish to Google their problems, or even make a post about it at the Raspberry Pi Forums.

About lui_gough

I'm a bit of a nut for electronics, computing, photography, radio, satellite and other technical hobbies. Click for more about me!
This entry was posted in Raspberry Pi and tagged . Bookmark the permalink.

3 Responses to Getting Started with Raspberry Pi

  1. Irfan says:

    Thank you for sharing this. I do feel that the raspberry is not a consumer end product. It’s also not too different from previous arm single board computers, except that it is much much cheaper and has a really huge community base. So, let the learning begin…though painful 😀

    • Gough Lui says:

      I highly agree, it is definitely not a consumer electronics product like an AppleTV/WDTV, but unfortunately, with hype comes disappointment for some. It’s a fantastic tool for hobbyists – and for developers, there has never been more choices in terms of lost cost microcontroller boards (which I’ll make a bit of a post about later).

  2. Sparcie says:

    I thought they might also be useful as a basic X-Terminal for any other larger Unix based machines. I have a bunch of headless sun machines that would make it ideal for the pi to be a terminal for.

Error: Comment is Missing!