Introduction - Hacking Raspberry Pi (2014)

Hacking Raspberry Pi (2014)

Introduction

Hi! I’m Tim Warner, and I am happy to be your guide to the Raspberry Pi. My goal for this Introduction is to get you excited about this $35 credit card-sized computer that we call the Raspberry Pi.

“What in the world can you do with a $35 computer?” you might ask. Well let’s have a look at a representative smattering of some popular Raspberry Pi projects, and you can answer that question for yourself:

Image Picade Arcade Cabinet (http://is.gd/i4YwQ2). This is a tiny, fully-functional arcade machine.

Image Pi in the Sky (http://is.gd/4niEMV). The inventor put a camera-equipped Raspberry Pi into the upper atmosphere via a weather balloon.

Image Streaming Music Jukebox (http://is.gd/oqec3H). This is an inexpensive wireless music broadcasting machine.

Image Raspberry Pi Keyboard Computer (http://is.gd/tvmgC8). This is a full computer packed into the form factor of a computer keyboard.

Image DeviantArt Picture Frame (http://is.gd/i7ED9w). This is an interactive frame that dynamically displays artwork from the DeviantArt website.

Image Pi-Powered Bitcoin Miner (http://is.gd/DrpJ7A). This tiny rig enables you to participate in Bitcoin mining, which can yield you some hefty monetary returns.

Image FM Radio Transmitter (http://is.gd/tS52Yb). This is a low-power (albeit mono) portable FM radio.

Image KindleBerry Pi (http://is.gd/73iVz4). This is a Pi that uses an Amazon Kindle as a monitor and a “dumb” terminal.

Image Pi-Powered Motion Detector (http://is.gd/g4Okb6). This is a Pi that can detect motion and optionally take action upon that detection.

Image 3D Printer (http://is.gd/Bg83jD). This is a Raspberry Pi-powered printer that can actually fabricate three-dimensional objects.

Image Cheese-Powered Radio-Controlled Car (http://is.gd/ZExbWO). This radio-controlled car is controlled with a Nintendo Wii Remote and powered by ordinary slices of cheese.

Image Raspberry Pi Robot (http://is.gd/367FZ5). This is a multi-tasking robot that uses the Raspberry Pi as its “brain.”

Image Automated Chicken Coop Door (http://is.gd/boZR6F). This is a Raspberry Pi, a relay, and a motor that opens and closes a farm chicken coop door on a schedule.

Image Pi-Powered Weather Station (http://is.gd/LDbZIr). This outdoor weather sensing and reporting unit runs on USB power.

Image Audio Book Player (http://is.gd/TnkcoW). The inventor made this simple, push button-operated audio book player for his grandmother’s 90th birthday.

Image Android Device (http://is.gd/9eLPkV). The true mark of the software/hardware hacker is to get Linux or Android running on any device. This is a Raspberry Pi that runs Android 4.0 Ice Cream Sandwich.

I think you’ll agree that the diminutive Raspberry Pi has quite a bit of potential for a tiny little circuit board. Let’s take a look at how I’ve organized this book to provide you with maximum learning in minimum time.

The title of this book contains the inflammatory term hacking. This word has several meanings even within the information technology industry. First, hacking means to use or adapt a piece of electronics for a purpose other than which it was originally intended. For instance, you can hack your eReader such that it runs Linux and acts as a web server. Would you want to? Believe it or not, people do exactly that, often just to see if they can.

Second, hacking means to break into someone else’s computer system, often illegally and without the owner’s permission. Of course, Hacking Raspberry Pi embraces the first definition of the term!

What’s in This Book

Hacking Raspberry Pi is organized in such a way that I gradually immerse you into software and hardware engineering. Believe it or not, configuring hardware and mastering the Linux command line isn’t as difficult as you might have imagined. This book takes you through it, beginning with...

Image Chapter 1What Is the Raspberry Pi?: Here I explain exactly what the Raspberry Pi is, how it is important, and why you would want to learn more about the device.

Image Chapter 2Hardware Components Quick Start: In this chapter you become familiar with the Raspberry Pi’s form factor; in other words, its onboard hardware.

Image Chapter 3A Tour of Raspberry Pi Peripheral Devices: What do you plug into the Raspberry Pi and where? This chapter gives you everything you need to know to get your Raspberry Pi up and running.

Image Chapter 4Installing and Configuring an Operating System: In this chapter you learn how to install Raspbian, the reference Linux distribution for Raspberry Pi.

Image Chapter 5Debian Linux Fundamentals—Terminal: This chapter is an excellent jump-start for those who always wanted to understand something of the Linux command-line environment.

Image Chapter 6Debian Linux Fundamentals—Graphical User Interface: Sometimes it is plain easier to navigate in Linux from a GUI environment. Here you learn how to use LXDE, the reference GUI shell in Raspbian.

Image Chapter 7Networking Raspberry Pi: In most cases, you’ll want to put your Raspberry Pi on your local area network (LAN), if not the Internet. You learn how to configure both wired and wireless Ethernet by reading the material in this chapter.

Image Chapter 8Programming Raspberry Pi with Scratch—Beginnings: Scratch provides an easy-to-learn platform for learning how to develop computer programs. In this chapter you become familiar with what Scratch is and how the platform works.

Image Chapter 9Programming Raspberry Pi with Scratch—Next Steps: Here you develop your first real Scratch application, all on the Raspberry Pi!

Image Chapter 10Programming Raspberry Pi with Python—Beginnings: The “Pi” in Raspberry Pi is actually a reference to the Python programming language. Therefore, it is imperative that you learn a thing or two about programming in Python.

Image Chapter 11Programming Raspberry Pi with Python—Next Steps: Many Raspberry Pi projects involve one or more Python scripts. Therefore, the more experience you obtain with the language, the better.

Image Chapter 12Raspberry Pi Media Center: This section of the book is focused on applying your new Raspberry Pi skills to several practical projects. Here you build a Pi-powered media center running Xbox Media Center (XBMC).

Image Chapter 13Raspberry Pi Retro Game Station: Who does not love retro video games? In this chapter you learn how to convert your Raspberry Pi into a mobile classic game station. This is my favorite project in the entire book.

Image Chapter 14Raspberry Pi Minecraft Server: In this chapter you learn how to install, configure, and play Minecraft Pi Edition. You also learn how to set up your Pi as a Minecraft server.

Image Chapter 15Raspberry Pi Web Server: Here you configure your Raspberry Pi to serve up web pages on your own local network and/or the public Internet.

Image Chapter 16Raspberry Pi Portable Webcam: Many people are interested in making their own security camera or general-purpose webcam. It is surprisingly easy to do this with a Raspberry Pi; you can use the Raspberry Pi Camera Board or your own webcam.

Image Chapter 17Raspberry Pi Security and Privacy Device: You can use the Raspberry Pi to increase your online security and privacy, say, when you access the Internet through a public Wi-Fi hotspot, hotel room, and so forth. You learn a lot of cool stuff in this chapter!

Image Chapter 18Raspberry Pi Overclocking: Although the Raspberry Pi is small and inexpensive, the Raspberry Pi Foundation gives users a great deal of flexibility in squeezing every bit of performance from the device. In this chapter you learn what your options are and how to leverage them to customize the behavior of your Pi.

Image Chapter 19Raspberry Pi and Arduino: For my money, the combination of the Raspberry Pi and the Arduino is unbeatable with Pi’s flexibility and the Arduino’s singleness of purpose. In this chapter you use the Arduino Uno and Alamode with your Pi and get some great project ideas.

Image Chapter 20Raspberry Pi and the Gertboard: I close the book by teaching you how to use the ultimate Raspberry Pi add-on board, the Gertboard. The Gertboard is a kitchen sink expansion board that provides you with many opportunities for experimentation and learning.

This book is chock-full of tasks that give you guided experience at setting up, configuring, troubleshooting, and building projects with your Raspberry Pi. I strongly suggest you work through as many tasks as possible.

I am confident that by the time you finish this volume, you will not only be able to discuss the Raspberry Pi intelligently, but you’ll also have an excellent baseline familiarity with practical, applied computer science.

Who Can Use This Book

Ah, now we come to the “Exactly who is this book intended for?” question. Actually, I have a very detailed view of those of you who will benefit most from this book:

Image Students and Teachers: The Raspberry Pi was developed by educators for educators and their students. Due to its open architecture and low price point, people can use the Pi as a platform for learning how computer hardware works at a low level with minimal risk. After all, if the worst happens and you fry your Pi, your investment loss is limited to $25 or $35.

Image Hardware and Software Hackers: As I discussed earlier in this Introduction, hacking has myriad goals. Here I refer to those who want to leverage the Pi to accomplish some business or personal goals, with or without the addition of third-party extension hardware and software.

Image Tech Enthusiasts: These people are do-it-yourselfers (DIYers) who are of the mind, “It’s cheaper for me to make it myself,” or better yet, “I can make this better than anything I can buy.” If you are among these individuals, then kudos to you! You are among a small elite.

How to Use This Book

I hope this book is easy enough to read that you don’t need instructions. That said, a few elements bear explaining.

First, I love to provide relevant websites, but as you know, some URLs are absurdly long and difficult to transcribe. To that end, I make use of the is.gd (http://is.gd) URL shortening service. I hope you find my is.gd “shortie” URLs convenient. One important note about those is.gd URLs: they are case-sensitive, so if you type the URL http://is.gd/6zwzwT as http://is.gd/6ZWZWT or some other variation, the link will not work correctly.

Second, this book contains several special elements, presented in what we in the publishing business call “margin notes.” There are different types of margin notes for different types of information, as you see here.


Note

This is a note that presents information of interest, even if it isn’t wholly relevant to the discussion in the main text.



Task: This Is a Task

This is a step-by-step procedure that gives you practice in whatever technology we’re discussing at the moment. Almost every chapter in this book has at least a couple tasks for you to perform that will help you get the most out of your Raspberry Pi.