18,99 €
Join the Raspberry revolution with these fun and easy Pi projects The Raspberry Pi has opened up a whole new world of innovation for everyone from hardware hackers and programmers to students, hobbyists, engineers, and beyond. Featuring a variety of hands-on projects, this easy-to-understand guide walks you through every step of the design process and will have you creating like a Raspberry Pi pro in no time. You'll learn how to prepare your workspace, assemble the necessary tools, work with test equipment, and find your way around the Raspberry Pi before moving on to a series of fun, lively projects that brings some power to your plain ol' Pi. * Introduces Raspberry Pi basics and gives you a solid understanding of all the essentials you'll need to take on your first project * Includes an array of fun and useful projects that show you how to do everything from creating a magic light wand to enhancing your designs with Lego sensors, installing and writing games for the RISC OS, building a transistor tester, and more * Provides an easy, hands-on approach to learning more about electronics, programming, and interaction design for Makers and innovators of all ages Bring the power of Pi to your next cool creation with Raspberry Pi Projects For Dummies!
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 619
Veröffentlichungsjahr: 2015
Raspberry Pi® Projects For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2015 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc., and may not be used without written permission. Raspberry Pi is a registered trademark of the Raspberry Pi Foundation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A PROFESSIONAL WHERE APPROPRIATE. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2015942453
ISBN 978-1-118-76669-9 (pbk); ISBN 978-1-118-76672-9 (ebk); ISBN 978-1-118-76671-2 (ebk)
Table of Contents
Cover
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Part I: Getting Started with Raspberry Pi Projects
Chapter 1: Getting to Know the Raspberry Pi
Getting a Raspberry Pi
Discovering What You Can and Can’t Do with a Raspberry Pi
Getting Familiar with Your Raspberry Pi
Selecting Your Accessories
Setting Up Your Operating System
Flashing Your SD Card
Connecting Your Hardware
Setting Up with Raspi-config
Starting Up the Desktop Environment
Troubleshooting Your Raspberry Pi
Chapter 2: Setting Up Your Tools and Workbench
Getting Ready to Build Your Projects
Assembling Your Tools
Using Your Tools Safely and Effectively
Getting Ready to Build Raspberry Pi LEGO Projects
Chapter 3: Focusing on Technique
Getting Around Your Raspberry Pi
Using the Command-Line Interface
Programming Like a Pro
Chapter 4: The Raspberry Family
In the Beginning: Looking at the Evolution of the Raspberry Pi
Deciding Which Raspberry Pi to Buy
Figuring Out Which Raspberry Pi You Have
Part II: Working with LEDs and Switches
Chapter 5: The Sauce Bottle Game
The Game
The Software
Taking It Farther
Chapter 6: Stomp!
Getting Acquainted with the LED
Stomp 1
Stomp 2
Chapter 7: The Light Fantastic
Introducing the Light Fantastic
The Circuit
Construction
Bringing It All to Life
Chapter 8: Games for the Light Fantastic
Treasure Hunt
Sliding Block Puzzle
Color Match
Lights Out
Exploring a World of Possibilities
Part III: Developing Advanced Interfaces
Chapter 9: Advanced Interfaces
Converting Analog to Digital
Introducing the Analog-to-Digital Conversion Methods
Building an Analog-to-Digital Converter
Using a Potentiometer to Control the Breakdown Game
Creating an Analog Temperature Sensor
Interfacing with an Analog-to-Digital Microchip
Chapter 10: Raspberry Pi in the Sky
Understanding the Cloud
Storing Data in Google Docs from Your Raspberry Pi
Creating a Dashboard and Temperature Alerts Using PrivateEyePi
Creating a Database Logger
Chapter 11: Webcam and Computer Vision
Setting Up the Webcam or Raspberry Pi Camera Module
Understanding Images
Creating an Image File
Detecting Motion with a Webcam
Working with Image Recognition
Interpreting Color
Building a Connect Four Game Using Computer Vision
Chapter 12: The Raspberry Jazz Glitter Trio
Meeting the Gang
Testing the Webcam
Hacking the Glitter Lamp
Letting the Band Play
Part IV: Making the Raspberry Pi Your LEGO’s Magic Brick
Chapter 13: The Pi Meets LEGO
Exploring the MINDSTORMS Range
Creating a Tug-of-War LEGO Robot
Going on from Here
Chapter 14: The LEGO Dice Game
Introducing the Dice Game
Understanding the Game Theory
Detecting Dice
Looking at the Playing Mechanism
Writing the Code
Customizing the Code
Chapter 15: LEGO Direct
Creating a Reset Button for the Raspberry Pi
Making Batteries Last Longer
Using Connectors and Cables to Control the LEGO Motors and Sensors
Reading and Commanding
Rolling Your Own Motor Control
Listening to Sensors
Part V: Exploring RISC OS
Chapter 16: Introducing RISC OS
Knowing What Makes RISC OS Unique
Preparing for Action: Getting RISC OS
All Systems Go: Starting Up RISC OS
Handling Graphics with !Paint and !Draw
Connecting to the Outside World
Identifying the Resources That Are Already Installed
Chapter 17: RISC OS Coding
In the Beginning Was BASIC
Hello World
The Insult Generator
Understanding Full Desktop Applications
Working with Graphics in RISC OS
Chapter 18: Transistor Tester
Getting Acquainted with Transistors
Configuring Transistors
Designing the Circuit
Constructing the Circuit
Writing the Software
Chapter 19: The General-Purpose Input/Output Port in RISC OS
Using the GPIO Pins in RISC OS
Getting an LED to Blink
Mixing Languages
Part IV: The Part of Tens
Chapter 20: Ten Great LEGO Pi Projects
Panobot
MATLAB and Simulink
Raspberry Pi LEGO Case
Book Reader
A Stop-Motion LEGO Movie
SriShooter
browserBot
BrickPi Remote Sentry Cannon
LEGO Digital Clock
The Original LEGO MINDSTORMS
Chapter 21: Ten Suppliers of Components and Tools
Farnell/Newark
RS Components
Rapid Electronics
Mouser Electronics
Digi-Key
Proxxon
Adafruit
SparkFun
Electronic Goldmine
E.M.A. Model Supplies
About the Authors
Cheat Sheet
Advertisement Page
Connect with Dummies
End User License Agreement
Cover
Table of Contents
Begin Reading
iii
iv
vii
viii
ix
x
xi
xii
xiii
xiv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
451
452
453
454
455
456
457
458
459
460
483
484
485
486
487
488
489
490
Raspberry Pi Projects For Dummies is designed for people who are looking for something exciting to do with the Raspberry Pi. This book contains projects to amaze and inspire you! It takes you into a world of switches, lights, motors, home automation, and computer vision. It not only covers the theory behind what you’re doing, but also gives you examples of putting that theory into practice, so you can learn to work on your own projects and not just blindly follow a list of instructions.
Sure, we could just give you a list of steps to follow. But we believe that you should try to understand what you’re doing and why you’re doing it, and that’s what this book is all about. With this book as a resource, we encourage you to put your own stamp on projects, which is why many projects in this book aren’t just cut-and-dried lists of things to do, but suggestions about how you can customize the projects and make them your own.
The projects in this book all make use of the computer language Python 2. This book shows you how to use a wide variety of input and output devices, from a simple switch to a webcam. You can explore LEDs and multicolored LEDs, learn about a keypad matrix and see how they can be integrated to become part of your code so you can make these devices do what you want. Reach out with your Raspberry Pi and become part of the cloud or build your own web server. This book shows you how.
The Raspberry Pi can interface with other electronic devices, and in this book we show you how to interact with LEGO’s latest robotic MINDSTORMS set, the EV3. You can send messages into the LEGO system or do your own thing and control the MINDSTORMS peripherals directly from the Raspberry Pi. Not only do we show you how these two systems interact, but we also show you some projects you can make using the Raspberry Pi and MINDSTORMS set together.
Linux is the staple operating system used in the Raspberry Pi world. However, there is a major alternative operating system you can run for just the price of another very small SD card, RISC OS. RISC OS is a mature, well-honed operating system, designed from the ground up to run on ARM chips, and as such, it’s fast and compact. This book shows you how you can explore the RISC OS and gives you a glimpse of another world.
A few final notes about the book: Sidebars (text in gray boxes) and Technical Stuff paragraphs are skippable. Finally, within this book, you may note that some web addresses break across two lines of text. If you’re reading this book in print and want to visit one of these web pages, simply key in the web address exactly as it’s noted in the text, pretending as though the line break doesn’t exist. If you’re reading this as an e-book, you’ve got it easy — just click the web address to be taken directly to the web page.
In writing this book, we made a few assumptions about you:
You have a Raspberry Pi.
You could certainly read this book without a Raspberry Pi, but you won’t get much out of it unless you have a Raspberry Pi to play with.
You have a computer other than the Raspberry Pi.
You need a computer to set up the Raspberry Pi.
Note:
We provide instructions on how to set up your Pi, but this information isn’t the main thrust of the book. If you need more information on setting up your Raspberry Pi, a good companion book to this one is
Raspberry Pi For Dummies,
by Sean McManus and Mike Cook (Wiley), which covers in much more detail your first steps with this remarkable machine.
Your Raspberry Pi has some connection to the Internet.
It may not be connected all the time, but you’re at least able to connect it for setting up the libraries you need to install.
You don’t mind voyaging into less charted waters and you have an open mind on what constitutes computing and operating systems.
You’re eager to begin exploring the world of physical computing.
Physical computing takes a fresh look at inputs and outputs to a computer. The computer produces physical outputs — signals that make lights flash, sounds play, or robots move. Inputs are more than just typing — they include everything from simple push buttons to color sensors to webcams.
You have access to some basic hand tools, like a small saw and drill along with a soldering iron.
If you don’t have these tools on hand, we assume you have the money to buy them — or you have a friend or family member whose toolkit you can raid!
You don’t mind spending some money on the components you need to make your projects.
Most of these components aren’t very expensive, but you’ll need to buy them (and we recommend sources in this book).
In this book, we use a handful of icons (little pictures in the margins) to draw your attention to key pieces of information. Here’s what those icons mean:
When we give you an especially useful bit of information — something that can make your life with the Raspberry Pi easier or help you do something faster — we mark it with the Tip icon.
You don’t need to commit this book to memory — it’s a resource for you to turn to whenever you need it. But every once in a while, we tell you something so important that you’ll want to remember it. When we do, we mark it with the Remember icon.
What can we say? We’re geeks. And as such, we sometimes get a little technical, telling you more than you really need to know to get the job done. When we veer into the technical, we mark that text with the Technical Stuff icon. If you’re short on time, you can skip anything marked with this icon without missing anything critical to the task at hand.
You’re bound to come across some pitfalls on your journey with the Raspberry Pi. We’ve walked this road before, so think of the Warning icon as orange cones in the road, helping you steer clear of those tire-destroying potholes or open manhole covers.
In addition to the material in the print or e-book you’re reading right now, this product also comes with some access-anywhere goodies on the web. Check out the free Cheat Sheet at www.dummies.com/cheatsheet/raspberrypiprojects for information on connecting the Arduino and the Raspberry Pi, GPIO pin alternate functions, and powering other devices from the Raspberry Pi.
Also, at www.dummies.com/extras/raspberrypiprojects, you can find free bonus articles on topics like contact bounce and facial recognition.
Finally, throughout the book, we mention files that you can download from the book’s companion website, www.dummies.com/go/raspberrypiprojects.
If you’re a beginner, you can’t do better than starting at Chapter 1 and making sure you have your Raspberry Pi and your workspace set up. Even if you’re experienced, it’s worth reading the early chapters to pick up hints we’ve gathered from our extensive experience. If you’re champing at the bit to start playing with your Pi, feel free to dive into the parts of the book that interest you most!
Part I
For Dummies can help you get started with lots of subjects. Visit www.dummies.com to learn more and do more with For Dummies.
In this part …
Learn about your Raspberry Pi.
Set up the hardware and operating system and your project-building workspace.
Learn construction techniques.
Understand the basics of programming.
Install language extensions.
Discover the Raspberry Pi family of computers.
Chapter 1
In This Chapter
Getting a Raspberry Pi
Finding out what’s possible with your Raspberry Pi
Connecting your Raspberry Pi
Setting up your operating system
Troubleshooting any problems
You probably wouldn’t have picked up this book if you hadn’t already heard about the amazing, low-cost computer for everyone, the Raspberry Pi. Besides being inexpensive, what’s made the Raspberry Pi so appealing is that it’s pretty easy to use. You can even change it to do things its designers never dreamed of. Unlike most consumer electronics, tablets, and desktop computers, the Raspberry Pi is designed to let you investigate how it works and change how it operates by writing your own software programs.
This is all possible because the Raspberry Pi uses an inexpensive but powerful processor and a free operating system, which is based upon the popular Linux platform. In this chapter, we take a look at what you need to get going and show you how to set it up.
We also tell you where to get a Raspberry Pi and the accessories you need to run it. We explain how to set up the operating system, how to connect the hardware, and what to do if you run into any problems along the way. Before long, you’ll be able to make your Raspberry Pi say, “Hello, world!”
If you’re interested in building projects with a Raspberry Pi, you probably already have one. But if you don’t yet have your own Raspberry Pi, this is the section for you! You’ll be glad to know that there are a few places you can pick one up quickly and cheaply.
The Raspberry Pi comes in several versions: Model A is shown in Figure 1-1, and Model B is shown in Figure 1-2. There are other versions of the Raspberry Pi, though — Chapter 4 has a full rundown. The Model A and Model B use the same kind of processor, but the Model A is cheaper and uses less power; it has a single USB port and connections for your screen and audio. Model B has everything Model A has, plus an additional USB port and an Ethernet port for connecting to a network, so it costs a little more. For the projects in this book, you’ll want to get a Model B.
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!