Copyright 2017 Akkana Peck. All rights reserved.
Published by Maker Media, Inc., 1700 Montgomery Street, Suite 240, San Francisco, CA 94111
Maker Media books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Publisher: Roger Stewart
Editor: Patrick DiJusto
Copy Editor: Elizabeth Welch, Happenstance Type-O-Rama
Proofreader: Scout Festa, Happenstance Type-O-Rama
Interior Designer and Compositor: Maureen Forys, Happenstance Type-O-Rama
Cover Designer: Maureen Forys, Happenstance Type-O-Rama
Indexer: Valerie Perry, Happenstance Type-O-Rama
All the circuit and component diagrams in this book are created using Fritzing (http://fritzing.org/home).
August 2017: First Edition
Revision History for the First Edition
2017-08-28 First Release
See oreilly.com/catalog/errata.csp?isbn=9781680453911 for release details.
Make:, Maker Shed, and Maker Faire are registered trademarks of Maker Media, Inc. The Maker Media logo is a trademark of Maker Media, Inc. Jumpstarting the Raspberry Pi Zero W and related trade dress are trademarks of Maker Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Maker Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-680-45-391-1
Safari Books Online
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business. Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals. Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions to the publisher:
Maker Media
1700 Montgomery St.
Suite 240
San Francisco, CA 94111
You can send comments and questions to us by email at books@makermedia.com.
Maker Media unites, inspires, informs, and entertains a growing community of resourceful people who undertake amazing projects in their backyards, basements, and garages. Maker Media celebrates your right to tweak, hack, and bend any Technology to your will. The Maker Media audience continues to be a growing culture and community that believes in bettering ourselves, our environment, our educational systemour entire world. This is much more than an audience, its a worldwide movement that Maker Media is leading. We call it the Maker Movement.
To learn more about Make: visit us at makezine.com. You can learn more about the company at the following websites:
Maker Media: makermedia.com
Maker Faire: makerfaire.com
Maker Shed: makershed.com
Dedication
To Dave: husband, friend, life companionplus editor and proofreader
Acknowledgments
Any book represents the work of a team, not just a single author.
Id like to thank my husband Dave for his endless work reviewing each draft and helping rein in my prolixitynot to mention putting up with my angst and bellyaching when things didnt work as expected.
The staff at Maker MediaLiz, Maureen, and especially my editor, Patrickwere ever helpful and patient, putting up with my constant stream of rewrites and trying to work through the various software problems we encountered.
And lets not forget all the folks who share open source code and libraries. Without them, the Pi Zero W would never light a single LED.
The wiring diagrams in the book were made with Fritzing, a terrific free tool for sharing circuit information (http://fritzing.org/). The images were edited with GIMP, the premiere open source image editing tool. The Fritzing .fzz
and GIMP .xcf
files are on the books GitHub repository, https://github.com/akkana/pi-zero-w-book.
Chapter 1
Getting Started
W hy choose the Raspberry Pi Zero W? Its small. Its cheap. Its power efficient. It has WiFi and Bluetooth Low Energy (BLE) built in. And it has the same general-purpose input/output (GPIO) header that bigger Raspberry Pis have: the gateway to controlling all sorts of hardware.
Its easy to build gizmos that use hardware and networking in fun ways. In this book, youll build three projects using the Pi Zero W:
- Blinking LEDs
- An environmental monitor that can keep track of the temperature in your house, and even turn on your fan or air conditioner before you get home from work
- A wearable light string that monitors news feeds and websites to alert you when theres something interesting going on
You dont need much prior experience with either hardware or programmingthough knowing how to solder will help.
With what you learn from these projects, you can extend the Pis power to hundreds of other hardware and software projects.
Hardware Requirements
Each chapter opens with a list of hardware required to finish the project. That makes it easy to know you have what you need without running to the electronics store every half hour, or if you live in a remote area, waiting several days for mail order.
Heres the hardware youll need for this introductory chapter:
- The Raspberry Pi Zero W itself (though you can follow along on any Raspberry Pi)
- A power source: 5 volts, at least 1 amp, with a MicroUSB plug
- A microSD card, preferably at least 8 GB, to use with a monitor (you can get by with 4 GB if you only want to run headless)
- Another computer with WiFi and a MicroSD writer
To use the PIXEL desktop, youll need the following:
- A monitor, keyboard, and mouse
- A cable that connects mini-HDMI to your monitor
- A USB hub, ideally one with external power and not USB 3: either a hub that plugs into MicroUSB, or a regular hub plus a USB On-the-Go (OTG) adapter
Next page