Getting Started with the Raspberry Pi Zero 2 W a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t2220

Contents

Introduction

The latest entry into the immensely popular Raspberry Pi Single Board Computer (SBC) catalog, the Raspberry Pi Zero 2 W, provides an upgraded drop-in replacement to the Pi Zero W powered by a quad-core 64-bit Arm Cortex-A53 CPU. This guide highlights the improvements in hardware on the Pi Zero 2 W, how to set it up in a desktop configuration as well as installing and the basics of using the Raspberry Pi OS.

Raspberry Pi Zero 2 W

Raspberry Pi Zero 2 W

DEV-18713
$15.00
32
Raspberry Pi Zero 2 W (with Headers)

Raspberry Pi Zero 2 W (with Headers)

DEV-26256
$18.00
2

The Raspberry Pi Zero 2 W Basic Kit provides the bare bones of a Pi Zero 2 W setup. The kit includes a Pi Zero 2 W, Raspberry Pi 12.5W Micro-USB Power Adapter, mini HDMI cable, USB OTG cable and a 64GB MicroSD Card with adapter.

SparkFun Raspberry Pi Zero 2 W Basic Kit

SparkFun Raspberry Pi Zero 2 W Basic Kit

KIT-18735
$49.95
5

Required Materials

This guide assumes users have the Pi Zero 2 W Basic Kit so if you do not have the kit, make sure you have the necessary accessories (power adapter, mini HDMI cable, USB OTG cable or USB hub & a microSD card). Along with the Basic Kit, you will need a monitor (or TV), keyboard, mouse and USB hub (for more than one USB device) to follow this tutorial. Users in need of a keyboard/mouse combo may want to consider the Logitech K400 Plus Wireless Touch Keyboard.

Suggested Reading

Users unfamiliar with the concepts covered in the tutorials below may want to read through them before continuing with this guide:

Single Board Computer Benchmarks

How to set up different benchmarking programs on single board computers or computing modules and run them. The results for various generations are shown on the subsequent pages.

SD Cards and Writing Images

How to upload images to an SD card for Raspberry Pi, PCDuino, or your favorite SBC.

Raspberry gPIo

How to use either Python or C++ to drive the I/O lines on a Raspberry Pi.

Raspberry Pi SPI and I2C Tutorial

Learn how to use serial I2C and SPI buses on your Raspberry Pi using the wiringPi I/O library for C/C++ and spidev/smbus for Python.

Hardware Overview

In this section we'll explore the hardware present on the Pi Zero 2 W and, where relevant, compare it to the previous version and other Rapsberry Pi SBCs.

Raspberry Pi RP3A0 SiP

Photo highlighting RP3A0 SiP

The Pi Zero 2 W features an upgraded RP3A0 system-in-package (SiP) incorporates a quad-core 64-bit Arm Cortex-A53 CPU, clocked at 1GHz The SiP integrates a Broadcom BCM2710A1 die with 512MB of LPDDR2 SDRAM. The processor provides the Raspberry Pi Zero 2 W with 40% more single-threaded performance, and five times more multi-threaded performance, than the original single-core Raspberry Pi Zero.

Mini HDMI

Photo highlighting Mini HDMI connector

Unlike the previous models of the Raspberry Pi which use a standard HDMI connector, the Zero uses a mini HDMI connector to save space. To connect the Zero to a monitor or television, you will need a mini HDMI to HDMI adapter or cable.

USB On-the-Go

Photo highlighting the Pi Zero USB OTG

The Raspberry Pi 3 and other models have traditionally had 2-4 standard size female USB connectors, which allowed for all variety of devices to connect including mice, keyboards, and WiFi dongles. Again to save space, the Zero has opted for a USB On-the-Go (OTG) connection. The Pi Zero uses the same Broadcom IC that powered the original Raspberry Pi A and A+ models. This IC connects directly to the USB port allowing for OTG functionality, unlike the Pi B, B+, 2 and 3 models, which use an onboard USB hub to allow for multiple USB connections.

To connect a device with a standard male USB connection, the Basic Kit includes a USB OTG cable. Plug the microUSB end into the Pi Zero, and plug your USB device into the standard female USB input.

For use with other standard USB devices, we recommended that you use a powered USB hub. Wireless keyboard and mouse combos work best as they have one USB dongle for both devices.

Power

Photo highlighting Pi Zero power In USB connector.

Like other Pis, power is provided through a microUSB connector. Voltage supplied to the power USB should be in the range of 5-5.25V.

microSD Card Slot

Photo highlighting the microSD card slot

Another familiar interface is the microSD card slot. Insert your microSD cards that contains your Raspberry Pi image file here.

WiFi and Bluetooth

The Raspberry Pi Zero 2 W offers 2.4GHz 802.11 b/g/n wireless LAN and Bluetooth 4.2, along with support for Bluetooth Low Energy (BLE), and modular compliance certification. This frees up many of the connections that would have been made over USB, such as a WiFi dongle and a USB keyboard and mouse if substituting a Bluetooth keyboard/mouse.

Camera Connector

Photo highlighting the camera connector

The Raspberry Pi Zero V1.3+ and all Zero Ws have an onboard camera connector. This can be used to attach the Raspberry Pi Camera module. However, the connector is a 22pin 0.5mm and different than the standard Pi. You will need a different cable to connect the camera to the Pi Zero W.

GPIO

Photo highlighting Pi Zero GPIO

As with all other models of the Raspberry Pi, the Pi Zero 2 W includes a 2x20 set of GPIO pins broken out offering functionality such as SPI, I2C, digital I/O, PWM, etc. If you are using the GPIO header, you may want to consider soldering headers to it.

Choosing and installing an OS

Before powering on your Pi Zero 2 W you'll need to flash an image of the Raspberry Pi OS (or if you prefer, a third party operating system that work with Raspberry Pi) to the microSD card included with the Basic Kit. The Raspberry Pi Foundation created a great tool called the Raspberry Pi Imager that makes downloading and flashing an OS image a microSD card simple. This section briefly goes over how use that tool to upload an image of the Raspberry Pi OS on your microSD card.

Raspberry Pi Imager

The Raspberry Pi Imager tool makes selecting and writing an image of a Raspberry Pi-compatible operating system to a microSD card way easier than it was in the past. All you need to do is select the OS and storage device and the tool takes care of the rest. Download the tool from Raspberry Pi's software page here:

Get the Raspberry Pi Imager Tool Here!

Once the tool is downloaded and installed on your computer, follow the steps below to complete the image installation:

Writing the OS to the microSD card can take a few minutes depending on which version was selected and the speed of the port/microSD card. Once the write is finished, the tool should automatically perform the software ejection for the microSD card so you can remove it once the process completes.

Note: The software page also includes a link to a range of alternate operating systems for users who prefer to download and install them manually. For help manually writing and installing images, check out this tutorial.

Hardware Assembly

With an OS written to the microSD card, we can start connecting everything up. We used the Logitech K400 Plus Wireless Touch Keyboard to keep all the input devices tied to a single USB connection. Note, this keyboard is not included with the SparkFun Raspberry Pi Zero 2 W Basic Kit.

Insert the microSD card

Plug the microSD card into the microSD socket on the Pi Zero 2 W.

microSD inserted into slot

Connecting Peripheral Devices

Next up, connect any peripheral equipment to the Pi. Most users will need at least a monitor and keyboard/mouse to get started with the Pi.

USB OTG Cable

Plug the USB OTG cable into the microUSB connector labeled USB on the Pi. This provides a standard USB connection for devices like a keyboard or mouse. A USB hub or extender is required if you need to connect multiple USB devices to your Pi Zero 2 W.

USB OTG Cable connected

Keyboard and Mouse

You can use the USB OTG cable to plug in a Keyboard/Mouse. For this tutorial we used the Logitech K400 Plus Wireless Touch Keyboard as it has one USB dongle for both devices. For use with other standard USB devices, it is recommended that you use a powered USB hub.

Keyboard/Touch Pad connected
Note: The Logitech K400 Plus Wireless Touch Keyboard pictured here is not included in the Basic Kit

Monitor

Plug in the miniHDMI cable included with the Basic Kit to the miniHDMI connector on the Pi Zero 2 W. Connect the other end of the cable to the HDMI port on your monitor or TV.

miniHDMI connected

Power Supply

With everything connected and the microSD card inserted, connect the power supply to the microUSB connector labeled PWR IN and the Pi should start booting up.

Power supply plugged in

Completed Setup

With everything connected, your setup should look similar to the photo below:

Full Assembly

Connecting Hardware

The steps above provide the basics to get the Pi Zero 2 W up and running but we've barely scratched the surface of the potential of this little computer. The 2x20 GPIO header on the Pi provides access to a host of additional functionality so users who wish to take advantage of that will want to solder a set of headers like these to it.

Users looking to do some breadboard prototyping with the Pi Zero 2 W may want to use the Pi Wedge and these tutorials to use the GPIO pins:

Preassembled 40-pin Pi Wedge Hookup Guide

October 29, 2015

Using the Preassembled Pi Wedge to prototype with the Raspberry Pi B+.

Raspberry gPIo

October 29, 2015

How to use either Python or C++ to drive the I/O lines on a Raspberry Pi.

Headless Raspberry Pi Setup

April 23, 2018

Configure a Raspberry Pi without a keyboard, mouse, or monitor.

If you want to use any SparkFun Qwiic devices with your Pi Zero 2 W, take a look at the SparkFun Qwiic SHIM or Qwiic SHIM Kit or Qwiic Starter Kit for Raspberry Pi:

Qwiic SHIM for Raspberry Pi Hookup Guide

December 5, 2019

Ever wanted to prototype I2C components on a Pi? Now you can!

Qwiic SHIM Kit for Raspberry Pi Hookup Guide

February 16, 2021

Get started with the Serial LCD with RGB backlight and 9DoF IMU (ICM-20948) via I2C using the Qwiic system and Python on a Raspberry Pi! Take sensor readings and display them in the serial terminal or SerLCD.

Finally, the camera connector allows you to connect a Raspberry Pi camera. Be aware, the connector is a 22pin 0.5mm and different than the standard Pi and needs a different cable to connect the camera to the Pi Zero 2 W.

Headless

If you prefer a "headless" setup with no monitor, keyboard or mouse; the tutorials below can help (note, headless setups are much more advanced than a standard setup):

Headless Raspberry Pi Setup

April 23, 2018

Configure a Raspberry Pi without a keyboard, mouse, or monitor.

How to Use Remote Desktop on the Raspberry Pi with VNC

July 9, 2018

Use RealVNC to connect to your Raspberry Pi to control the graphical desktop remotely across the network.

Using the Raspberry Pi OS

Now that you've gotten your board up and running let's go over some basics of the Raspberry Pi OS. This section covers how to use the Pi via HDMI out to a monitor.

Raspberry Pi OS

The Raspberry Pi OS is Linux based (to be specific it is a port of Debian Bullseye with the Raspberry Pi Desktop). Don't let that scare you too much. Gone are the days of having to remember lots of commands or that you need to type :wq to save and exit your text editor. The OS runs a desktop Graphical User Interface (GUI) similar to Windows or MacOS, and, while you will probably want to learn a few basic commands and shorcuts, you can usually get away with not using them.

Initial Boot

The first boot of the Pi with a fresh install of the OS takes a few minutes and the Pi will most likely restart at least once. Once the OS finishes initial setup, you should be greeted by a desktop setup similar to the image below:

Set Up Wizard

Follow the set up wizard to configure the location settings, set a new password, connect to WiFi, update the system and packages and more settings on the Pi. You can skip some of these steps but we strongly recommend at least setting the location and setting a new password. If you ever need to go back and update the settings, open them by going to the Raspberry Pi Start Menu > Preferences > Raspberry Pi Configuration.

Raspberry Pi Configuration from Start Menu

This opens a pop up allowing you to update the region, monitor, keyboard, password, as well as turn on any peripheral interfaces like SPI and I2C.

Raspberry Pi Configuration

Update Software

In case you skipped the step in the set up wizard or need to update software packages in the future, we can update the software package on the Pi through the Command Line Interface (CLI). Access it by opening the terminal and type the following and hit Enter:

language:bash
sudo apt-get update

This command tells the Pi to retrieve the latest package information and tells the package manager what needs updating.

This downloads and upgrades all packages on the system and may take a while.

Shutdown/Reboot

The desktop includes a standard shutdown button in the desktop main menu but you can also tell the Pi to shutdown through the CLI using this command:

language:bash
sudo shutdown -h now

To reboot the Pi through the CLI send this command:

language:bash
sudo shutdown -r now

Other Useful Linux Commands

A few other useful commands for use in the terminal command line:

Troubleshooting

Having issues getting the Raspberry Pi to work? Check out this sticky note from the Raspberry Pi Foundation's forum for basic troubleshooting.

Pi Foundation Forums: Basic Troubleshooting with the Raspberry Pi

Having problems with a piece of SparkFun hardware designed for the Raspberry Pi and interfacing it? Try checking out the SparkFun forums to see if we can assist.

SparkFun Forums

Resources and Going Further

At this point your Pi Zero 2 W should be acting similar to any other computer. From here, you can teach yourself the finer points of Linux, learn Python, program the GPIO pins, setup a Minecraft server, build a network storage system, game console, or media center, or just surf the web.

For more information about the Pi Zero 2 W or Raspberry Pi in general, check out these resources:

Looking to make the Raspberry Pi Zero W a dongle? Check out the Pi Zero USB Stem:

Need some inspiration? Check out these tutorials and projects.

Qwiic HAT for Raspberry Pi Hookup Guide

Get started interfacing your Qwiic enabled boards with your Raspberry Pi. This Qwiic connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors.

Using Home Assistant to Expand Your Home Automations

An introduction to Home Assistant, an open source home automation hub.

SparkFun Auto pHAT Hookup Guide

The pHAT to get your projects moving. This guide will help you get started using the Auto pHAT.

RP2040 Thing Plus Hookup Guide

Want to take a stab at advancing your programming skills? Check out the Thing Plus - RP2040, with the first microcontroller from the Raspberry Pi Foundation. This guide will get you started working with the RP2040 and programming in MicroPython and C/C++.

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado