Book Image

Raspberry Pi Robotic Projects - Third Edition

By : Richard Grimmett, Jon Witts
Book Image

Raspberry Pi Robotic Projects - Third Edition

By: Richard Grimmett, Jon Witts

Overview of this book

This book will allow you to take full advantage of Raspberry Pi Zero and Raspberry Pi 3 by building both simple and complex robotic projects. The book takes a mission-critical approach to show you how to build amazing robots and helps you decide which board to use for which type of robot. The book puts a special emphasis on designing mobile (or movable) robots using the Raspberry Pi Zero. The projects will show inexpensive, yet powerful, ways to take full advantage. It will teach you how to program Raspberry Pi, control the movement of your robot, and add features to your robots.
Table of Contents (13 chapters)
Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Installing the operating system


Now that your hardware is ready, you need to download and image an operating system to a microSD card. The Raspberry Pi 3 provides a lot of different choices. You'll stick with Linux, an open source version of Unix, on your Raspberry Pi 3. Linux, unlike Windows, Android, or iOS, is not tightly controlled by a single company. It is a grassroots effort from a wide community, mostly open source and, while it is available for free, it grows and develops a bit more chaotically.

A number of different versions of Linux have emerged, each built on a core set of similar capabilities referred to as the Linux kernel. These core capabilities are all based on the Linux specification. However, they are packaged slightly differently, and developed, supported, and packaged by different organizations. The Raspberry Pi community has become standardized on Raspbian, a Debian distribution of Linux for the Raspberry Pi. So, you are going to install and run Raspbian on your Raspberry Pi 3.

The newest version of Debian is called Jessie, after the cowgirl in Toy Story. This is the naming convention for Debian, and you need to download this version of Raspbian.

You can purchase a card that has Raspbian installed, or you can download it onto your personal computer and then install it on the card. To download a distribution, you need to decide if you are going to use a Windows computer to download and create an SD card, a MAC OS X, or a Linux machine. Here are the steps for Windows and Linux machines:

  1. Firstly, you need to download an image. This part of the process is similar for both Windows and Linux. Open a browser window, go to the Raspberry Pi Foundation's website, https://www.raspberrypi.org/, and select the Downloads selection at the top of the page. This will give you a variety of download choices. Go to the Raspbian section, and select the .zip file just to the right of the image identifier. You need the latest version, but not the lite one. This will download an archived file that has the image for your Raspbian operating system. Note the default username and password; you'll need them later.

  2. If you're using Windows, you'll need to unzip the file using an archiving program such as 7-Zip, available at http://www.7-zip.org/. This will leave you with a file that has the .img extension—a file that can be imaged onto your card. Next, you need a program that can write the image to the card. I use Image Writer for Windows. You can find a link to this program at the top of the download section on the http://www.raspberrypi.org website.

    Plug your card into the PC, run this program, and you should see the following:

  3. Select the device card and the image you downloaded earlier; it should look something like the following screenshot:

  4. Click on the Write button. This will take some time, perhaps as long as 15 minutes. When it is complete, exit the program and you'll have your microSD card with the image.

  5. If you are using Linux, you need to unarchive the file and then write it to the card. You can do all of this with one command. However, you do need to find the /dev device label for your card. You can do this with the ls -la /dev/sd* command. If you run this before you plug in your card, you might see something like the following screenshot:

  6. After plugging in your card, you might see something like the following screenshot:

  7. Note that your card is at sdb. Now, go to the directory in which you downloaded the archived image file and use the following command:

    sudo dd if=2015-11-21-raspbian-jessie.img  of=/dev/sdX
    
  8. The 2015-11-21-raspbian-jessie.img command will be replaced by the image file that you downloaded and /dev/sdX will be replaced by your card ID, in this example, /dev/sdb. Be careful to specify the correct device, as this can overwrite the data on any of your drives. Also, this may take a few minutes. Once the file is written, eject the card, and you are ready to plug it into the board and apply the power.

Now that you have completed those steps, make sure that your Raspberry Pi 3 is unplugged and install the SD card into the slot. Then power the device. After the device boots, you should get the following screen:

You are up and running!

Note

If you are using a US keyboard, you may need to edit the keyboard file for your keyboard to use nano effectively. To do this, use the drop-down menu in the upper left-hand corner of the screen, choose Preferences | Mouse and Keyboard Settings, and then select the Keyboard tab. You can then choose the correct keyboard for your configuration.

Now you are ready to start interacting with the system! You can bring up a Terminal window and start typing commands.