| Table of Contents | 5 |
|---|
| About the Author | 15 |
|---|
| About the Technical Reviewer | 16 |
|---|
| Acknowledgments | 17 |
|---|
| Preface | 18 |
|---|
| Introduction | 20 |
|---|
| Chapter 1: Introducing the Raspberry Pi | 22 |
|---|
| The History of the Raspberry Pi | 24 |
| Exploring the Pi | 29 |
| The GPIO Pins | 30 |
| USB | 30 |
| 31 | 30 |
|---|
| Audio Jack | 31 |
| Camera Connector | 31 |
| HDMI | 32 |
| Power | 32 |
| Display | 32 |
| The System on a Chip | 33 |
| SD Card | 33 |
| Not Visible | 34 |
| The Pi Zero/Zero W | 34 |
| GPIO | 35 |
| Camera Connector | 35 |
| Power | 35 |
| USB | 35 |
| HDMI | 36 |
| SD Card | 36 |
| System on a Chip | 36 |
| Not Visible | 36 |
| Comparing the Raspberry Pi to Similar Devices | 37 |
| Getting Started with the Pi | 37 |
| Hardware Requirements of the Pi | 38 |
| Connecting to Power | 38 |
| Adding a Monitor | 38 |
| Adding a USB Hub | 39 |
| The Pi Operating System | 40 |
| Formatting the Card | 41 |
| Installing the OS | 41 |
| Connecting the Peripherals | 42 |
| Configuring the Pi | 43 |
| Shutting Down the Pi | 46 |
| Summary | 47 |
| Chapter 2: Linux by the Seat of Your Pants | 48 |
|---|
| Getting Started with Linux on the Pi | 51 |
| Linux Files and the File System | 52 |
| Root User Versus sudo | 53 |
| Commands | 54 |
| Exercise: Navigating in the Linux File System | 60 |
| Shells in Linux | 63 |
| Package Managers | 64 |
| Text Editors | 66 |
| Vim Versus emacs Versus nano | 67 |
| Using Vim | 68 |
| Using emacs | 70 |
| Using nano | 72 |
| Default Text Editor | 73 |
| Summary | 74 |
| Chapter 3: Introducing Python | 75 |
|---|
| Scripting Versus a Programming Language | 76 |
| The Python Philosophy | 79 |
| Getting Started with Python | 81 |
| Running Python Using IDLE | 81 |
| Running Python Using the Terminal | 87 |
| Running Python Using Scripts | 87 |
| Exploring Python Data Types | 89 |
| Numbers | 90 |
| Strings | 91 |
| Lists | 93 |
| Dictionaries | 96 |
| Tuples and Files | 97 |
| Programming with Python | 99 |
| IF tests | 100 |
| Loops | 103 |
| Functions | 106 |
| Objects and Object-Oriented Programming | 108 |
| Summary | 109 |
| Chapter 4: Electronics at 100 MPH | 110 |
|---|
| Basic Electricity Concepts | 112 |
| Required Tools for Robotics | 115 |
| Screwdrivers | 115 |
| Pliers and Wire Strippers | 115 |
| Wire Cutters | 118 |
| Files | 119 |
| Magnifying Light | 120 |
| Hot-Glue Gun | 120 |
| Assorted Glues | 121 |
| Multimeter | 121 |
| Power Supplies | 123 |
| Breadboard | 124 |
| Power Strip | 126 |
| Soldering Iron | 127 |
| General Safety Rules | 128 |
| Working with Heat | 129 |
| Working with Sharp Objects | 129 |
| Wear Safety Glasses | 130 |
| Fire Extinguishers at the Ready | 130 |
| Keep a First-Aid Kit Handy | 131 |
| Work in a Ventilated Area | 131 |
| Organizing Your Workplace | 132 |
| Bonus: Soldering Techniques | 134 |
| Summary | 137 |
| Chapter 5: The Web Bot | 138 |
|---|
| Bot Etiquette | 140 |
| The Connections of the Web | 142 |
| Web Communications Protocols | 142 |
| Web Page Formats | 143 |
| A Request Example | 144 |
| Our Web Bot Concept | 145 |
| Parsing Web Pages | 145 |
| Coding with Python Modules | 148 |
| Using the Mechanize Module | 149 |
| Parsing with Beautiful Soup | 150 |
| Downloading with the urllib Library | 150 |
| Deciding What to Download | 151 |
| Choosing a Starting Point | 152 |
| Storing Your Files | 152 |
| Writing the Python Bot | 154 |
| Reading a String and Extracting All the Links | 154 |
| Looking For and Downloading Files | 155 |
| Testing the Bot | 157 |
| Creating Directories and Instantiating a List | 158 |
| The Final Code | 161 |
| Summary | 164 |
| Chapter 6: The Weather Station | 165 |
|---|
| A Shopping List of Parts | 167 |
| Using the I2C Protocol | 168 |
| Using an Anemometer | 169 |
| Building the Anemometer | 170 |
| Connecting the Anemometer to the Pi | 176 |
| Correlating Revolutions per Second with Wind Speed | 177 |
| Connecting the Digital Compass | 180 |
| Connecting the Temperature/Humidity Sensor | 184 |
| Connecting the Barometer | 186 |
| Connecting the Bits | 189 |
| The Final Code | 193 |
| Summary | 196 |
| Chapter 7: The Media Server | 197 |
|---|
| A Shopping List of Parts | 198 |
| Using an NTFS Drive | 198 |
| Installing Samba | 202 |
| Configuring Samba | 204 |
| Setting Linux Permissions | 206 |
| Restarting the Samba Service | 207 |
| Connecting with Linux/OS X | 209 |
| Kodi and Plex | 211 |
| Where’s Python? | 214 |
| Summary | 215 |
| Chapter 8: The Home Security System | 216 |
|---|
| Dogs as Security | 217 |
| The Raspberry Pi as Security | 218 |
| Using a Sensor Network | 219 |
| Understanding a Pulldown Resistor | 220 |
| A Shopping List of Parts | 221 |
| Connecting to Your Network Wirelessly | 222 |
| Accessing the GPIO Pins | 226 |
| Sett
|