Thursday 31 January 2013

Using the GUI

In my previous post "First Boot" I went through how to boot up the Raspberry Pi to the Linux command line. However for someone (like me) who is accustomed to using Windows, the Linux command line interface is not very user friendly! So now I will go through how to access the Graphical User Interface (GUI) which is provided as part of the Raspbian "wheezy" operating system.

Follow the procedure outlined in my previous post to get to the Linux command line prompt and then type the following and press Enter:

pi@raspberrypi ~ $ startx_

This will launch the LXDE desktop GUI which should be a more familiar environment for Windows users. LXDE stands for "Lightweight X11 Desktop Environment" and it is one of the many GUI's which can be used with Linux. It is very well suited to the Raspberry Pi because it is small (in terms of resource usage) and fast. For full details have a look at LXDE.org.


Click on the rather strange looking icon on the bottom left corner of the screen to display the "Start Menu" where you can browse through the various preinstalled applications. There are some shortcuts already on the desktop and you can add more while browsing through the items in the "Start Menu" simply by right-clicking on a menu item and selecting "Add to Desktop".

Double click on the "LXTerminal" icon on the desktop. This opens a terminal window with the familiar Linux command line prompt, so even when using the desktop GUI you still have easy access to the command line.


Close the LXTerminal by clicking on the "x" at the top right corner of the window or by clicking File>Quit, or if you prefer you can use the keyboard shortcut Shift+Ctrl+Q.

To close the LXDE GUI and go back to the Linux command line prompt click on the strange looking icon on the bottom left corner of the screen and then click on "Logout". You will then see the following confirmantion window:


Click on "Logout" to exit the LXDE GUI and return to the Linux command line prompt where you can safely shut your Raspberry Pi down using the "sudo halt" command as explained in my previous post.

Sunday 27 January 2013

First Boot

The time has come to boot up the Raspberry Pi for the first time...

Connect your USB keyboard and mouse to the two USB ports on the Raspberry Pi. Connect the Raspberry Pi to a suitable display (TV or computer monitor) using an HDMI (or HDMI to DVI) cable. Insert the prepared SD(HC) memory card into the card slot on the underside of the Raspberry Pi. Finally insert the micro USB power connector (making sure that the power adapter is switched on at the mains outlet).

If all goes well the red PWR (Power) LED on the Raspberry Pi board should light up and the ACT (Card Activity) LED should flash green. You will see many lines of text scrolling up on your display - this is normal. After a short time you will be presented with the Raspi-config screen:


Use the arrow keys to move down to the "expand_rootfs" command and press Enter. This will expand the root partition on the SD(HC) card to use all the available space - if you don't execute this command the root partition will only be 2 GB in size regardless of how much space is available on the SD(HC) card. When you execute the "expand_rootfs" command you will see some text scroll up your display and then you should see a dialogue confirming that the root partition has been resized:


Press Enter to close this dialogue and return to the Raspi-config "home" screen. I would recommend that you don't select any of the other commands at this time - although the Raspi-config screen only appears the first time the Raspberry Pi is booted, it can be run again at any time from the command line (you'll see how to do this shortly).

Use the right arrow key to move the cursor down until "Finish" is highlighted in red and then press Enter. You will see a dialogue asking you if you want to reboot now. Press Enter again to reboot the Raspberry Pi. Again you will see a lot of lines of text scroll up your display but eventually after the Raspberry Pi has rebooted you will see the following:

raspberrypi login: _

Type "pi" and press Enter. Now you will see the following:

Password: _

Type "raspberry" and press Enter (note that this time as you type the letters will not appear on the screen - this is to protect the security of your password). You should see some text scroll up your display and then you should see the following prompt:

pi@raspberrypi ~ $ _

This is the Linux command line prompt and it is something that you will become very familiar with. From here you can enter commands directly - for example you can run the Raspi-config application simply by typing "sudo raspi-config" as follows and pressing
Enter:

pi@raspberrypi ~ $ sudo raspi-config_

Finally, you need to know how to shut your Raspberry Pi down safely. Type "sudo halt" at the command line prompt as follows, and press Enter

pi@raspberrypi ~ $ sudo halt_

You should see some text scroll up your display and then your display may go completely blank. The PWR LED on the Raspberry Pi should be the only one illuminated. It is now safe to turn your Raspberry off by removing the micro USB power connector.

Saturday 26 January 2013

Preparing a Bootable SD(HC) Memory Card

The first thing you have to do is to decide what operating system you want to use. I would recommend that you visit www.raspberrypi.org/downloads and have a look at what's available. If (like me) you are new to Linux then the one to go for is Raspbian "wheezy". Download the .zip file to your computer - it is quite a large download (about 483 MB) and there are various mirror sites where you can download it from.

Once you have downloaded and extracted the .zip file you should have a .img file with a size of 1894400 KB (1.80 GB). This is the bootable image that you will write to your SD(HC) memory card, so obviously you'll need a card with a capacity of 2 GB or more.

In order to write the bootable .img file to your SD(HC) memory card you need to download Win32DiskImager (I'm assuming here that, like me, you are a Windows user). Extract the .zip file in the directory (folder) you want to run it from. You can create a shortcut for Win32DiskImager on your Windows desktop by right clicking on the Win32DiskImager.exe file and selecting "Send To Desktop".


Take your SD(HC) memory card - if it is brand new it should be ready formatted, but if you have previously used it in (for example) a digital camera you will need to format it in your digital camera first. If your computer has an inbuilt card reader/writer insert the SD(HC) card into the card reader/writer slot. If your computer does not have an inbuilt card reader/writer then you will need a USB memory card reader/writer like the one shown above (available from Cut Price Cables). Insert the SD(HC) card into the USB memory card reader/writer and then connect the USB memory card reader/writer to a USB port on your computer.

Double click on the Win32DiskImager shortcut on your Windows desktop and then click on "Run" if you get a Security Warning dialogue. The Win32DiskImager window should now be open.


Your SD(HC) card should show up under "Device" at the top right of the Win32DiskImager window - in the above screen shot the SD(HC) memory card is shown as D:\, but you may need to click on the drop down list to select the correct device.

A word of warning - I have a Toshiba laptop with an inbuilt card reader/writer, but Win32DiskImager refuses to recognise a memory card inserted into the inbuilt card reader/writer - I don't know why! However it works fine with a USB memory card reader/writer...

Now all you have to do is click on the small folder icon to the left of the "Device" drop down list and navigate to and select the .img file you want to copy to the SD(HC) memory card. Then click on "Write" and "Yes" when asked to confirm overwrite.

Writing the bootable image file to the SD(HC) memory card will take a few minutes. Once complete you should get a "Write successful" message - click "OK" and then click "Exit" to close the Win32DiskImager application. If you are using a USB memory card reader/writer you need to click on "Safely Remove Hardware" and then remove the USB device before removing the SD(HC) memory card.

You should now have a bootable SD(HC) memory card for your Raspberry Pi.

Friday 25 January 2013

Essential Accessories

In order to get the Raspberry Pi up and running you will need a few essential items...


First of all, you'll need a power supply with a micro USB plug that can supply 5 volts and is rated at 700mA or more. I found that the power supply belonging to my Blackberry phone did the job, but you can buy a suitable power supply from Cut Price Cables.


In order to interact with your Raspberry Pi you will need a USB keyboard, and if you intend to use a graphical user interface (GUI) you'll need a USB mouse as well. I chose a compact keyboard (available from Cut Price Cables) because I wanted to keep the overall size of the system as small as possible, but most USB keyboards (and mice) should work with the Raspberry Pi.


You'll also need to connect your Raspberry Pi to a suitable display, or monitor. The preferred method of connection is via the on-board HDMI output. Most modern flat screen TVs have HDMI inputs so you can simply connect the Raspberry Pi to a suitable TV using a HDMI cable and this has the advantage that it will carry both video and audio. If you wish to use a computer monitor then you'll need one with a DVI input, and use a HDMI to DVI cable (or adapter), however in this case you'll need to use the 3.5mm stereo jack if you require audio output from the Raspberry Pi. A range of HDMI and HDMI to DVI cables (and audio cables if required) are available from Cut Price Cables.


The final essential item you'll need is a SD (or SDHC) memory card containing a boot image of the operating system you want to use. The Raspberry Pi will boot from the memory card and save any applications and data on to it as well. The memory card will need to have a capacity of at least 2GB, but it is recommended that you use a 4GB or larger card to allow space for user data and applications. Ready to use memory cards with a choice of operating systems preinstalled are available from Cut Price Cables but it is reasonably straight forward to prepare your own memory card, and I'll go through the process of how to do this in my next posting.

Tuesday 22 January 2013

The Naked Truth

So what is the Raspberry Pi anyway? Well, it is a small (approximately the size of a "credit card") but fully featured, fully integrated computer with the following features (for the current 512 MB Model B) :
  • CPU : 700 MHz ARM Processor
  • GPU : Broadcom VideoCore IV
  • Memory : 512 Megabytes SDRAM
  • Data Storage : SD/SDHC card slot
  • Video Outputs : HDMI & Analogue RCA Composite Video
  • Audio Outputs : HDMI & Analogue 3.5mm Stereo
  • Network (LAN) : 10/100 Ethernet RJ45
  • Peripherals : 2 x USB 2.0 Ports
  • Low Level Interface : General Purpose Input Output (GPIO) header
  • Power Requirements : 5V DC via Micro USB socket or GPIO header
  • Size : 86mm x 54mm
  • Weight : 45 grammes
And here it is in all it's glory... (please note that the SD card slot is not visible in this photo because it is on the underside of the PCB)


It's not much to look at, but if you consider that it's real world performance is something like a 300MHz Pentium 2, but with graphics capabilities of an Xbox then you've got to admit it's pretty impressive. It's "party piece" is that it is capable of full HD digital video and audio output via HDMI thanks to the powerful onboard graphics processing unit (GPU).

The Raspberry Pi is available from Cut Price Cables for only £39.99 including VAT and free UK delivery. It comes with little in the way of documentation, but I will be covering basic setup in future posts. However here is a Quick Start Guide to get you going in the meantime.

Monday 14 January 2013

Hello World...

Finally I decided to delve into the wonderful world of Linux and the Raspberry Pi, and decided to write this blog to record my progress. I've been using computers for more than 25 years from way back in the good old days of MS-DOS and I've done some software development in my time. I've been on the Windows freight train from the start and have decided it's probably time to get off and have a look around at other options. Things have moved on.

Like a lot of people, the Raspberry Pi captured my imagination when I first heard about it. Could something so small and inexpensive really do so much? I was intrigued and as I looked further into it a whole new world began to open up. I'd heard of Linux before, but that was about the limit of my knowledge - it was just for running on file servers and the like, right? And so my journey began.