Search This Blog

12 September 2012

Turning on the Raspberry Pi for the first time


Previous sections of this story:

So - you've bought your Raspberry Pi and installed an operating system on it.

Now to switch it on, all you need to do it plug it in. The RPi doesn't have an on-and-off switch, as such. You just plug in the micro-USB cable and it switches on.

If you're using an HDMI connection to a TV (or other HDMI monitor), make sure you've got it plugged in before you start it up. If Raspbian doesn't detect a connection on the HDMI port, it "fails-over" to the Composite Video port. Once that has happened, it's difficult, if not impossible to get the RPi to switch back over to the HDMI port, for video, without completely restarting it.

Configuration

Make sure you've got your keyboard plugged into one of the USB connections in your RPi, because... the first time you see it boot up (assuming you installed Raspbian) you will see this screen.



This is the "raspi-config" screen.

On first boot-up, I used the "expand_rootfs" option - so that the whole of my SD card was available to the root partition. You will probably want to do this too, especially if you have a card bigger than the minimum required 2Gb.

I also enabled the SSH server, using this tool. I found this invaluable later on. It was much simpler to SSH into my RPi from my other computers on our home network, than it was to keep it plugged into our main television. I now have the RPi set-up so that I can SSH in from my Android Phone, using PaderSyncSSH. I tried a few different SSH clients - but this was the only one that really worked (easy control key commands, intuitive SSH interface etc.). It costs - but you get a 30-day trial... I'll have to work out if it's worth paying for in another couple of weeks time - but considering I've used it every day since downloading, I'm leaning towards "yes".

You'll want to reset the default "pi" password. You don't HAVE to do this now - but please DO do it before plugging the RPi into a network and exposing it to the Internet. The default password for the "pi" user is the same for every basic install of Raspbian - and therefore represents a security risk if not changed.

You can come back to this screen any time with the command:

raspi-config

When you're finished... select "Finish".

First Prompt

Log in, using the default "pi" user, and either the default password - "raspberry" - or whatever you changed it to, above.

So then you're presented with your first:

pi@raspberrypi ~ $
At this point, the world is your oyster.

I'm still getting around to installing a light-weight web-server - just for the hell of it.

You can do... whatever you want really.

XWindows

As one of the first trials, I ran:
startx
to see the XWindows GUI up and running. I discovered a lot of really great pre-installed games. I say they were really great because they were perfect for getting my daughter engaged in the process. I found "scratch" a great tool for introducing the basic concepts of programming.

I plugged the RPi into our home router, opened up a browser... and it just worked. We had internet... what else could you ask for?

From here, it's all up to you.

But now, your Raspberry Pi is lying on a table, strung between its power source, the television and the home router... blinking away happily - but looking a little fragile - and you ask "shouldn't she have a home?"

Continue: "Buying a house for my new lover" >>


 All sections of this story:


Buying a house for my new lover


Previous sections of this story:

I've been spending enough time with my Raspberry Pi, my wife has stated to make jokes about along the lines of "When I worried about you 'finding someone else' I didn't think it was going to take the form of a new computer".

We call her "Debbie".

And the issue was further complicated, today, when I bought Debbie a house to live in. Considering we don't yet own our own house... I can understand my wife's sense of jealousy... but considering it only cost me $5, I don't think she should feel *that* bad.

I shopped around for a while and considered a number of different options.

My first favourite idea was that of the lego box. In fact I'm still determined to build it - I just haven't had the time to track down the right parts in my old big bag of lego blocks. And then there's this guy's LEGO plans which are a little more involved and serious - but look kind of cool.



Cheap Plastic is Cool

But then I found this:


The review I found that convinced me to get it was from a blog called "Raspberry Pi Pod". It's a good read, if you're interested in getting one of the same - and it contains great instructions for dealing with the German website.

In a strange twist of fate, it turns out the case is made in the town that the father of someone I work with was born in... but that's beside the point...

At first, the delivery cost seems to count it out, as an option. While the case itself is a cheap 2,95 Euros, the delivery was (a comparatively ridiculous) 4,95 Euros. But then I got to thinking... in the end, I bought 10 of them, for a combined cost (including all delivery and transaction costs) of $48.70. So ostensibly they cost $4.87 each. I know enough people who want cases for their RPis that I've already passed 6 of them on for $5 each. It's not a money making concern - but it was a neat way to get the case I wanted for $5 myself.

The rest I'm going to knock off on eBay for, say maybe, $6 each. If I'm lucky, I'll come out even on the whole deal, and can count the case as having been free - which would be nice.

So - Debbie's new house came in the post today... and it was REALLY easy to put together. There's a good assembly video on the IP Adelt website.

for some reason...
I really enjoyed the fact
that it was a addressed
to "Herr Nicholas Gledhill"
It's actually not that easy to put her in *after* you've put the box together... but then I still didn't manage to ruin it - and the snug fit is actually one of its great qualities.

N.B. You will need to take the SD card out of its slot (and, obviously, unplug anything else from the Pi) in order to fit it in. It takes a little bit of squeezing, and bending of the walls to make it all happen. But if you work from getting the SD card end in first, and then concentrate on getting the USB ports into position - it should all be fine.

The port holes line up perfectly... I couldn't have hoped for better, for $5 - and Debbie says she likes her new home quite a lot.

She wants me to visit as often as possible... but my wife is suspicious. I think she knows there's something going on...







04 September 2012

Raspberry Pi - Element14's latest geek toy

Raspberry Pi, newly born
So Element14 recently released the Raspberry Pi.

Here's mine, from the day I got it:

What is the Raspberry Pi?

Well, it's a fully functional 700Mhz computer. That costs only $38. That's right, $38. If you're already interested enough to go buy one, you can order it from here:

The Raspberry Pi page on Element14's website

But if you don't immediately "get" what's so exciting about a fully functioning computer for $38, then you're probably asking most common question I get, when I try to tell people about it...

Continue: "What can you DO with a Raspberry Pi?" >>





What can you DO with a Raspberry Pi?

Previous sections of this story:

The RPi ports and chips detailed
Well, originally, the Raspberry Pi (when I first heard about it anyway) was posited as a way to "get kids back into programming" - the idea being that, because it came with a C compiler and a Python programming option, as part of its standard operating system (the "Raspian" version of Debian), that people would be "forced" to think about the machine from a simple perspective, and get back to basics.

It was seen as the next wave in the hobbyist-do-it-yourself "kit" computer movement. Back to "the good-old-days of the Apple II" when you bought the board and built the case for it, yourself...

But I think it's a lot more than that - and far more interesting, in its own way.

It really is a fully-functioning computer. 700Mhz single-core might sound like a slow machine, now... but those of us who are old enough remember when that was faster than the state-of-the-art top level machine you would have bought for more than few thousand dollars.

For years I've been asking "why can't we keep producing the same chip for longer, and make it so cheap that anyone can get one" - instead of just ramping up to the next "generation" of chips, and continuing to pay top-dollar for them... and the answer is... we have! And the Raspberry Pi is one of the results.

Once you've got a Linux distribution up and running - the sky's the limit. You can do anything you would do with a "normal" computer. In fact, in pretty much all respects... this IS a normal computer... it just costs $38.

Continue: "So... What did I do with my Raspberry Pi?"




So... What did I do with my Raspberry Pi?

Previous sections of this story:
Linux - Debian
After looking around for a while, and talking to one of my colleagues, who got their Raspberry Pi (hereafter, sometimes, referred to as "RPi") shortly before I did... I discovered that there was a "standard" install of Linux that had been packaged up, specifically for the RPi.

The community of RPi enthusiasts had got together, already, to package up a "disk image" just for users such as me (non-experts in either hardware, Linux or the relationship between the two) - thus making the whole thing a lot simpler.

Other things you will need

There are a few extra things you will need, to make your Raspberry Pi usable. They include:
  • a keyboard
  • a mouse
  • an SD card
  • something as a monitor
  • a power source

The "budget" effect

Having bought a computer for $38, you might find that other things suddenly start looking a lot more expensive. Suddenly, having to spend an extra $10 on your set-up feels like a very large % of the overall cost...

The SD Card

The SD Card you need is essentially the computer's "hard disk". It's where all the data the RPi will use to start-up is kept. There are fancy ways of starting-up with an SD card and then "switching over" to other sources - which I don't quite understand yet... but there's no escaping the need for an SD card to begin with.

Originally, I managed to source a 2Gb SD card for $7. I was told that I could find one for $4 in the Capitol Shopping Centre - but I must have walked into the wrong stores as I couldn't find any cheaper than the $7 I spent. It was a SanDisk - apparently a good brand, and fast - which can make some difference.

However, after loading the standard "Raspbian" image and then downloading a few packages, I found it wasn't large enough. After a couple of days I "bit the bullet" and bought another SD Card - an 8Gb SanDisk Card for $15.

I have ended up using the original 2Gb card as my daughter's Raspberry Pi set-up. As I will describe in more details later - the basic Raspbian set-up includes some quite interesting games, easily accessible from the GUI - which were really good for getting my daughter interested in this new toy I had brought home.

So - in my mind, I ignore the cost of the 2Gb Card, and see the total set-up and having cost $38 for the main hardware and $15 for the data storage.

The Keyboard and Mouse

The keyboard I used was a "roll-up" keyboard that we had lying around from years ago... by vague recollection it cost $10 at the time - but I like to think of it as a free addition to the infrastructure. Until now I have simply used a mouse from one of the other desktop computers in the house - another "free" addition.

The Monitor

So, now we come to the "monitor". It turns out that the Raspberry Pi has 2 monitor interface options:
  1. HDMI
  2. RCA
The VZ-200 - with RAM extension
HDMI covers most modern, flatscreen monitors - and RCA covers most old TVs and "composite" monitor options. But lots of cheap VGA monitors are therefore excluded. It reminded me slightly of my old VZ-200 (the first ever computer I owned), that plugged directly into a TV via an RF connection.

After thinking about it for a while, I realised, the only HDMI cable in the house was plugged into the back of our wall-mounted flatscreen TV - and was going to be difficult to remove. So, that made the TV pretty much my only option for a monitor, for now. I have a monitor, in my desktop set-up, that accepts HDMI, but I would need to buy a new HDMI cable in order to make it work - and the another $18, minimum, from china town.

And, as I've spoken about already, all these extra costs seem quite high, in the new world of the Raspberry Pi.

So - I settled for the TV, as a starting point. The TV in question was a present, from my brother-in-law... so I'm still counting that as a "zero-cost" to the project as a whole.

If you're happy logging into a machine via SSH, I'll describe, in a later post, how you don't really need a monitor once your RPi is up and running.

The Power Source

micro-usb plug
Finally, the RPi will run off any steady 5V source, using a standard micro-usb connection. Any standard USB cable will do. Most standard phone chargers will do. Myself, I plugged it into the USB port of the monitor of my desktop computer.

Apparently, there are ways to use AA battery packs to run it off - but there are some wrinkles regarding making sure the voltage doesn't drop below 5V. And, unfortunately, money seems to buy quality. Finding a low cost battery solution that supplies a steady 5V seems less than simple. I will update, here, should I find any further info.

Continue: "Installing an operating system on a Raspberry Pi" >>




Installing an operating system on a Raspberry Pi

Previous sections of this story:
So, in order to get the RPi up and running - you need to put an operating system onto your new SD Card.

In order to do this you need some way or writing to an SD card. Myself, I originally tried to use the SD Card slot in my MacBook Pro Laptop. I had been warned, by a colleague who had already set-up his RPi, that he had experienced trouble with his Mac Card Slot - so I was a little quick to give up on that option, when I had difficulty, and borrowed a friends USB SD Card writer.

Over the next weekend, without access to to the USB hardware, I discovered that the card slot in my laptop appeared to work just fine. Same brand of disk - only difference? the size... so that issue is, as yet, unresolved. Does the Mac card slot have trouble with some SD cards? I'm not sure.

Either way... once you have a reliable way of reading/writing from/to an SD card... the installation is fairly easy.

Other options I never tried


For other options, see the Raspberry Pi Downloads page. Apparently you can buy a preloaded card from RS Components, element14 or The Pi Hut's Raspberry Pi Store. But I can't vouch for these options.

Lots of other options for, apparently, easier ways to get installations can be found on the RPi Easy SD Card Set-up page. This page is also good it your are not, as I was, using a Mac to set this up.

What I DID do


I downloaded the Raspbian "wheezy" distribution.

Start with your SD card NOT plugged in.

Assuming your download is in a directory "~/Downloads/" - called "2012-08-16-wheezy-raspbian.zip" - extract the image using the command:

unzip ~/Downloads/2012-08-16-wheezy-raspbian.zip

Now - run this command... trust me, it'll make sense in a sec:

df -h

NOW - plug in your SD card (connect your USB card reader, etc.). Run the same command as above again, "df -h", and record the name of the device that wasn't there before. It will look something like:

/dev/disk3s1

Now you need to unmount the disk - replacing the reference, below, with the name of the device you recorded in the previous step:
sudo diskutil unmount /dev/disk3s1

You now need to work out the raw device name for the entire disk.

  1. use the device name you recorded above - for e.g. "disk3s1"
  2. omit the final "s1" and replace "disk" with "rdisk" - so "disk3s1" becomes "rdisk3"
    1. N.B.: this is very important: you will lose all data on some other device on your computer if you get the wrong device name

Use the "raw disk" name you worked out, above - for e.g. "rdisk3"... run the following command:

sudo dd bs=1m if=~/Downloads/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/rdisk3

N.B. if the above command reports an error (dd: bs: illegal numeric value), please change bs=1M to bs=1m - this is, apparently, an odd Mac quirk - i.e. the "standard" command uses "bs=1m" but Mac implementation of the "dd" command usually require "bs=1M".

This will take a few minutes to run. If you want feedback on what's going on, type "ctrl-T".

Eject the card, using:

sudo diskutil eject /dev/rdisk3

And that was it.

Then you plug it into the, convenient, SD card slot in your new Raspberry Pi - and switch it on.

There are a few little set-up quirks to consider, built into the configuration of Raspbian - but we'll cover those in...

Continue: "Turning on the Raspberry Pi for the first time" >>