Here we will explain how we set up the Raspberry Pi computers that we use in the Perranporth School Code Club. It is not the only way it can be done but it has all the basics there together with a few extras that will be needed in the worksheets to follow.
What you should have.
We’re going to presume that you have a Raspberry Pi credit card sized computer in your possession. You will also need a screen of some sort as a monitor. The Pi will simply connect to a modern TV with an HDMI lead. Like other computers it will need a USB keyboard and a USB mouse. And power is supplied by a micro USB 5v power supply identical to a lot of mobile phone chargers. The power supply should provide 2 amp of power, not all mobile phone ones do. The official Pi power lead provides 2.2 amp and is only £5 so if you want to be really sure it will work get one of those. The last lead that is not essential but very useful on the initial set up is an ethernet connection to your router for the internet. Just for this start up it means that some really useful software can be installed. But it does not have to be done now and the instructions will still work after the install so don’t worry too much about it.
So the shopping list so far is:
- Raspberry Pi
- HDMI TV
- HDMI Lead
- USB Keyboard
- USB Mouse
- Micro USB Power Supply
- and …
- NOOBS Micro SD Card Operating System
The NOOBS –New Out Of the Box Software- SD card is the memory of the Raspberry Pi. NOOBS contains various version of operating systems that can be installed onto the card. The two most popular ones are the RaspBMC that turns a Pi into a media player centre and the one we will use here, the Raspian.
Put It All Together
Lets plug it all in. All the connections will only fit in their appropriate place so it’s not too difficult to work out. The micro SD card slots in underneath and is possibly the only one you will need to really look for. Before switching on switch your TV on first so that the Pi can find it on power up. So lets do that that. With everything connected turn the power on and have your finger ready to press a Shift key.
Some LEDs will light on the Pi and on the screen a multi-coloured square splash screen will appear followed by the Recovery screen. Press Shift on the keyboard.
The install screen will now show the various options to you. The first one, Raspbian, is the one we want. Use the arrow keys to get Raspbian highlighted in blue and a small cross in the box by pressing Enter. Now press i and Enter again. Raspbian will now install which will take around 20 minutes.
At the end a note will come up saying Os’s installed successfully. Press enter and away you go . The Pi will start to boot and the screen will fill with scrolling text. A set up screen will appear to finalise the procedure. There is nothing really here to do for now so select finish with the right arrow key then enter.
The Recovery Screen
While you’re waiting, a word about the Recovery Screen. This appears every time you boot the Pi with the card. Should you ever make a really big mess of your Piand nothing works then you can clear the card and reinstall the operating system again. Or in fact one of the others to try them out. Just press the shift key when the screen appears.
Lets Start Using the Raspberry Pi
Unlike using a Windows PC or an Apple Mac the Pi does not boot to a graphical user interface, GUI. That’s one with little icons you can click on. Instead you have a screen filled with loads of text. When the text stops moving and the Pi gets to the part of where it is asking for a user name you are ready to roll. This first time though this is not needed but from now on you will be asked for it. The user name is pi and the password is raspberry.
If you did not have an ethernet cable then now type startx and enter and the Pi will load the Graphical User Interface and you can now start using the Raspberry Pi.
If you do have an ethernet cable then you are ready to install some extra useful software straight away or you can do this later. Doesn’t really matter when but here is how you do it.
Install Geany, ScratchGPIO and Minecraft!
Adding new software is quite easy on a Pi. You just need to tell it do it it in a certain way. Sometimes the instructions seen really strange but just type it exactly as it is here and it should work. All the instructions are on a new line below and type them exactly word for word space for space as they are. First lets update the system so that everything is up to date with all the latest information. So at the pi@raspberrypi prompt type the following then enter:
sudo apt-get update
Loads of text will appear as the Pi downloads loads of information. When the pi@raspberrypi line reappears you can continue.
You upgrade the Pi to the latest version you can now type
sudo apt-get upgrade
But you do not need to do it. The idea is though that since the SD card was produced Raspbian may have gone through some changes to improve it. Upgrading matches your edition to the latest so it is good practice to do this occasionally. It does take a while to do though so if you want to start playing with the Pi maybe save it for later.
Update from December 2014
The Raspbian operating system has gone through a nice update that gives a more intuiative experience. After doing the update and upgrade commands above run the following too. As with the upgrade command it does take a while to run, be patient.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods
This is a useful editor that we use in the Perranporth Code Club to write the Python code to use inside Minecraft.
sudo apt-get install geany
That’s all it takes to install it. Most software packages can be installed this way. When asked “Do you want to continue?” click Y and enter.
Yet more scrolling text, a little wait and the pi@raspberrypi will appear again.
Scratch is already installed. But this version is different. It allows LEDs, switches, motors and other things to be controlled with by the Pi inside Scratch. The package is not installed as above as the software is downloaded from a website then installed. At the time of writing a new version 6 has just been released that supports the new A+ and B+ boards. It still has a few problems but they will be sorted quickly I’m sure. So lets install it.
wget http://goo.gl/xzJlz7 -O isgh6.sh
This gets the file to be installed. We now need to unpack it and install.
sudo bash isgh6.sh
And that’s it. When we start the Graphical User Interface there will be an extra Scratch icon on the screen.
Now to the one that is the most popular item with the Perranporth coders. A special edition of Minecraft Pocket Edition was launched for the Raspberry Pi. It enables simple game play together with the ability to program right into the game and out of it too. What Minecraft gives is an immediate feedback and reward to the coders in an environment they understand and want to control. They can teleport the character Steve, build houses or blocks of flats or create an ore detector. So use:
(If the above line appears as two write it down as one without a gap except after wget). Installation needs the following:
tar -zxvf minecraft-pi-0.1.1.tar.gz
Minecraft has been installed but running it is a little different. For that you’ll need our worksheet or the link to the Minecraft page above.
So that’s it. You are ready to go. At the prompt type startx and enter.
We hope that this helps you get started and enjoy using your Raspberry Pi. Check out the daily blogs on the Raspberry Pi Foundation page. There are loads of ideas to whet the appetite. Good luck and have fun.