The Raspberry Pi is a credit card-sized computer that plugs into your TV and a keyboard. It is a capable little computer which can be used in electronics projects, and for many of the things that your desktop PC does, like spreadsheets, word processing, browsing the internet, and playing games.
It also plays high-definition video. This book takes you step-by-step through many fun and educational possibilities. Take advantage of several preloaded programming languages. Use the Raspberry Pi with Arduino. Create Internet-connected projects. Play with multimedia. With Raspberry Pi, you can do all of this and more.
Contents
Preface vii
1/Getting Up and Running 1
A Tour of the Boards 3
The Proper Peripherals 9
The Case 13
Choose Your Distribution 15
Flash the SD Card 15
For Advanced Users: Create Your Own Disk Image 16
Booting Up 16
Configuring Your Pi 17
Getting Online 21
Shutting Down 22
Running Headless 23
Troubleshooting 23
Going Further 24
2/Getting Around Linux on the Raspberry Pi 25
Using the Command Line 29
Files and the Filesystem 30
More Linux Commands 34
Processes 37
Sudo and Permissions 38
The Network 40
Setting the Date and Time 41
Installing New Software 42
Sound in Linux 43
Upgrading Your Firmware 43
Going Further 44
3/Other Operating Systems and Linux Distributions 45
Distributions for Home Theater 46
Distributions for Music 48
Retrocomputing and Retrogaming 48
Internet of Things 49
Other Useful Distributions 50
Going Further 50
4/Python on the Pi 51
Hello, Python 52
A Bit More Python 54
Objects and Modules 57
Even More Modules 61
Launching Other Programs from Python 63
Troubleshooting Errors 65
Going Further 66
5/Arduino and the Pi 67
Installing Arduino in Raspbian 69
Finding the Serial Port 70
Talking in Serial 71
Using Firmata 75
Going Further 76
6/Basic Input and Output 79
Using Inputs and Outputs 82
Digital Output: Lighting Up an LED 84
Digital Input: Reading a Button 89
Project: Cron Lamp Timer 92
Scripting Commands 92
Connecting a Lamp 94
Scheduling Commands with cron 95
Going Further 98
7/Programming Inputs and Outputs with Python 99
Testing GPIO in Python 99
Blinking an LED 102
Reading a Button 104
Project: Simple Soundboard 106
Going Further 111
8/Analog Input and Output 113
Output: Converting Digital to Analog 114
Test-Driving PWM 116
Taking PWM Further 117
Input: Converting Analog to Digital 118
Variable Resistors 124
Going Further 127
9/Working with Cameras 129
Connecting and Testing the Camera Module 132
Project: Making a GIF 134
Capturing Video 135
Testing USB Webcams 136
Installing and Testing SimpleCV 137
Additional Steps for the Raspberry Pi Camera Module 138
Displaying an Image 138
Modifying an Image 140
Accessing the Camera 143
Face Detection 145
Project: Raspberry Pi Photobooth 146
Going Further 150
10/Python and the Internet 151
Download Data from a Web Server 151
Fetching the Weather Forecast 153
Serving Pi (Be a Web Server) 159
Flask Basics 159
Connecting the Web to the Real World 163
Project: WebLamp 166
Going Further 170
A/Writing an SD Card Image 171
Index 177