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.
Introduction 1
What Is an Arduino? 1
What You Will Learn 1
Parts You Will Need 2
Tools You Will Need 11
Software You Will Need 15
Other Useful Materials 15
What I Assume You Already Know 16
How This Book Is Organised 16
Conventions 18
The Companion Website 20
Reaching Out 20
Adventure 1
Setting Up Your Arduino 21
What You Need 22
Downloading and Installing the Arduino Software on Your Computer 22
Installing Arduino Software on a Mac 24
Installing Arduino Software on a Windows PC 25
Installing Arduino Software on a Linux Machine 27
Exploring the Arduino IDE 27
Using Blink to Test That Everything Is Set Up Correctly 29
Uploading Blink 30
Troubleshooting Common Problems 33
Building an LED Circuit 38
What You Need 38
Understanding Circuit Schematics 38
Using a Breadboard 41
Building Your First Circuit 43
Further Adventures with Arduino 45
Adventure 2
Reading from Sensors 47
What You Need 47
Adding More LEDs 48
Printing Messages to the Computer 54
Reading Data from a Potentiometer 58
Making Decisions in Code 62
Building a Status Message Sign 64
What You Need 64
Understanding the Circuit 65
Prototyping on a Breadboard 66
Writing the Code 67
Creating your Sign 71
Cutting Holes for the Potentiometer and LEDs 72
Adding the Status Messages and Decorating the Sign 72
Soldering the Circuit 73
Inserting the Electronics 76
Further Adventures with Arduino 77
Adventure 3
Working with Servos 79
What You Need 79
Understanding Different Types of Motors 81
Controlling a Servo with Arduino 82
Repeating the Same Thing Over and Over 85
Digital Input with a Push Button 87
Building a Combination Safe 91
What You Need 92
Understanding the Circuit 94
Prototyping on a Breadboard 95
Writing the Code 95
Making the Safe 102
Soldering the Wires 104
Inserting the Electronics 107
Further Adventures with Arduino 107
Adventure 4
Using Shift Registers 109
What You Need 110
Organising Your Code 111
Using Functions 111
Using for Loops 115
Getting More Outputs with Shift Registers 117
How a Shift Register Works 118
Clock 118
Data 119
Latch 119
Making the Connections for a Shift Register 119
Adding LEDs 122
Writing the Code 123
Adding More Shift Registers 127
Building Your Name in Lights 129
What You Need 130
Understanding the Circuit 131
Prototyping on a Breadboard 131
Writing the Code 132
Making the Lights 136
Soldering the Wires 137
Inserting the Electronics 138
Further Adventures with Shift Registers 139
Adventure 5
Playing Sounds 141
What You Need 141
Making a List 142
Making Your Intentions Known 144
Looping Through an Array 146
Putting It Into Practice 146
Making Noise 150
Wiring the Circuit 151
Writing the Code 151
Building an Augmented Wind Chime 155
What You Need 157
Understanding the Circuit 158
Prototyping on a Breadboard 158
Writing the Code 160
Making the Wind Chime 160
Making the Base 162
Making the Chimes 162
Attaching the Chimes 164
Connecting the Electronics 164
Further Adventures with Sound 165
Adventure 6
Adding Libraries 167
What You Need 167
Analogue Out168
Fading an LED 171
Mixing Light 174
Wiring the Circuit 175
Writing the Code 176
Capacitive Sensing 181
Adding a Library 181
Wiring the Circuit 183
Writing the Code 184
Building a Crystal Ball 187
What You Need 187
Understanding the Circuit 188
Prototyping on a Breadboard 189
Writing the Code 190
Making the Crystal Ball 193
Making a Papier Mache Ball 193
Soldering the Electronics 195
Connecting the Electronics 196
Further Adventures with Libraries 197
Adventure 7
Working with the Arduino Leonardo 199
What You Need 199
Introducing the Arduino Leonardo 200
Connecting Your Leonardo for the First Time 201
Acting Like a Keyboard 203
Sensing Light 206
Building the Circuit 208
Writing the Code 210
Building a Game Controller 211
What You Need 212
Building the Circuit 212
Writing the Code 214
Making the Controller Cover 220
Putting It All Together 220
Further Adventures with the Leonardo 221
Adventure 8
Working with the Lilypad Arduino USB 223
What You Need 224
Introducing the Lilypad Arduino USB 224
Blinking from a Lilypad Arduino 226
Prototyping Soft Circuits 228
Getting Clever with Arrays 230
Passing Data Between Functions 236
Building a POV Hoodie 239
What You Need 240
Understanding The Circuit 241
Prototyping with Alligator Clips 241
Charging the Battery 242
Writing the Code 243
Making the POV Hoodie 246
Making Sewable LEDs 246
Sewing the Electronics 247
Further Adventures with the Lilypad 249
In the Next Adventure 250
Adventure 9
The Big Adventure: Building a Marble Maze Game 251
What You Need 252
Part One: Scoring Points 253
Sensing Vibrations with Piezos 253
Setting a Points Threshold 254
Adding Sound Effects 258
Keeping Score 259
Part Two: Designing Your Maze Game 261
Drawing the Maze 261
Designing the Game Code 262
Prototyping the Circuit 263
Part Three: Writing the Code 265
Starting the Game 265
Ending the Game 266
Starting a New Game 269
Keeping Track of the High Score 270
Adding Sounds 272
Part Four: Building the Maze Game 280
Making the Maze 280
Assembling the Piezos 282
Assembling the LEDs and Button 283
Completing the Finishing Touches 284
Further Adventures: Continuing Your Adventures with Arduino 285
Appendix A
Where to Go From Here 287
More Boards, Shields, Sensors and Actuators 287
Shields 287
Sensors and Actuators 288
On the Web 288
The Arduino Site 288
Manufacturers 289
Blogs 289
Videos 289
Books 289
Getting Started with Arduino and General Projects 290
General Electronics 290
Soft Circuits and Wearables 290
Other Specialised Topics 290
Appendix B
Where to Get Tools and Components 291
Starter Kits 291
Brick?]and?]Mortar Stores 292
In the UK 292
In the US 292
Online Stores 292
Online Stores Shipping from the EU 292
Online Stores Shipping from the US or Canada 293
Glossary 295
Index 301
ARE YOU AN adventurer? Do you boldly embark on new endeavours, tackling new skills and mastering new tools? Do you want to learn how to use technology to make your ideas burst into life? Are you curious about how you can combine computer code and electrical circuits with scissors and paper-or even needle and thread? If the answer is an emphatic "yes" then this is the book for you!
The Arduino is a tool for building computers that can interact with the physical world around you. You can use it to connect sensors that detect sound, light or vibration, then turn on a light, change its colour, move a motor and much more. The Arduino is the magical device that sits in the midst of all of these things. It reads in from sensors measuring the real world, makes decisions based on that data and then makes something happen in the real world, whether light, sound or movement.
The Arduino is usually a blue board about the size of your hand. It has white writing on it labelling its different sections and has all its chips and circuits exposed. There are different types of Arduino boards, and they aren't all blue, but you will learn more about that later in the "Parts You Will Need" section and also in Adventures 7 and 8.
The Arduino is a microcontroller. A microcontroller is a simple computer. It can't do many things at the same time but it does what it is told to do really well. You already interact with lots of microcontrollers every day because they control things like microwaves and washing machines.
There are a lot of different types of microcontroller, but the special thing about Arduino is that it is designed for people who are just starting out. So, if you are new to code or electronics, that's okay because the Arduino is great for beginners. But don't underestimate it-it can still take on big projects.
After completing these adventures, you will have learned how to set up the Arduino programming environment on your computer and how to write and upload code to your Arduino board. You will find out how to work with three different Arduino boards: the Uno, Leonardo and the Lilypad USB.
You will learn basic programming concepts that you can use beyond working with the Arduino. The Arduino language is based on the C/C++ language. This means that as you learn how to code Arduinos, you are also learning about how programming works on computers like a laptop or a Raspberry Pi.
Alongside programming, you will be introduced to circuits and electronics. You will learn how to use sensors to detect real-world signals like light or movement, and you will learn how to generate actions in the real world, such as playing a sound or turning on a light.
By the end of this book, you will have a broad understanding of what you can do with an Arduino and be ready to start designing and building project ideas of your own!
It's becoming easier to buy Arduino boards in stores. Popular retail chains like Maplin in the UK now stock Arduinos. Both of those stores also sell the electronic components that you need for the projects in this book. If it's not convenient for you to get to a store there are also many online retailers to choose from, and some of these are listed in Appendix B.
This section explains all the parts you need to make all the projects in this book. Many of the projects use the same core parts.
Of course, the most important thing you need is an Arduino board. There are many different kinds of Arduino boards, but the Arduino Uno is the most common one and the one you use the most in this book. You also need an Arduino Leonardo for Adventure 7 and a Lilypad Arduino USB for Adventure 8. All three boards are shown in Figure I-1.
FIGURE I-1 Arduino Uno (top left), Arduino Leonardo (bottom left) and Lilypad Arduino USB (right)
You will need a USB cable to connect your Arduino board to your computer. For the Arduino Uno you need a "normal" USB cable, but for the Arduino Leonardo and Lilypad Arduino USB you need a USB Micro cable. Both are pictured in Figure I-2.
FIGURE I-2 A USB and USB Micro cable
You use breadboards to build circuits. Breadboards let you connect components easily without having to use solder. They come in different colours and sizes. The larger ones are useful for more complicated projects with lots of parts, whereas the smaller ones are good for projects that you want to fit inside a small space. Two different sizes of breadboards made from two different types of plastic are shown in Figure I-3. Adventure 3 is the only project that uses a breadboard in the completed project; the other adventures use a breadboard only to test a circuit. A larger breadboard will be easier to work with, but if you can only find smaller ones, that's perfectly okay.
FIGURE I-3 Breadboards in different sizes and colours
Jumper wires are wires you use when you build prototype circuits to try out new concepts. They may be short pieces of stiff wire like those shown on the right in Figure I-4, or they may be more flexible wire with pins on either end like the ones on the left.
FIGURE I-4 Jumper wires
LEDs are a particular sort of light (LEDs stands for light-emitting diodes) that come in a big selection of sizes and colours. For most of the projects in this book you can use whatever size and colour of LEDs you like. The most common size is 5 mm, but the larger 10 mm LEDs can be great fun to use too. Most LEDs are single-colour, but you use an LED in Adventure 6 that has four legs instead of only two and can change colour. In Adventure 8 you use something called a Lilypad LED, which is made especially for sewing circuits. All the different types of LED used in the projects are shown in Figure I-5.
FIGURE I-5 Different types of LED, with a colour-changing LED on the right and below it a Lilypad LED
Resistors are a component you read more about in the adventures. They come in different values of resistance, which is measured in ohms (O). You don't need many different resistances for the projects in the book but as resistors are small and quite cheap it's a good idea to buy extra. You need resistors of 68 or 100 O, 220 O, 10k (10,000) O, 1M (1,000,000) O and 10M (10,000,000) O. Figure I-6 shows the different resistors.
FIGURE I-6 Resistors needed for the projects in this book: 100O (top left), 220O (top right), 10kO (bottom left), 1MO (bottom middle) and 10MO (bottom right)
Potentiometers are the electronic components behind volume knobs or dials on a stereo. They come in many different sizes and shapes. Some fit into a breadboard on their own, like the blue one in Figure I-7, whereas others need wires soldered to them that can connect to a breadboard, like the one in the middle in Figure I-7. Larger ones are easier to mount in a project and may be called panel-mount potentiometers.
FIGURE I-7 Three different types of potentiometer
A servo, shown in Figure I-8, is a motor that you use in Adventure 3.
FIGURE I-8 A servo motor
Buttons are another component that come in many shapes and sizes. You might have never noticed this before, but there are many different kinds of button! All the projects in this book use push-to-make (the opposite of push-to-break) buttons so those are the ones to buy; as long as they are push-to-make, you can use any kind of button you would like. Tactile push buttons are very little buttons that fit in a breadboard, so they are good to have when you are testing your circuit. For your actual projects, panel mount push buttons are better. Both are shown in Figure I-9.
FIGURE I-9 A tactile push button (left) and three different panel mount buttons (right)
In Adventure 4 you discover how to use shift registers, which are small black chips you can use to control a lot of LEDs. You want a chip that is a 74HC595 shift register-you find out what that means in the adventure. You need to buy a chip with 16 legs on it, as shown in Figure I-10.
FIGURE I-10 A shift register
Piezos are used to detect vibrations and can also make sound, like a speaker. You need one piezo for Adventure 5 and six for Adventure 9. They sometimes come inside black plastic housing, which is okay for the one in Adventure 5 but you need at least five without housing (like the one in Figure I-11) for Adventure 9.
FIGURE I-11 A piezo
A light-dependent resistor can tell an Arduino board how bright or dark it is. These look like the one in Figure I-12 or can be a little bigger.
FIGURE I-12 A light-dependent resistor
Header pins are small strips of metal that are separated by plastic so that they fit perfectly into the holes on the Arduino Uno. They come in different spacings (called pitches), so you should make sure you get 2.54 mm male header pins, like the ones in Figure...
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.