Experimenting.with.Raspberry.Pi.pdf
(
3247 KB
)
Pobierz
TECHNOLOGY IN ACTION™
Experimenting
with
Raspberry Pi
LOW-COST PROJECTS TO HELP YOU
GENERATE IDEAS, FROM MASTERING
THE RASPBERRY PI
Warren Gay
www.it-ebooks.info
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
www.it-ebooks.info
Contents at a Glance
About the Author �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xiii
About the Technical Reviewer �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xv
Acknowledgments �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xvii
Introduction �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
xix
■
Chapter 1: DHT11 Sensor �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
1
■
Chapter 2: MCP23017 GPIO Extender �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
15
■
Chapter 3: Nunchuk-Mouse �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
47
■
Chapter 4: Real-Time Clock �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
77
■
Chapter 5: VS1838B IR Receiver�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
99
■
Chapter 6: Stepper Motor �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
119
■
Chapter 7: 76 The H-Bridge Driver �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
139
■
Chapter 8: Remote-Control Panel �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
159
■
Chapter 9: Pulse-Width Modulation�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
183
■
Appendix A: Glossary�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
205
■
Appendix B: Power Standards �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
211
■
Appendix C: Electronics Reference �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
213
■
Appendix D: ARM Compile Options �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
215
■
Appendix E: Mac OS X Tips �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
217
Index �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
219
v
www.it-ebooks.info
Introduction
These are exciting times for the computing enthusiast. AVR and PIC microcontrollers
make low-level digital computing readily accessible. At the high-level there exist System
on a Chip (SoC) platforms, such as the Raspberry Pi. These are capable of supporting
complex applications at affordable prices.
New challengers to the Raspberry Pi regularly appear now, yet the Pi remains
popular. This is because of the Raspberry Pi Foundation’s excellent support and the unit’s
continuing dominance in price. Both are critical to success. Foundation support provides
continued Raspbian Linux development, making it easier for people to get started and
use the platform. The foundation also continues to provide documentation and to
develop Pi specific peripherals such as the camera. Finally, low cost allows more people
to participate and at lower risk, should an experiment go bad.
Content of This Book
This book was formed from a category of chapters in the full volume
Mastering the
Raspberry Pi.
The focus in this particular book is experiments in Raspberry Pi interfacing
to the outside world. Every chapter involves some aspect of interfacing GPIO, PWM, I2C
bus, or SPI bus to some external electronics.
More than the electronic interface design is covered, however, since every interface
requires software to drive it. In some cases, applications will utilize Raspbian Linux
drivers to control the peripheral (such as the I2C bus). In other experiments, the
application software must control the GPIO pins directly. In every case, simplified
C programming is used as a place to start. The reader is encouraged therefore to apply
these programs as “idea generators.” Jump in and modify the programs to adapt to your
own ideas. Software is infinitely malleable.
Approach Used
The focus of this text is on learning. You would not be well served if you were presented
some kind of “end product” to be plugged in and simply used. Instead, you are
encouraged to learn to design interfaces to the Pi for yourself—to build from scratch or to
modify existing designs. This book will give you some practical examples to work through.
Experience is the best teacher.
xix
www.it-ebooks.info
■
IntroduCtIon
While this is not an electronics engineering text, a light engineering approach is
applied. For example, the difference between the signal levels of the Pi versus the levels
required by an interfaced IC is scrutinized for some experiments. These parameters are
taken from the IC’s datasheet. This design work is to counter the glib “seems to work”
approach often given in web blogs. It is better to
know
that it will work and that it will
always
work. Getting it right is not difficult when a little care and understanding goes into
the process.
Assumptions About the Reader
Since the experiments in this book involve attaching things to the Raspberry Pi’s GPIO
pins, some digital electronics knowledge is assumed. The reader should have a good grasp
of DC voltage, current, and resistance at a minimum. Students who know Ohm’s law
will fare best in these experiments. For students who have not yet committed Ohm’s law to
memory, Appendix C serves a quick reference.
The Raspberry Pi uses 3.3 V digital logic. This creates a special problem when
interfacing to older TTL logic, which operates at the 5 V level. The experiment in Chapter 4
Real Time Clock, for example, demonstrates how to interface safely to a 5 V device, after
making some modifications to a purchased pcb. These experiments require extra care to
avoid damaging the Pi.
Experiments involving the I2C bus require the reader to be familiar with the concept
of open collector drivers. Without this understanding, the student will not appreciate why
a 3.3 V Pi can interface to a 5 V real-time clock chip, using the I2C bus. This concept is also
critical to understanding why several peripherals can share that same bus.
Hardware for the experiments assumes a student budget. The parts and assembled
pcbs used in this book were purchased from eBay, usually as buy-it-now auctions
(with free shipping). For this reason, the student need not have deep pockets to acquire
the parts used in these experiments.
Since hardware needs software to direct it, C programs are used and provided.
Consequently, it is best that you have at least a vague idea about the C programming
language to get the most out of the experiments. The example programs are simplified as
much as they could be without sacrificing function. This keeps the software accessible to
the reader and eases the learning process.
Pi Hardware Assumed
All of the experiments in this book interface directly to the Raspberry Pi. No special
Gertboard or other special product is used. For this “bare-metal approach,” all you need
is a Raspberry Pi and the involved experiment’s hardware.
For my own experiments, I constructed a home-brewed setup where I placed the Pi
on a block of wood and ran wires out to some retro Fahnestock clips. While this worked
quite well, building this setup required considerable effort. I would recommend that
students get something easier like the Adafruit Pi Cobbler.
xx
www.it-ebooks.info
Plik z chomika:
chomikuj8ceggd
Inne pliki z tego folderu:
Senaxrafgrva (Fcnavfu Rqvgvba) - Znel Furyyrl.rar
(459158 KB)
Uneel Cbggre Ohaqyr Obbxf 1-7 Rfcnñby - W.X. Ebjyvat.rar
(2578198 KB)
Nhqvb Ovoyrf - Fcnavfu Ervan Inyren Fnagn Ovoyvn Nagvthb l Ahrib Grfgnzragb.rar
(3059841 KB)
Fvafnwb Ybf whrtbf qry unzoer_ Yvoeb 3 - Fhmnaar Pbyyvaf.rar
(684437 KB)
Ra yynznf Ybf whrtbf qry unzoer_ Yvoeb 2 - Fhmnaar Pbyyvaf.rar
(696325 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
Adobe 2019 Collection MacOS
Adobe 2019 Collection WIN
Adobe Master Collection CC 2020 04.09.2020 (macOS)
Android
Zgłoś jeśli
naruszono regulamin