Schweitzer Fachinformationen
Wenn es um professionelles Wissen geht, ist Schweitzer Fachinformationen wegweisend. Kunden aus Recht und Beratung sowie Unternehmen, öffentliche Verwaltungen und Bibliotheken erhalten komplette Lösungen zum Beschaffen, Verwalten und Nutzen von digitalen und gedruckten Medien.
Mike Cook is is the co-author of Raspberry Pi For Dummies. Mike is a veteran tech author and a freelance consultant for all things to do with Physical Computing. A former Lecturer in Physics at Manchester Metropolitan University, he has written more than three hundred computing and electronics articles for the pages of computer magazines since the 1980s. Mike patrols the forums as Grumpy Mike, though he is anything but!
A History of Making 1
Consumer Computing 2
Why Everyone Should Learn About Computing 2
Enter the Raspberry Pi 3
About This Book 4
How to Use Th is Book 4
The Future 6
Part I: Getting Started with the Raspberry Pi
CHAPTER 1 Getting Your Raspberry Pi Up and Running 9
The Operating System 10
Connecting Your Raspberry Pi 16
The Boot Process 25
Starting the Graphical Desktop 26
Starting a Terminal under X 26
Troubleshooting 26
Let the Fun Begin! 28
CHAPTER 2 Introductory Software Project: The Insult Generator 29
Running Your First Python Program 30
Saving Your Program 33
Generating an Insult 36
Insult Your Friends by Name! 39
Create a Stream of Insults! 41
Putting It All Together 45
Part II: Software Projects
CHAPTER 3 Tic-Tac-Toe 49
Errors 50
Making a Start 51
A Two-Player Game 55
Getting the Computer to Play 59
Over to You 70
CHAPTER 4 Here's the News 71
Early Teleprompters 72
The Pi Prompter 73
What You Need to Do 73
A Step Closer to a Usable Program 78
Your Final Pi Prompter Code 84
The Physical Setup for Your Prompter 89
Over to You 92
CHAPTER 5 Ping 93
Early Commercial Products 94
The Ping Game 94
Improving the Ping Game 99
A Single-Player Game 104
A Two-Player Game 111
Over to You 118
CHAPTER 6 Pie Man 121
The Pie Man Game 122
Gather Your Resources 123
Setting the Stage 127
The Game Action 133
Drawing the Screen 141
The Final Function 144
Over to You 150
CHAPTER 7 Minecraft Maze Maker 151
Installing Minecraft 152
Starting Minecraft 153
Playing Minecraft 154
Preparing for Python 156
Using the Minecraft Module 156
Over to You 174
Part III: Hardware Projects
CHAPTER 8 Colour Snap 177
Implementing the Game 178
The Software for Testing the Game 193
The Software for the Game 196
Over to You 202
CHAPTER 9 Test Your Reactions 203
Welcome to the Embedded World! 204
Obtaining Components 205
Setting up PiFace Digital 206
Connecting PiFace Digital 210
Using the Emulator 210
Interfacing with Python 211
The Reaction Timer 214
What Will You Interface? 226
CHAPTER 10 The Twittering Toy 227
Hacking the Toy 228
Making It Talk 232
Making It Move 235
Connecting to Twitter 239
Putting It All Together 245
Wrapping Up 248
CHAPTER 11 Disco Lights 251
Defining Your Sequence 252
Getting the Code to Do More 254
A Small Detour into Theory 256
Designing the Sequencer 257
Implementing the Sequencer 258
The Lights 265
Using Longer Strip Lights 268
Making the Lights Move 269
Designing the Circuit 270
Building the Circuit 273
Running the Circuit 273
Over to You 274
CHAPTER 12 Door Lock 275
The System Overview 276
Safety-Critical Systems 276
The Door Lock Hardware 277
The Initial High-Level Software Simulation 278
The Output Block 281
The Input Block 283
The Authentication Block 284
Unlocking Doors Without Touching 286
Testing the Program and Fitting the Lock 292
Networking Multiple Doors 293
Over to You 294
The Art of Programming 295
CHAPTER 13 Home Automation 297
The Internet Of Things 298
Project 1: How to Create a Motion Sensor and Door Switch 298
Project 2: How to Monitor Your Home with a Webcam 305
Project 3: How to Make a Temperature Gauge 312
Project 4: How to Send an E-mail Alert 317
Project 5: How to Send an E-mail Using a Wireless Remote 324
Over to You 331
CHAPTER 14 Computer-Controlled Slot Car Racing 333
Obtaining a Slot Car Racer 334
Hacking Your Slot Car Racer 334
Getting the Player Input 336
The Software 346
The Game 348
Over to You 354
CHAPTER 15 Facebook-Enabled Roto-Sketch 355
The Concept 356
Rotary Encoder Types 356
The Encoder Output 357
Posting to Facebook 366
The Final Roto-Sketch Program 369
Creating a Symmetrical Pattern 375
Over to You 381
CHAPTER 16 The Pendulum Pi, a Harmonograph 383
The Concept 385
The Hall Effect 385
Enter the Arduino 387
Putting It Together 388
Programming the Arduino 399
Programming the Pi 412
Using the Pendulum Pi 418
Over to You 419
CHAPTER 17 The Techno-Bird Box, a Wildlife Monitor 421
Building Invisible Light Beam Sensors 423
Mounting the Sensors 427
Recording Activity to a File 431
Processing the Data 442
Dealing with Sensor Noise 448
Drawing a Graph 454
Putting the Nest Box into Service 458
Over to You 458
The Possibilities Are Endless 460
Index 461
Introduction
When we’re young, making things is second nature – painting a picture, inventing a game, telling a story, building a rocket from a washing-up liquid bottle that we’re convinced will fly all the way to the moon. Childhood is all about adventure, discovery – the quest for something new.
Although these joys don’t fade with age, it can become harder to find space and time for play and discovery as “real life” takes over. But yet, some of the greatest inventions and discoveries of history were the result of curious people not being afraid to “have a go”, often tinkering away in their own homes or garden sheds rather than high-tech well-funded engineering companies.
What’s this got to do with a book on things to do with a Raspberry Pi?
Well, after reading and having a go at some of the projects in this book you might discover the pleasure of making something with a computer can bring. Computing offers a fantastic world of new and untapped opportunities for adventure and creativity. It touches so many areas of our lives (game consoles, set top boxes and smartphones are all computers) that you can combine it with almost any other passion or hobby.
You’ll see why a sprinkling of computing is beneficial for everyone, and that a moment of personal creativity on the kitchen table can have a much bigger impact. You’ll also discover the story behind a particular credit-card sized computer.
A History of Making
World-changing inventions can come from unconventional places.
Orville and Wilbur Wright were two ordinary brothers from Ohio who owned a bicycle shop. Fascinated with the workings of these simple machines, they became convinced that they could build a flying machine. And they did. In 1903, they launched the world’s first aeroplane. Nearly a century later, as HIV/AIDS swept through Africa, Trevor Baylis, an ex-stuntman, became convinced he could help. He sat in his suburban garden shed and invented an inexpensive and durable wind-up radio for use across Africa to spread simple health messages and undoubtedly prevented many, many deaths. Steve Jobs and Steve Wozniak, the founders of Apple, both learned about electronics and computers from experimenting in their bedrooms and family garages. These are just three examples that show the worldwide impact on millions tinkering at home can have.
Many inventors can clearly imagine what they want to make, but might not know how to build it. But, spurred on by the joy of creativity, they teach themselves the skills needed to build what they could imagine. Wozniak and Jobs developed their skills this way, taking apart existing appliances, figuring out how they work and putting them back together. Sometimes the appliances would be enhanced by tinkering, and sometimes they’d no longer work at all! But they weren’t put off; sometimes it was just about discovering how something worked, or the journey to overcome technical adversity, rather than producing a polished product.
Consumer Computing
It is ironic that the birth of Apple computers was a result of poking around in the innards of appliances. Nowadays, computers are sold as sleek, refined aluminium caskets of magic, sealing in opportunities to experiment and discover how they actually work. In a continual quest to add value to their products, manufacturers lure customers with the promise of easy-to-use products and an effortless user experience with your every need taken care of.
Unfortunately it’s not been a smooth journey. Rarely do modern computer systems do exactly what users want. How often are we left frustrated by a computer system failing, consoled by the manufacturer’s line that “that will be fixed in the next update” or “you need to buy the next version if you want it to do that”? For the technologically fearless, these statements are more like rallying cries, an excuse to tinker until the computer does what they really want. But these days, there are few people brave or skilled enough to roll their sleeves up and get inside.
Why Everyone Should Learn About Computing
Computers really are everywhere, pervading every aspect of our lives. As well as the laptop, desktop and smartphone, just think about the computers behind life support systems and medical records in our hospitals, in banking and shopping keeping the economy going, in manufacturing and our food-supply chain. They are key for our communications, powering digital TV and radio and mobile phone networks, as well as the Internet. With computers so integral to the functioning of our media, commerce and government, it seems odd that so many of us are ignorant of how they work.
Given how widespread the reliance on computers is, think how much we could all benefit from a little bit more understanding. Business leaders and politicians could make more informed decisions on projects involving computers, and the man-on-the-street would be less likely to fall prey to online scams or be duped by overimpressive advertising claims about products. They’d have the skills to make computers work for them to improve their lives.
I see similarities between computing and cooking. Cooking has recipes, which is about following steps. It is about making meals, consisting of sets of dishes. To make an apple pie, you need to break down the task into manageable elements (making the pastry, coring the apples, baking for just the right amount of time), all of which add to a complete (and hopefully tasty) apple pie. This is an example of abstraction, and is key to mastering computing. The problem-solving and logical-thinking techniques, such as managing abstraction, that are developed in computing are valuable to other aspects of life.
We teach our children how to cook, not because we want to train them to become professional chefs, but because we view it as an essential life skill. Without it, we condemn our children to a lifetime of preheating ready meals, often unfulfilling and expensive. For many people, learning the basic skills is the start of a lifelong love of cooking. They see it as an outlet for their creativity, perhaps starting with a recipe and adapting it to make it their own. It’s a social occupation, a chance to show achievements and discuss techniques, challenges and adventures around a lively dinner table.
I’d argue that learning to use computers has parallels with learning to cook. Everyone needs the basic skills. Some may use those skills to go on to become professional programmers, but I’d hope that for most people it is an opportunity for creativity, as well as a survival skill in today’s modern environment.
However, given the need for more people to learn more about how computers work and the reliance on them, it’s also ironic that getting into computing has become more difficult with modern computers. That is, until a certain credit-card–sized computer came along. . . .
Enter the Raspberry Pi
For most people, beginning to experiment on a £1000 laptop, putting precious data at risk is a daunting prospect. I’d think twice before putting all my digital photos, my music collection and my online banking at risk! Games consoles and some phones actively prevent people from creating their own games and apps, presumably to protect revenue by forcing consumer to buy manufacturer’s products.
With the desire to share the fun of computing and the need for more people to know how computers worked, Eben Upton created a small, cheap computer on his kitchen table. With the help of Dr. Rob Mullins, Professor Alan Mycroft and Jack Lang from Cambridge University; Pete Lomas, an expert in hardware; and David Braben, the Raspberry Pi Foundation was born, a charity that set out to promote the study of computer science and related topics, especially at the school level, and to put the fun back into learning computing.
The Raspberry Pi Foundation aimed to open up the world of computing by creating a hardware device that was pocket-money affordable, so it was accessible to everyone, and there’d be no need to worry about experimenting with it. It was unboxed to make it easy to tinker with.
In 2011, after five years’ intense kitchen-table engineering, the first prototype Raspberry Pi computers were produced. After a feature about the Raspberry Pi on technology journalist Rory Cellan-Jones’s blog went viral the Foundation wondered if they were at the early stages of something bigger than they were expecting.
After some clever engineering to allow the Raspberry Pi to be built cheaply enough to be sold for $25, an initial batch of 10,000 went on sale on 29th February 2012 at 6 a.m. A few minutes later, they had sold out. Eighteen months later, 1.75 million had been sold worldwide.
About This Book
During the development of the Raspberry Pi I’d been working on public engagement projects at the University of Manchester to encourage more people into computing.
I’d been following the Raspberry Pi from an early stage, and thought it had great potential. Like thousands of other engineers, I was also very excited by the technology crammed in this tiny PCB of components. I was also aware that for most people less familiar with computers, the same PCB wouldn’t be particularly exciting, and perhaps a scary mass of wires, components and metal. Like the Foundation, I wanted to share the wonder and joy computing could bring.
The big advantage of the Raspberry Pi was that it could be put it in places you couldn’t put a PC. I wanted the Raspberry Pi to be relevant to what people are interested in. To make it easy to connect to the Raspberry Pi, I came up...
Dateiformat: ePUBKopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet – also für „fließenden” Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.