Front cover image for Raspberry Pi for dummies

Raspberry Pi for dummies

Get your slice of Raspberry Pi With the invention of the unique credit card-sized single-board computer comes a new wave of hardware geeks, hackers, and hobbyists who are excited about the possibilities with the Raspberry Pi and this is the perfect guide to get you started.
Print Book, English, 2017
3. ed
Wiley, 2017
9781119412007, 1119412005
Introduction 1 About This Book 1 Why You Need This Book 2 Foolish Assumptions 3 Icons Used in This Book 3 Beyond the Book 4 Where to Go from Here 4 Part 1: Setting Up Your Raspberry Pi 7 Chapter 1: Introducing the Raspberry Pi 9 Getting Familiar with the Raspberry Pi 11 Figuring Out What You Can Do with a Raspberry Pi 14 Getting Your Hands on a Raspberry Pi 15 Determining What Else You Need 16 Chapter 2: Downloading the Operating System 23 Introducing Linux 24 Creating a NOOBS Card 25 Downloading NOOBS 25 Formatting the SD card 26 Copying NOOBS to the SD or MicroSD card 30 Using Your NOOBS Card 32 Flashing an SD or MicroSD card 32 Chapter 3: Connecting Your Raspberry Pi 35 Inserting the SD Card 37 Connecting the Raspberry Pi Camera Module 39 Connecting the camera on a Pi Zero W 40 Connecting the camera on other Raspberry Pi models 40 Preparing Your Pi Zero or Zero W 41 Connecting a Monitor or TV 41 Connecting an HDMI or DVI display 42 Connecting a television using composite video 42 Connecting a USB Hub 43 Connecting a Keyboard and Mouse 44 Connecting Audio 44 Connecting to Your Router 45 Connecting the Power and Turning on the Raspberry Pi 46 Logging In 50 Configuring Your Raspberry Pi in Raspbian 50 Configuring Your Wi-Fi 53 Configuring Bluetooth Devices 54 Testing the Camera Module 54 Setting Up the Data Partition 56 Taking Your Next Steps with the Raspberry Pi 56 Part 2: Getting Started with Linux 57 Chapter 4: Using the Desktop Environment 59 Navigating the Desktop Environment 60 Using the Applications menu 60 Running programs that are not on the menu 63 Resizing and closing program windows 63 Using the Task Manager 64 Using File Manager 65 Navigating File Manager 66 Copying and moving files and folders 69 Selecting multiple files and folders 70 Creating new folders and blank files 71 Deleting files and folders 71 Changing how files are displayed 72 Opening a folder in the terminal 73 Browsing the Web 74 Using Chromium to browse the web 74 Searching within web pages 76 Using tabbed browsing 76 Adding and using bookmarks 76 Protecting your privacy 77 Sending and Receiving Email with Claws Mail 78 Using the Image Viewer 79 Using the Text Editor 81 Customizing the Desktop 82 Finding and Installing New Applications 83 Backing Up Your Data 84 Logging Out from PIXEL and Shutting Down 85 Chapter 5: Using the Linux Shell 87 Understanding the Prompt 88 Exploring Your Linux System 88 Listing files and directories 88 Changing directories 89 Checking file types 89 Changing to the parent directory 90 Understanding the directory tree 91 Using relative and absolute paths 94 Investigating more advanced listing options 96 Understanding the Long Listing Format and Permissions 99 Slowing Down the Listing and Reading Files with the Less Command 102 Speeding Up Entering Commands 103 Using Redirection to Create Files 104 Creating Directories 106 Deleting Files 107 Using Wildcards to Select Multiple Files 108 Removing Directories 110 Copying and Renaming Files 111 Installing and Managing Software on Your Raspberry Pi 113 Updating the cache 114 Finding the package name 114 Installing software 115 Running software 116 Upgrading the software 116 Removing software and freeing up space 117 Finding out what’s installed 118 Managing User Accounts on Your Raspberry Pi 118 Learning More about Linux Commands 120 Customizing the Shell with Your Own Linux Commands 122 Shutting Down and Rebooting Your Raspberry Pi 124 Part 3: Using the Raspberry Pi for Both Work and Play 125 Chapter 6: Being Productive with the Raspberry Pi 127 Installing LibreOffice on Your Raspberry Pi 128 Working with LibreOffice on the Raspberry Pi 128 Saving your work 129 Writing letters in LibreOffice Writer 129 Managing your budget in LibreOffice Calc 131 Creating presentations in LibreOffice Impress 134 Creating a party invitation with LibreOffice Draw 136 Chapter 7: Editing Photos on the Raspberry Pi with GIMP 139 Working with GIMP 140 Understanding the GIMP screen layout 140 Resizing an image in GIMP 142 Cropping your photo 144 Rotating and flipping your photo 145 Adjusting the colors 145 Fixing imperfections 146 Converting images between different formats 147 Finding Out More about GIMP 147 Chapter 8: Playing Audio and Video on the Raspberry Pi 149 Setting Up Your Media Center 149 Navigating the Media Center 150 Adding Media 151 Adding music 152 Adding videos 153 Adding pictures 154 Streaming media 155 Playing Music 155 Playing Videos 156 Viewing Photos 157 Changing the Settings 157 Using a Remote Control 158 Turning Off Your Media Center 158 Playing Music in the Desktop Environment 158 Part 4: Programming the Raspberry Pi 161 Chapter 9: Introducing Programming with Scratch 163 Understanding What Programming Is 164 Working with Scratch 164 Understanding the Scratch screen layout 165 Positioning and resizing your sprite 166 Making your sprite move 167 Changing your sprite’s appearance 172 Adding sounds and music 176 Creating scripts 178 Using the Wait block to slow down your sprite 180 Saving your work 180 What’s new in Scratch 2 181 Chapter 10: Programming an Arcade Game Using Scratch 183 Starting a New Scratch Project and Deleting Sprites 184 Changing the Background 185 Adding Sprites to Your Game 185 Drawing Sprites in Scratch 186 Naming Your Sprites 189 Controlling When Scripts Run 190 Using the green flag to start scripts 190 Using the Forever Control block 191 Enabling keyboard control of a sprite 192 Enabling a sprite to control another sprite 193 Using Random Numbers 195 Detecting When a Sprite Hits Another Sprite 196 Introducing Variables 197 Making Sprites Move Automatically 199 Fixing the Final Bug 201 Adding Scripts to the Stage 203 Duplicating Sprites 203 Playing Your Game 204 Adapting the Game’s Speed 204 Taking It Further with Scratch 205 Chapter 11: Writing Programs in Python 207 Working with Python 208 Entering your first Python commands 208 Using the shell to calculate sums 210 Creating the Times Tables Program 212 Creating and running your first Python program 213 Using variables 214 Accepting user input 216 Printing words, variables, and numbers together 216 Using for loops to repeat 218 Creating the Chatbot Program 221 Introducing lists 222 Using lists to make a random chat program 225 Adding a while loop 227 Using a loop to force a reply from the user 228 Using dictionaries 229 Creating your own functions 231 Creating the dictionary look-up function 234 Creating the main conversation loop 236 Final thoughts on Chatbot 236 The final Chatbot program 237 Chapter 12: Creating a Game with Python and Pygame Zero 239 Collecting Your Sounds and Images 240 Setting Up Your Folders 241 Creating and Running Your First Program 241 Detecting mouse clicks 244 Animating your actors 245 Using random numbers 247 Adding more clouds 248 Making the clouds regenerate 250 Enabling multiple clouds to be clicked 251 Adding the timer 253 Adjusting the game difficulty 253 The final game listing 254 Exploring Pygame Zero Further 256 Chapter 13: Programming Minecraft with Python 257 Playing Minecraft 258 Moving around 258 Making and breaking things 259 Preparing for Python 260 Using the Minecraft Module 261 Understanding coordinates in Minecraft 261 Repositioning the player 262 Adding blocks 263 Stopping the player from changing the world 264 Setting the maze parameters 265 Laying the foundations 266 Placing the maze walls 267 Understanding the maze algorithm 268 Setting up the variables and lists 269 Creating the functions 270 Creating the main loop 271 Adding a ceiling 274 Positioning the player 274 The final code 275 Adapting the Program 279 Chapter 14: Making Music with Sonic Pi 281 Understanding the Sonic Pi Screen Layout 282 Playing Your First Notes 283 Using Note and Chord Names 285 Writing Shorter Programs 286 Composing Random Tunes Using Shuffle 287 Changing the Random Number Seed 287 Using List Names in Your Programs 288 Playing Random Notes 288 Experimenting with Live Loops 289 Using Samples 291 Adding Special Effects 292 Synchronizing with Your Drumbeat 293 Bringing It All Together 293 Next Steps with Sonic Pi 295 Part 5: Exploring Electronics with the Raspberry Pi 297 Chapter 15: Understanding Circuits 299 Discovering What a Circuit Is 300 Understanding the nature of electricity 300 Determining how a component needs to be treated 307 Getting Familiar with the GPIO 308 Putting the general purpose in GPIO 309 Understanding what GPIOs do 309 Putting an output pin to practical use 311 Using GPIOs as inputs 313 Learning which end is hot: Getting to grips with a soldering iron 314 Making a soldered joint 316 Looking at Ready-Made Add-On Boards 317 The Sense HAT 318 The Skywriter HAT 318 The Xtrinsic Sense board 319 Other boards 319 Chapter 16: Taking Control of Your Pi’s Circuitry 321 Accessing Raspberry Pi’s GPIO Pins 321 Soldering the GPIO pins onto Pi Zero 323 Getting at all the pins with one connector 324 Connecting things together 326 Your First Circuit 327 Bringing your LED to life 328 Using Scratch 1.4 328 Control the flashing speed with an input 329 Using Python 331 Using GPIO ZERO 334 Starting Out with a Dice Display 337 A dice display 337 The project 340 The numbers 340 The display 341 Taking it further 346 Pedestrian Crossing 347 The Pedestrian Crossing hardware 351 The Pedestrian Crossing software 352 Taking it further 356 Chapter 17: Lots of Multicolored LEDs 357 Making Colors 359 Using diffusers 359 Making more colors 360 The Way Forward 362 Bit-banging the APA102C protocol 365 Creating a class 366 Rainbow Invaders 370 Keepy Uppy 375 LEDs Galore 378 Current limits 379 Signals and memory 379 Display update 381 Getting more LEDs 381 Chapter 18: Old McDonald’s Farm and Other RFID Adventures 389 How RFID Work 390 A MIFARE card’s structure 393 A simple RFID jukebox 395 A better RFID jukebox 397 Taking it further 401 Dressing Up a Paper Doll 401 Runway time 406 Old McDonald’s Farm 410 Making sound samples 411 Making the graphics 413 Part 6: The Part of Tens 425 Chapter 19: Ten Great Software Packages for the Raspberry Pi 427 Penguins Puzzle 428 FocusWriter 429 Mathematica 429 XInvaders 3D 431 Fraqtive 431 Tux Paint 432 Grisbi 433 Beneath a Steel Sky 434 Sense HAT Emulator 435 Brain Party 436 Chapter 20: Ten Inspiring Projects for the Raspberry Pi 437 One-Button Audiobook Player 437 Weather Station 438 Heart Rate Monitor 439 Electric Skateboard 439 T-Shirt Cannon 439 Panflute Hero 440 Magic Mirror 440 Pi in the Sky 441 Raspberry Turk 442 Sound Fighter 443 Appendix A: Troubleshooting and Configuring the Raspberry Pi 445 Index 459