Home > Store

Hacking Raspberry Pi

Register your product to gain access to bonus material or receive a coupon.

Hacking Raspberry Pi

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

  • Lush, 4-color interior, loaded with step-by-step photos to make learning simple and intuitive
  • Instructions for building several seriously cool projects, from media centers and photo frames to firewalls and personal VPNs – and even how to integrate with open source Arduino hardware!
  • The perfect resource for makers, hardware hackers, and thousands of teachers and students discovering Raspberry Pi all around the world
  • A complete set of instructor materials and a companion student workbook are available to make this book even more valuable in the classroom

Description

  • Copyright 2014
  • Dimensions: 7" x 9-1/8"
  • Pages: 384
  • Edition: 1st
  • Book
  • ISBN-10: 0-7897-5156-9
  • ISBN-13: 978-0-7897-5156-0

DIY hardware hacking...easy as Pi ®!

Raspberry Pi is taking off like a rocket! You can use this amazing, dirt-cheap, credit card-sized computer to learn powerful hardware hacking techniques as you build incredibly creative and useful projects! This complete, full-color guide requires absolutely no experience with either hardware hacking or computer programming. Colorful photos guide you through each project, and the step-by-step instructions are stunningly clear and easy!

1. Start with the absolute basics:

  • Discover why millions of people are so passionate about the Pi!
  • Tour the hardware, including storage, connections, and networking
  • Install and run Raspbian, Raspberry Pi’s Linux-based operating system
  • Manage devices and configuration files
  • Network Raspberry Pi and add Wi-Fi
  • Program Raspberry Pi using Python, Scratch, XHTML, PHP, and MySQL

2. Next, build all these great projects:

  • Media Center
  • Retro Console Video Game Station
  • Minecraft Server
  • Web Server
  • Portable Webcam
  • Security & Privacy Device

3. Then, master all these cutting-edge techniques:

  • Overclock Raspberry Pi for better performance
  • Link Raspberry Pi to the Arduino and Arduino clones, including the AlaMode and the Gertboard
  • Use the Pi to build electronics prototypes using a breadboard

Sample Content

Online Sample Chapter

A Tour of Raspberry Pi Peripheral Devices

Sample Pages

Download the sample pages (includes Chapter 3 and Index)

Table of Contents

Table of Contents

Introduction     1

What’s in This Book     2

Who Can Use This Book     4

How to Use This Book     5

    Task: This Is a Task     5

There’s More Online… 5

PART I  HARDWARE FOUNDATIONS

Chapter 1 What Is the Raspberry Pi?     7

Why the Pi?     8

Hardware Versions     9

Is the Raspberry Pi Open Source?     14

  Open Source Licenses     15

  Open Source and the Raspberry Pi     15

How Can I Purchase a Raspberry Pi?     16

Chapter 2  Hardware Components Quick Start     17

Understanding Pi Hardware Terminology     17

The Hidden Cost of Owning a Raspberry Pi     20

  A 5V Power Supply     21

  SD Card     23

  Powered USB Hub     24

  Ethernet Cable     24

  Monitor     25

  Cables     25

  USB Keyboard and Mouse     26

A Tour of the Model B Board     27

  Networking     27

  Video and Audio     27

  Storage     29

  Power/Status Information     29

  Camera     30

  Processing     31

  Expansion     31

Next Steps     32

Chapter 3  A Tour of Raspberry Pi Peripheral Devices     33

Circuit Prototyping Equipment     34

Single-Board Microcontrollers     37

The Gertboard     38

Single-Board Computers     40

Relevant Technician Tools     41

    Task: Check Raspberry Pi Voltage with a Multimeter     41

Raspberry Pi Starter Kits     43

Next Steps     45

PART II SOFTWARE FOUNDATIONS

Chapter 4  Installing and Configuring an Operating System     47

Common Operating Systems     49

  Understanding Linux     49

  Linux and Raspberry Pi     52

  The Kernel and Firmware     53

  Raspberry Pi’s Other Operating Systems     54

Installing Raspbian on Your Raspberry Pi     55

    Task: Creating a Raspbian SD Card in Windows     57

    Task: Creating a Raspbian SD Card in OS X     58

    Task: Creating a Raspbian SD Card in Linux     60

An All-in-One Solution     63

    Task: Installing an OS on Your Raspberry Pi Using NOOBS     64

Testing Your New Raspbian Image     65

Chapter 5  Debian Linux Fundamentals—Terminal     67

Baby Steps     67

Essential Terminal Commands     69

  startx     69

  pwd     70

  ls     71

  cd     72

  sudo     73

  passwd     74

  nano     74

  man     75

  shutdown     76

Updating Your Software     77

  Updating Raspbian     78

  Updating the Pi Firmware     79

Revisiting Raspi-Config     80

  Expand Filesystem     81

  Change User Password     81

  Enable Boot to Desktop     82

  Internationalisation Options     82

  Enable Camera     82

  Add to Rastrack     83

  Overclocking     83

  Advanced Options     84

  Raspi-Config Under the Hood     84

Next Steps     85

Chapter 6  Debian Linux Fundamentals—Graphical User Interface     87

LXDE—The Desktop Environment     87

  Starting and Exiting LXDE     88

    Task: Using Raspi-Config to Adjust Boot Behavior     88

  Touring the LXDE Interface     89

  Delving into the Main Menu     92

Installing, Updating, and Removing Software     94

Accessing the Pi Store     95

  Task: Downloading a Free App from the Pi Store     97

Tweaking the LXDE UI     98

    Task: Change the Desktop Background     98

    Task: Customize the LXTerminal     99

    Task: Customize the LXPanel     100

  Openbox     100

Editing Configuration Files     101

Chapter 7  Networking Raspberry Pi     103

Basic Networking Concepts     103

Configuring Wired Ethernet     104

    Task: Setting a Static IP Address on Your Raspberry Pi     106

Configuring Wireless Ethernet     107

    Task: Setting Up Wi-Fi on Your Pi     109

Configuring “Headless” Raspberry Pi     110

  Secure Shell (SSH)     112

    Task: Using SSH to Connect to a Raspberry Pi Remotely     113

  Virtual Network Computing (VNC)     114

    Task: Using VNC to Connect to the Raspberry Pi     115

    Task: Configure Your Pi to Start VNC Server Automatically     117

On Browsing the Web with the Pi     118

Chapter 8  Programming Raspberry Pi with Scratch—Beginnings     121

Technical Aspects of Scratch     122

  Scratch Version Issues     122

  The Scratch Community     123

Getting Comfortable with the Scratch Interface     124

  About Blocks     127

Crafting a (Very) Simple Scratch Application     129

    Task: Creating a Basic Scratch App     130

The PicoBoard     132

  Obtaining a PicoBoard?     134

  Using a PicoBoard in Scratch     134

   Task: Using the PicoBoard in Scratch     134

Chapter 9  Programming Raspberry Pi with Scratch—Next Steps      137

Begin with the End in Mind     137

Let’s Build the Game!     139

    Task: Setting Up the Game Screens     140

    Task: Setting Up the Scratch Cat     143

  Setting Up the First Ball     144

  Setting Up the Second and Third Balls     146

  Debugging and Troubleshooting     147

Uploading Your Project     149

    Task: Share Your Scratch Project     149

Remixing     151

    Task: Create a Remix     151

Chapter 10  Programming Raspberry Pi with Python—Beginnings     153

Checking Out the Python Environment     154

Interacting with the Python 3 Interpreter     156

  Exiting the Interpreter     157

  Getting Online Help     157

Writing Your First Python Program     158

    Task: Creating Your First Python Script     159

Running Python Scripts     161

    Task: Running Python Scripts (command line)     161

    Task: Running Python Scripts (IDLE)     161

Broadening Your Python Horizons     163

Chapter 11  Programming Raspberry Pi with Python—Next Steps     165

Getting Comfortable with IDLE     165

    Task: Creating a New Python Script File     168

Writing a Simple Game     168

Delving into a Bit More Detail     171

  Variables      171

  Type Casting     171

  Concatenation     173

  Modules     173

    Task: Loading and then Updating the GPIO Module in Python 3     176

Where Do You Go from Here?     177

PART III  BASIC RASPBERRY PI PROJECTS

Chapter 12  Raspberry Pi Media Center     179

A Bit o’ History     180

But Will It Blend?     181

Introducing Raspbmc     182

    Task: Installing Raspbmc Under Windows     182

    Task: Installing Raspbmc Under OS X     183

  Configuring Raspbmc     184

Getting Your Remote Control Working     186

    Task: Controlling Your Raspbmc Box from iOS     186

    Task: Controlling Your Raspbmc Box from a Web Browser     189

    Task: Configuring a GPIO-based IR Receiver     190

Transferring Content to Your Pi     192

    Task: Uploading Media Content to Raspberry Pi     192

Scraping Your Media     194

    Task: Configuring XBMC Media Detection     194

Playing Your Content     196

Installing Add-Ons     197

Chapter 13 Raspberry Pi Retro Game Station     199

A Word About Console Video Game Emulation     200

Installing RetroPie     200

    Task: Setting Up RetroPie     201

Transferring ROMs to RetroPie     203

Task: Transferring ROMs to Your Raspberry Pi     204

Setting Up Your Controls     206

    Task: Configure RetroPie Joystick Control Mappings     208

Playing Your Games     209

Installing Useful Add-Ons     210

    Task: Install ES-Scraper     211

  In Search of the Perfect Joystick     212

Chapter 14  Raspberry Pi Minecraft Server     217

Installing Minecraft Pi     219

    Task: Installing Minecraft Pi     219

Accessing the Python API     221

    Task: Loading the Minecraft Python Libraries     222

    Task: Making Your Player Jump High!     224

    Task: Create a Diamond Floor     225

Building a Minecraft Server     226

    Task: Installing Java and the Minecraft Server     227

  Administering a Minecraft Server     230

    Minecraft Plugins     232

Chapter 15  Raspberry Pi Web Server     233

What Is the LAMP Stack?     234

Installing Your Web Server     235

    Task: Installing the LAMP Stack on Raspberry Pi     236

    Task: Verifying PHP Configuration     237

    Task: Verifying MySQL Installation     239

  Tweaking Up Your Web Server Settings     240

Transferring Content to Your Web Server     240

    Task: Using SFTP to Transfer Content to Your Pi     241

    Task: Install and Test FTP on Your Raspberry Pi     243

Setting Up phpMyAdmin     243

    Task: Installing phpMyAdmin     244

Setting Up Joomla     245

    Task: Installing Joomla on Your Raspberry Pi     246

Putting Your Web Server on the Public Internet     249

    Task: Making Your Raspberry Pi Publicly Accessible by Using No-IP     250

Chapter 16  Raspberry Pi Portable Webcam     253

About the Raspberry Pi Camera Board     253

Installing and Configuring the Raspberry Pi Camera Board     256

    Task: Preparing the Raspberry Pi for the Camera Board     256

    Task: Installing the Raspberry Pi Camera Board     257

Using the Camera Board     259

  Capturing Still Pictures     259

  Recording Video with the Camera Board     263

        Task: Encoding a raspivid Video File     265

Using a Third-Party USB Webcam     266

    Task: Configuring a Third-Party USB Webcam     267

  Setting Up Your Webcam     269

    Task: Setting Up a Time-Lapse Webcam     270

  Adding a Rechargeable Battery Pack to Your Pi Camera     273

Python and Your Webcam     274

    Task: Setting up SimpleCV     274

Chapter 17  Raspberry Pi Security and Privacy Device     277

Encrypting Your Internet Connection with a VPN     277

Browsing Where You Want via a Proxy Server     278

Building Your Raspberry Pi VPN Gateway     280

    Task: Creating Your Hamachi VPN     281

    Task: Connecting to Your Hamachi VPN from Your Desktop Computer     283

    Task: Installing Hamachi Client on Your Raspberry Pi     284

Building Your Raspberry Pi Proxy Server     286

    Task: Installing and Configuring Privoxy Raspberry Pi     286

Testing the Configuration     287

    Task: Pointing Your Workstation Computer at Your Pi Proxy     289

Speaking of Geolocation     292

    Task: Adding Your Raspberry Pi to the Rastrack Database     294

Building a Raspberry Pi Tor Proxy     294

PART IV HACKING THE RASPBERRY PI

Chapter 18  Raspberry Pi Overclocking     299

What Is Overclocking?     299

Warranty Implications of Overclocking     300

Overclocking Your Pi     302

  The Raspi-Config Method     302

    Task: Verifying Your Pi’s CPU, Voltage, and Temperature Status     303

  The Manual Method     304

Benchmarking Your Pi     305

    Task: Installing and Running nbench     306

Adjusting the Memory Split on Your Pi     307

    Task: Tweaking Memory Split with Raspi-Config     308

  Tweaking Memory Split by Hand     309

  A Historical Footnote     309

Various and Sundry Performance Tweaks     311

Chapter 19  Raspberry Pi and Arduino     315

Introducing the Arduino     315

Digging into the Arduino Uno     319

Connecting the Arduino and the Raspberry Pi     321

  Connecting the Raspberry Pi GPIO Pins to the Arduino Serial Pins     322

  Connecting the Raspberry Pi GPIO Pins to the Arduino I2C     322

  Connecting the Raspberry Pi to the Arduino via USB     322

  Connecting the Raspberry Pi to the Arduino via a Shield or Bridge Board     322

  Connecting the Raspberry Pi to an Arduino Clone     323

Understanding the Arduino Development Workflow     323

    Task: Install and Configure Arduino IDE on the Raspberry Pi     324

    Task: Running the “Blink” Sample Sketch     327

  Fading an LED     330

    Task: Running the Fade Sketch     331

Using the AlaMode     332

    Task: Getting the AlaMode Up and Running     333

Chapter 20  Raspberry Pi and the Gertboard     337

Anatomy of the GPIO     339

Connecting Your Gertboard and Raspberry Pi     341

Installing the Testing Software     343

    Task: Enabling SPI on Your Raspberry Pi     344

    Task: Installing the Python Gertboard Test Suite     345

Testing the LEDs     346

Testing Input/Output     349

A Couple Quick Breadboarding Exercises     350

  Accessing the GPIO Pins Directly     350

    Task: Lighting an LED Directly from the GPIO     351

  Accessing the GPIO Pins via the Pi Cobbler     353

Programming the Atmel Microcontroller     354

    Task: Preparing Your Arduino Environment     355

Final Thoughts, and Thank You     357

Index     359

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020