Book Image

Raspberry Pi Zero Cookbook

Book Image

Raspberry Pi Zero Cookbook

Overview of this book

The Raspberry Pi Zero, one of the most inexpensive, fully-functional computers available, is a powerful and revolutionary product developed by the Raspberry Pi Foundation. The Raspberry Pi Zero opens up a new world for the makers out there. This book will give you expertise with the Raspberry Pi Zero, providing all the necessary recipes that will get you up and running. In this book, you will learn how to prepare your own circuits rather than buying the expensive add–ons available in the market. We start by showing you how to set up and manage the Pi Zero and then move on to configuring the hardware, running it with Linux, and programming it with Python scripts. Later, we integrate the Raspberry Pi Zero with sensors, motors, and other hardware. You will also get hands-on with interesting projects in media centers, IoT, and more.
Table of Contents (17 chapters)
Raspberry Pi Zero Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Understanding the standard connectors and test points


If you've worked with a Raspberry Pi 1, 2, or 3 before, you will find the Raspberry Pi Zero to be similar, but quite a bit smaller. To accommodate such a small size, several connectors had to be miniaturized or reduced. Taking a close look, you will find that the same potential is contained in this small board. Throughout the following recipes, we will look at the Raspberry Pi Zero, its functional components, and how it compares to the larger Raspberry Pi boards. By the end of this chapter, you will have a running Raspberry Pi Zero!

Getting ready

To get your Raspberry Pi Zero online on HDMI, the following equipment will be needed:

  • A Raspberry Pi Zero

  • A micro-USB power adapter, 5 V/1.2 A out

    Note

    The Raspberry Pi documentation allows up to 2.5 A for the Pi's power supply, in case you don't want to use a powered USB hub. For this cookbook, we will start with a powered USB hub but work toward low-power and low-profile solutions.

  • A micro-USB OTG (On-The-Go) adapter

  • A 4-port powered USB hub

  • A micro-HDMI to standard HDMI adapter and HDMI cable or a micro-HDMI to standard HDMI cable

  • A micro SD card (4 GB minimum, 8 GB recommended)

  • A USB keyboard and mouse

  • A monitor that takes HDMI, or DVI with a DVI-HDMI adapter

  • A computer with an SD card interface running Mac OS X, Windows, or Linux

Note

A great resource for checking device compatibility are the Raspberry Pi pages in the Embedded Linux wiki ( www.elinux.org ). This has a rather large list of known compatible devices as well as known problematic ones and ones that will likely require a powered USB hub to operate.

How to do it...

Take a look at your Raspberry Pi Zero and examine each of the connections. They really fit a lot into a small space:

Raspberry Pi components

The numbers in the figure denote the following components:

  1. The GPIO header is the same one you will find on the Raspberry Pi B and later versions. The big difference here is that a header hasn't been soldered on. If you project requires your Raspberry Pi to be very thin, then you can solder your connections directly to the board. If you are using your Zero for prototyping, you can attach whichever header makes your life easiest. For this book, we will have the female 90-degree header soldered on for easy interfacing to the Adafruit Pi Cobbler.

  2. The Micro SD card slot is very much the same as previous versions, with the big difference being that it is push-in/pull-out instead of other boards' push-in/push-out slot.

  3. The mini-HDMI port works just like a regular-sized port, though it requires an HDMI mini-to-regular adapter or cable to connect to LCD monitors.

  4. The first USB port is micro-USB, and the only USB port available for data use on the Raspberry Pi Zero. For use with standard USB components such as mice and keyboards, you will need a micro-USB OTG adapter and a powered USB hub. As we move forward in the book, we will discover ways to run "headless" so that not all the connections are required, but to get started, you will want an adapter and a hub.

  5. The second USB port is the Raspberry Pi's power connection, which we will take a closer look at in the next recipe.

  6. This bus is to attach the Raspberry Pi's camera cable.

  7. While RCA video is no longer available on the Raspberry Pi Zero, we will hack it later to understand how to use the older, non-HDMI way to see video.

  8. Finally, on this side of the board, the connectors marked RUN are for resetting the Raspberry Pi. Shorting these connections will reset your Raspberry Pi.

The back side of the board contains test connector points:

Raspberry Pi Zero test pads

Not all the test points are documented for the Raspberry Pi Zero, but several are known:

Label

Function

Label

Function

PP1

5-V-micro USB

PP18

SD_DAT2

PP3

GND

PP19

SD_DAT3

PP4

GND

PP20

PP5

GND

PP22

PP6

GND

PP23

PP8

3.3 V

PP35

GND

PP9

PP36

PP14

SD_CLK

PP37

CAM_GPIO0

PP15

SD_CMD

PP38

CAM_GPIO1

PP16

SD_DAT0

PP39

SCL0

PP17

SD_DAT1

PP40

SDA0

Test points are great for validating that your Raspberry Pi is seeing the right voltage and/or frequencies. Many of the test points require an oscilloscope to observe and are thus beyond the scope of this book, but testing and troubleshooting prototypes is as easy on a Raspberry Pi Zero as it is on one of the larger boards.