Читать книгу Adventures in Raspberry Pi - Carrie Anne Philbin - Страница 7

Adventure 1
You Have a Raspberry Pi- Now What?

Оглавление

IN THE PAGES of this book you’ll discover how to do great things with your Raspberry Pi. You’ll create art and music, programs, games, even create your own jukebox! But first, you need to get your system working.

If you are new to Raspberry Pi, the initial tasks of getting it set up and running might seem a little daunting but it is not that complicated to do. By setting up the Raspberry Pi yourself you will learn more about how it and other computers work. You will encounter technical jargon and procedures that you may not have come across before. In this chapter, I show you how to set up your Raspberry Pi so it is ready for you to use for the first time. I explain what hardware and software you need, and tell you how to put it all together into a working system. You’ll also learn how to create a backup copy of your system in case you need to replace it at some stage in the future.

Hardware refers to the physical elements of the computer that you can see and touch. This includes everything inside the computer case, known as components.

Software is the term given to the programs that run on the computer system. Programs are what make the hardware work, for example by making a calculation or organising your files. There are two main types of software: systems software, which runs and manages your computer; and application software, which performs a specific task or function.

What Hardware Do You Need?

Of course, the first thing you need is a Raspberry Pi. If you have used games consoles or computing devices before, you’ll notice something different about Raspberry Pi – it doesn’t come with a power supply, a charger or any connecting cables. It doesn’t have a storage device to keep your programs on either, or even a case!

So, to get started, you will first need to get the following hardware together (see Figure 1-1):

● A Raspberry Pi

● A micro USB power adapter

● A USB keyboard and mouse

● A desktop computer or laptop with an SD card reader/writer – this is to enable you to prepare an SD card with the software you need to run your Raspberry Pi

● An 8 GB SD card for use with the Model B or an 8GB micro SD card for the B+

● An HDMI cable – you will be using this with an HDMI TV or monitor

● A monitor or TV

When I refer to SD cards in this chapter and throughout this book, I am also referring to micro SD cards, which the Raspberry Pi model B+ uses.

HDMI stands for High-Definition Multimedia Interface. HDMI devices are used to transfer video and audio data from a source device – such as your Raspberry Pi – to a compatible HDMI device like a digital TV or monitor.

USB stands for Universal Serial Bus. You have probably used a USB port on a computer to plug in a webcam or a portable memory device like a memory stick.

An SD card, or Secure Digital memory card, stores data or information. SD cards are most often used in digital cameras to store images that can then be transferred to a computer using an SD card reader. A micro SD card is much smaller in physical size, and the Model B+ uses them instead of a standard SD card.

FIGURE 1-1 The essential hardware you’ll need before you can use your Raspberry Pi Model B or Model B+.


What Other Equipment Is Helpful?

The following additional accessories are not vital but you might want to consider acquiring some of them to improve your Raspberry Pi experience.

A case– To protect your Raspberry Pi from damage and make it easier for you to carry, think about buying a case like the PiBow shown in Figure 1-2, designed and manufactured by Pimoroni (http://shop.pimoroni.com/collections/customise-your-raspberry-pi). The great thing about this case is that it’s colourful and fun, and the ports are also labelled to remind you where each cable should be inserted.

FIGURE 1-2 The PiBow case can help protect your Raspberry Pi.

Reproduced by permission of Pimoroni


If you don’t want to spend cash on a case, why not create your own by using the Raspberry Pi Punnet? This template can be printed onto card stock, and then cut out and folded into a box. You can really let yourself get creative here and customise your case using pens, paints, stickers or coloured card stock to create a masterpiece. You can download the template from this site: http://squareitround.co.uk/Resources/Punnet_net_Mk1.pdf.

Want a sturdier case? Build one with Lego blocks! You can find instructions to build the Lego Raspberry Pi case shown in Figure 1-3 on the official Lego website at http://www.thedailybrick.co.uk/instructions/.

FIGURE 1-3 Build a Lego case for your Raspberry Pi.

Reproduced by permission of The Daily Brick


A few spare SD cards– It’s worth having a few extra cards just in case the one you’re using becomes corrupted or stops working for any reason. They are also useful for backing up your files and projects – I explain how to do this at the end of the chapter.

An SD card reader/writer– You’ll need an SD card reader/writer to enable you to put the Raspberry Pi operating system software onto an SD card. You download the operating system software onto your computer, plug the card reader into a USB port on your computer and use it to copy the OS onto an SD card that you can then load onto your Raspberry Pi. Many desktop computers and laptops are already fitted with an SD card reader and writer but if your computer or laptop doesn’t have one, you will have to get an external USB card reader.

A Raspberry Pi camera module– The Raspberry Pi camera module is a Raspberry Pi camera board accessory for the Pi. It connects to the Pi with a flex cable and can be used to take digital images of whatever the camera is pointed at.

A Wi-Pi– The Wi-Pi is a small wireless dongle designed to be connected to a USB port on the Raspberry Pi so that you can add your Raspberry Pi to a wireless network, perhaps to share an Internet connection or files with other computers on the network.

● A PiHub – As the Raspberry Pi has only two USB ports, you may find you run out of ports to plug in all your devices like a keyboard, mouse and WiFi dongle. The PiHub (http://shop.pimoroni.com/products/pihub) is a USB hub designed to work with the Raspberry Pi so that you can have access to more USB ports.

Setting Up the Raspberry Pi

Getting your Raspberry Pi up and running takes just three main steps. First, you need to download the operating system software and copy it onto an SD card. Next, you hook up the hardware – the mouse, keyboard and other components. Finally, you install the software onto your Pi and configure a few settings. The next few sections walk you through this process for a smooth launch. Don’t worry: Doing the actual steps is much easier than reading these instructions!

For a video that walks you through the steps of setting up your Raspberry Pi, visit the companion website at www.wiley.com/go/adventuresinrp2E. Click the Videos tab and select the SettingUpRaspberryPi file.

Downloading and Copying the Raspbian Operating System

All personal computing devices need an operating system (OS) to make them run. You’ve probably used a computer or laptop before, and the likelihood is that your computer’s operating system was Microsoft Windows for a PC, or Mac OS X for a Mac computer or Macbook. The Raspberry Pi can run a number of operating systems, but the OS most people use is Raspbian, which is a distribution of the free Linux operating system. The projects in this book assume you are using Raspbian on your Raspberry Pi, and the instructions in this section tell you how to download and install it.

More About Operating Systems

An operating system (OS) is a type of software that allows people to create, store and manage files and applications that contain information on a computer. Examples of popular operating systems include Microsoft Windows, Mac OS X and Linux.

Linux is a free, open source operating system. This means that the programming code it is made with is free and open for anyone to look at and possibly improve on. There are many versions, or distributions, of the Linux operating system available. Raspbian, the OS you use on the Raspberry Pi, is a Linux distribution. You may have heard of some other well-known Linux distributions, such as Ubuntu, Debian, or Fedora.

Raspbian was created by a community of thousands of volunteers world-wide. You

can connect to this community and learn more about Raspbian and Linux at www.raspbian.org.

Preparing an SD Card to Store Your Software

A desktop or laptop computer uses a permanent storage device called a hard drive to store information and applications. The Raspberry Pi doesn’t have a hard drive, however, so your operating system, applications, and information all have to be stored on a removable SD card or micro SD card. This type of storage, known as flash memory, is the same as the kind you use with a digital camera to store all your photographs.

Before you plug in all the cables and so on, you first need to prepare (or flash) an SD card with the software the Raspberry Pi needs in order to run. This means that you format your SD card or micro SD card and copy the free Raspbian OS onto it. If you don’t do this step, your Raspberry Pi won’t recognise it as a storage device (like the hard drive of your computer) from which you can boot software. Don’t worry if these terms are unfamiliar to you – all will become clear as you read through this section.

The first thing a computer does when you turn it on is to start up, or boot, the operating system.

You can buy SD cards with the Raspbian software preloaded onto them. This type of card allows you to get up and running straight away and you can skip the instructions on how to install the Raspbian software. However, I recommend you walk through the installation steps in this chapter, rather than using a preloaded card. It’s useful to learn how to complete the formatting process yourself so that you understand how it’s done and can start fresh if anything goes wrong.

Your card must be formatted, as described in the following steps, before any software is loaded onto it.

1. The best way to ensure that the card is formatted correctly for use is to download, install and use SD Formatter 4.0 (www.sdcard.org/downloads/formatter_4) from the SD Association to your desktop or laptop computer. (The built-in Windows formatting tool will only format the first partition and not the entire disk, so it is important that you use the SD formatter 4.0 tool instead.)

2. To download SD Formatter, follow the link in Step 1, and select either SD Formatter 4.0 for Windows Download or SD Formatter 4.0 for MAC Download. Read and agree to the terms and your download will begin. Once the download is complete, extract the file by clicking on Extract All and then run the setup application following the onscreen steps.

3. With the SD Formatter installed on your computer, run the application. Make sure that it has the right drive selected for your card; for example it might be labeled D: or F: (see Figure 1-4).You can find out which drive is your SD card by looking in My Computer on a Windows computer or using Finder on Mac OS X.

The program will wipe all data from the card, so make sure you select the correct drive!

4. Click the Option button and select FULL (erase) from the drop-down menu. When you are ready, double-check that you have the correct drive selected, and click Format.

FIGURE 1-4 Formatting an SD Card using the SD Formatter application


Making It Easy with NOOBS

With your SD card formatted, you’re ready to copy the Raspbian software onto it. The New Out Of Box Software (NOOBS) produced by the Raspberry Pi Foundation allows you to copy the files you need straight onto the SD card like you would do with photo or document files. It gives you the option of selecting which operating system you want to install, and even provides recovery should you accidentally delete all your software files.

If you are using a micro SD card, then you may need an adapter so that it fits an SD card reader slot. The official Raspberry Pi NOOBS card has a micro SD card inside it, so you can use it as an adapter.

All the projects in this book are designed to run using the Raspbian OS included in the NOOBS software. I recommend ensuring that you use the latest version of NOOBS before starting any projects in this book, otherwise you may have difficulty getting some of the projects to work.

First, you need to download NOOBS onto a desktop or laptop computer with an SD card reader. After you download the software, you will save it to an SD card for use with your Raspberry Pi. The following steps walk you through the process:

1. Navigate to the Raspberry Pi website at www.raspberrypi.org and click the Downloads tab at the top of the page. The New Out of Box Software that you are want to download is at the top of the page. Click the link to select the latest NOOBS .zip file.

The download file is a compressed .zip file. Save the compressed file to your desktop or laptop computer, and then extract the files by right-clicking on the file and selecting the Extract All option (on a Microsoft Windows computer). You will then be given the option to extract the files to a directory or folder of your choice so that you will easily be able to find after the extraction is complete, as shown in Figure 1-5.

FIGURE 1-5 Extracting NOOBS to a directory on a windows computer


2. Place your formatted card into the card reader slot on your desktop computer or laptop. Now copy the extracted NOOBS files from the directory or folder on your computer and paste them onto your newly formatted SD card. You can do this either by dragging the files from one window to another, or by highlighting them all with your mouse, right-clicking, and copy/pasting the files onto the card.

You should always download the latest version of NOOBS as the software is being updated all the time. The latest version is usually listed at the top of the page with a version number.

Plugging in the Hardware

Now it’s time to get your Raspberry Pi up and running. Find yourself a solid surface, like a desk or table, big enough to hold all your equipment. Make sure it’s near some main plug sockets. Ideally, you should also have access to a network device like a router because you will likely want to access the Internet on your Raspberry Pi at some point, but this is not necessary at this point to set up your Pi.


Конец ознакомительного фрагмента. Купить книгу
Adventures in Raspberry Pi

Подняться наверх