Embrace the exciting new technology of Raspberry Pi! With the invention of the unique credit-card sized single-board computer, the Raspberry Pi, comes a new wave of hardware geeks, hackers, and hobbyists who are excited about the possibilities of the Raspberry Pi, and this is the perfect guide to get you started in this exhilarating new arena. 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. With this down-to-earth book, you'll quickly discover why the Raspberry Pi is in high demand! There's a reason the Raspberry Pi sold a million units in its first year, and you're about to find out why! In Raspberry Pi For Dummies, 3rd Edition veteran tech authors Sean McManus and Mike Cook make it easier than ever to get you up and running on your Raspberry Pi, from setting it up, downloading the operating system, and using the desktop environment to editing photos, playing music and videos, and programming with Scratch-and everything in between. Covers connecting the Pi to other devices such as a keyboard, mouse, monitor, and more Teaches you basic Linux System Admin Explores creating simple hardware projects Shows you how to create web pages Raspberry Pi For Dummies, 3rd Edition makes computing as easy as pie! Title Page 3 Copyright Page 4 Table of Contents 7 Introduction 17 About This Book 17 Why You Need This Book 18 Foolish Assumptions 19 Icons Used in This Book 19 Beyond the Book 20 Where to Go from Here 20 Part 1 Setting Up Your Raspberry Pi 23 Chapter 1 Introducing the Raspberry Pi 25 Getting Familiar with the Raspberry Pi 27 Figuring Out What You Can Do with a Raspberry Pi 30 Getting Your Hands on a Raspberry Pi 31 Determining What Else You Need 32 Chapter 2 Downloading the Operating System 39 Introducing Linux 40 Creating a NOOBS Card 41 Downloading NOOBS 41 Formatting the SD card 42 Copying NOOBS to the SD or MicroSD card 46 Using Your NOOBS Card 48 Flashing an SD or MicroSD card 48 Chapter 3 Connecting Your Raspberry Pi 51 Inserting the SD Card 53 Connecting the Raspberry Pi Camera Module 55 Connecting the camera on a Pi Zero W 56 Connecting the camera on other Raspberry Pi models 56 Preparing Your Pi Zero or Zero W 57 Connecting a Monitor or TV 57 Connecting an HDMI or DVI display 58 Connecting a television using composite video 58 Connecting a USB Hub 59 Connecting a Keyboard and Mouse 60 Connecting Audio 60 Connecting to Your Router 61 Connecting the Power and Turning on the Raspberry Pi 62 Logging In 66 Configuring Your Raspberry Pi in Raspbian 66 Configuring Your Wi-Fi 69 Configuring Bluetooth Devices 70 Testing the Camera Module 70 Setting Up the Data Partition 72 Taking Your Next Steps with the Raspberry Pi 72 Part 2 Getting Started with Linux 73 Chapter 4 Using the Desktop Environment 75 Navigating the Desktop Environment 76 Using the Applications menu 76 Running programs that are not on the menu 79 Resizing and closing program windows 79 Using the Task Manager 80 Using File Manager 81 Navigating File Manager 82 Copying and moving files and folders 85 Selecting multiple files and folders 86 Creating new folders and blank files 87 Deleting files and folders 87 Changing how files are displayed 88 Opening a folder in the terminal 89 Browsing the Web 90 Using Chromium to browse the web 90 Searching within web pages 92 Using tabbed browsing 92 Adding and using bookmarks 92 Protecting your privacy 93 Sending and Receiving Email with Claws Mail 94 Using the Image Viewer 95 Using the Text Editor 97 Customizing the Desktop 98 Finding and Installing New Applications 99 Backing Up Your Data 100 Logging Out from PIXEL and Shutting Down 101 Chapter 5 Using the Linux Shell 103 Understanding the Prompt 104 Exploring Your Linux System 104 Listing files and directories 104 Changing directories 105 Checking file types 105 Changing to the parent directory 106 Understanding the directory tree 107 Using relative and absolute paths 110 Investigating more advanced listing options 112 Understanding the Long Listing Format and Permissions 115 Slowing Down the Listing and Reading Files with the Less Command 118 Speeding Up Entering Commands 119 Using Redirection to Create Files 120 Creating Directories 122 Deleting Files 123 Using Wildcards to Select Multiple Files 124 Removing Directories 126 Copying and Renaming Files 127 Installing and Managing Software on Your Raspberry Pi 129 Updating the cache 130 Finding the package name 130 Installing software 131 Running software 132 Upgrading the software 132 Removing software and freeing up space 133 Finding out what’s installed 134 Managing User Accounts on Your Raspberry Pi 134 Learning More about Linux Commands 136 Customizing the Shell with Your Own Linux Commands 138 Shutting Down and Rebooting Your Raspberry Pi 140 Part 3 Using the Raspberry Pi for Both Work and Play 141 Chapter 6 Being Productive with the Raspberry Pi 143 Installing LibreOffice on Your Raspberry Pi 144 Working with LibreOffice on the Raspberry Pi 144 Saving your work 145 Writing letters in LibreOffice Writer 145 Managing your budget in LibreOffice Calc 147 Creating presentations in LibreOffice Impress 150 Creating a party invitation with LibreOffice Draw 152 Chapter 7 Editing Photos on the Raspberry Pi with GIMP 155 Working with GIMP 156 Understanding the GIMP screen layout 156 Resizing an image in GIMP 158 Cropping your photo 160 Rotating and flipping your photo 161 Adjusting the colors 161 Fixing imperfections 162 Converting images between different formats 163 Finding Out More about GIMP 163 Chapter 8 Playing Audio and Video on the Raspberry Pi 165 Setting Up Your Media Center 165 Navigating the Media Center 166 Adding Media 167 Adding music 168 Adding videos 169 Adding pictures 170 Streaming media 171 Playing Music 171 Playing Videos 172 Viewing Photos 173 Changing the Settings 173 Using a Remote Control 174 Turning Off Your Media Center 174 Playing Music in the Desktop Environment 174 Part 4 Programming the Raspberry Pi 177 Chapter 9 Introducing Programming with Scratch 179 Understanding What Programming Is 180 Working with Scratch 180 Understanding the Scratch screen layout 181 Positioning and resizing your sprite 182 Making your sprite move 183 Changing your sprite’s appearance 188 Adding sounds and music 192 Creating scripts 194 Using the Wait block to slow down your sprite 196 Saving your work 196 What’s new in Scratch 2 197 Chapter 10 Programming an Arcade Game Using Scratch 199 Starting a New Scratch Project and Deleting Sprites 200 Changing the Background 201 Adding Sprites to Your Game 201 Drawing Sprites in Scratch 202 Naming Your Sprites 205 Controlling When Scripts Run 206 Using the green flag to start scripts 206 Using the Forever Control block 207 Enabling keyboard control of a sprite 208 Enabling a sprite to control another sprite 209 Using Random Numbers 211 Detecting When a Sprite Hits Another Sprite 212 Introducing Variables 213 Making Sprites Move Automatically 215 Fixing the Final Bug 217 Adding Scripts to the Stage 219 Duplicating Sprites 219 Playing Your Game 220 Adapting the Game’s Speed 220 Taking It Further with Scratch 221 Chapter 11 Writing Programs in Python 223 Working with Python 224 Entering your first Python commands 224 Using the shell to calculate sums 226 Creating the Times Tables Program 228 Creating and running your first Python program 229 Using variables 230 Accepting user input 232 Printing words, variables, and numbers together 232 Using for loops to repeat 234 Creating the Chatbot Program 237 Introducing lists 238 Using lists to make a random chat program 241 Adding a while loop 243 Using a loop to force a reply from the user 244 Using dictionaries 245 Creating your own functions 247 Creating the dictionary look-up function 250 Creating the main conversation loop 252 Final thoughts on Chatbot 252 The final Chatbot program 253 Chapter 12 Creating a Game with Python and Pygame Zero 255 Collecting Your Sounds and Images 256 Setting Up Your Folders 257 Creating and Running Your First Program 257 Detecting mouse clicks 260 Animating your actors 261 Using random numbers 263 Adding more clouds 264 Making the clouds regenerate 266 Enabling multiple clouds to be clicked 267 Adding the timer 269 Adjusting the game difficulty 269 The final game listing 270 Exploring Pygame Zero Further 272 Chapter 13 Programming Minecraft with Python 273 Playing Minecraft 274 Moving around 274 Making and breaking things 275 Preparing for Python 276 Using the Minecraft Module 277 Understanding coordinates in Minecraft 277 Repositioning the player 278 Adding blocks 279 Stopping the player from changing the world 280 Setting the maze parameters 281 Laying the foundations 282 Placing the maze walls 283 Understanding the maze algorithm 284 Setting up the variables and lists 285 Creating the functions 286 Creating the main loop 287 Adding a ceiling 290 Positioning the player 290 The final code 291 Adapting the Program 295 Chapter 14 Making Music with Sonic Pi 297 Understanding the Sonic Pi Screen Layout 298 Playing Your First Notes 299 Using Note and Chord Names 301 Writing Shorter Programs 302 Composing Random Tunes Using Shuffle 303 Changing the Random Number Seed 303 Using List Names in Your Programs 304 Playing Random Notes 304 Experimenting with Live Loops 305 Using Samples 307 Adding Special Effects 308 Synchronizing with Your Drumbeat 309 Bringing It All Together 309 Next Steps with Sonic Pi 311 Part 5 Exploring Electronics with the Raspberry Pi 313 Chapter 15 Understanding Circuits 315 Discovering What a Circuit Is 316 Understanding the nature of electricity 316 Determining how a component needs to be treated 323 Getting Familiar with the GPIO 324 Putting the general purpose in GPIO 325 Understanding what GPIOs do 325 Putting an output pin to practical use 327 Using GPIOs as inputs 329 Learning which end is hot: Getting to grips with a soldering iron 330 Making a soldered joint 332 Looking at Ready-Made Add-On Boards 333 The Sense HAT 334 The Skywriter HAT 334 The Xtrinsic Sense board 335 Other boards 335 Chapter 16 Taking Control of Your Pi’s Circuitry 337 Accessing Raspberry Pi’s GPIO Pins 337 Soldering the GPIO pins onto Pi Zero 339 Getting at all the pins with one connector 340 Connecting things together 342 Your First Circuit 343 Bringing your LED to life 344 Using Scratch 1.4 344 Control the flashing speed with an input 345 Using Python 347 Using GPIO ZERO 350 Starting Out with a Dice Display 353 A dice display 353 The project 356 The numbers 356 The display 357 Taking it further 362 Pedestrian Crossing 363 The Pedestrian Crossing hardware 367 The Pedestrian Crossing software 368 Taking it further 372 Chapter 17 Lots of Multicolored LEDs 373 Making Colors 375 Using diffusers 375 Making more colors 376 The Way Forward 378 Bit-banging the APA102C protocol 381 Creating a class 382 Rainbow Invaders 386 Keepy Uppy 391 LEDs Galore 394 Current limits 395 Signals and memory 395 Display update 397 Getting more LEDs 397 Chapter 18 Old McDonald’s Farm and Other RFID Adventures 405 How RFID Work 406 A MIFARE card’s structure 409 A simple RFID jukebox 411 A better RFID jukebox 413 Taking it further 417 Dressing Up a Paper Doll 417 Runway time 422 Old McDonald’s Farm 426 Making sound samples 427 Making the graphics 429 Part 6 The Part of Tens 441 Chapter 19 Ten Great Software Packages for the Raspberry Pi 443 Penguins Puzzle 444 FocusWriter 445 Mathematica 445 XInvaders 3D 447 Fraqtive 447 Tux Paint 448 Grisbi 449 Beneath a Steel Sky 450 Sense HAT Emulator 451 Brain Party 452 Chapter 20 Ten Inspiring Projects for the Raspberry Pi 453 One-Button Audiobook Player 453 Weather Station 454 Heart Rate Monitor 455 Electric Skateboard 455 T-Shirt Cannon 455 Panflute Hero 456 Magic Mirror 456 Pi in the Sky 457 Raspberry Turk 458 Sound Fighter 459 Appendix A Troubleshooting and Configuring the Raspberry Pi 461 Index 475 EULA 507