Home > Store

Hacking Raspberry Pi

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

Hacking Raspberry Pi

eBook (Watermarked)

  • Your Price: $19.19
  • List Price: $23.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.


  • Copyright 2014
  • Dimensions: 7" x 9-1/8"
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-347664-2
  • ISBN-13: 978-0-13-347664-4

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

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


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


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


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


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


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership