RaspberryPi 101: Part #2 – Setup

So part 1 was a quick intro to what a pi is and what it can do. This post is about getting and setting yours up.

Installation

1. Get a raspberryPi

You can get one from a few places these days, but the big UK reseller is element14/Farnell
element14 farnell

2. Get a linux distro

As mentioned in the last post, you can get a few different operating systems to run and the recommended ones to start with are on the raspberrypi website

3. Put the distro on a suitable SD card

3.1 Writing the image to the SD card

The methods for doing this differ depending on your dekstop OS;

  • Mac and Linux you can use the existing “dd” and “df” commands to check and write the image to the SD card
  • For Windows you need to use the Win32DiskImager “used for writing images to USB sticks or SD/CF cards on Windows”

3.2 BerryBoot

Steps 2 and 3 can actually be shortcut by either buying an SD card with a distro already installed, or installing BerryBoot bootloader which bootstraps your installation to give you the easiest possible route to installation:
berryboot

Berryboot is OSS and you can even dig into the source over on github

Random tangent #1: HDMI CEC
BerryBoot supports the fantastic HDMI CEC which “is an HDMI feature designed to allow the user to command and control up-to ten CEC-enabled devices, that are connected through HDMI, by using only one of their remote controls”; this means that you don’t even need to connect a keyboard for most of the berryboot setup process and can just use your tv remote.

There’s more info over on elinux about just how important CEC is for HDMI capable devices and writing software for these devices.

Want to start understanding the CEC messages? Check cec-o-matic

This is the same feature that XBMC uses to allow full and simple navigation of the media centre features just using your remote control – more on XBMC later.

Checkpoint! Base Installation Complete

You’ll now have a version of linux (or RISC OS) running on your pi. If you’ve chosen RISC then I can’t really help you, since the last time I used it was playing games on my uncle’s computer as a young lad (check out those vids – classic 90s gaming at its “best”).

Anyway. From here on in I’ll assume you’ve gone with Raspbian. Wheezy should be pretty much the same I think.

Starting it all up #1: Raspbian

Plug it all in

Put the SD card in, the HDMI cable to your tv/monitor, the network cable in, your USB keyboard which you’ll need for the initial installation (unless you’re berrybooting with it’s CEC awesomeness), and finally the power cable; there is no power switch on the pi so once the cable is plugged in you’re running.

You should see the initial configuration screen where you can setup the locale and turn on SSH (do so).

Then you can choose to get to a terminal or boot into a desktop environment.

SSH

With raspbian this is just a case of enabling ssh from the config menu; after that you can ssh in from another machine on the same network. If you don’t know the IP address of your pi, either plug it in to an HDMI capable display and execute “ifconfig” or just check the devices attached to your router from the router admin screen.

more info on pi ssh

Bluetooth

Setting up a bluetooth keyboard may not be much use if you’ve already got ssh running and want to access the terminal only, however if you’re accessing the pi directly you will either need to plug in a USB HCI device (keyboard/mouse) or set up bluetooth.

1. Get a supported device

There’s a list of confirmed working devices over on elinux.

I went for the dinky little TOPDIGI UA01 Bluetooth USB Dongle from Amazon
TOPDIGI UA01 Bluetooth USB Dongle from Amazon

2. Setup bluetooth on the pi

2.1 install bluetooth software

[email protected] ~ $ sudo -s
[email protected]:/home/pi# apt-get install bluez

2.2 scan for nearby devices

[email protected]:/home/pi# hcitool scan

Your device should appear in those found; use the MAC in the following steps.

2.3 pair your pi to the device

[email protected]:/home/pi# bluez-simple-agent hci0 00:11:22:33:44:55
RequestPinCode: 0000
Enter PIN Code: Release
New device (/org/bluez/3964/hci0/dev_00_11_22_33_44_55)

Obviously your MAC will be different to the dummy one I’ve used..

2.4 trust the paired device so it’ll auto connect in future

[email protected]:/home/pi# bluez-test-device trusted 00:11:22:33:44:55 yes

WiFi

Since I’m bored with swapping the ethernet cable from my tv to get this on the network (the switch has no spare ports.. too much living room tech..), I’ve just ordered an Edimax EW-7811UN 150Mbps Wireless Nano USB Adapter
Edimax TEEEENY TINY wifi adapter

Portable Power

Since I’m bored with swapping my phone charger over to power the pi, I’ve just ordered a PowerGen 5200mAh External Battery Pack High Capacity Power Bank Charger
Powergen

I’ll report back on how they work out for me soon. I should find that having a fully portable pi will allow me to mess around with it even more!

Summary

That’s it for this one! You’re now set up with a Linux computer, bluetooth keyboard, and ssh. You can do with this whatever you would do with a normal low power distro (Puppy, DSL, #!.. or is it !#.. hmm..), but you can also interact wiht the outside world via GPIO.

Next Up

I’ll be installing XBMC and having a play. I play, so you don’t have to. See? I care.