Stufin
Home Quick Cart Profile

Raspberry Pi Zero 2 W

Buy Now

Pin Configuration

  • Raspberry Pi Zero 2 W Pinout Guide
  • The Raspberry Pi Zero 2 W is a compact and powerful single-board computer that features a 40-pin GPIO header. Here's a detailed explanation of each pin, along with connection guidelines:
  • GPIO Pins (1-40)
  • Pins 1-2: Power Pins
  • Pin 1: 3.3V Power (Output)
  • + Connect to devices that require a 3.3V power supply.
  • Pin 2: 5V Power (Output)
  • + Connect to devices that require a 5V power supply.
  • Pins 3-4: GPIO and UART
  • Pin 3: GPIO 2 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as UART transmit (TX) pin.
  • Pin 4: 5V Power (Output)
  • + Connect to devices that require a 5V power supply.
  • Pins 5-6: GPIO and I2C
  • Pin 5: GPIO 3 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C clock (SCL) pin.
  • Pin 6: GPIO 4 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C data (SDA) pin.
  • Pins 7-8: GPIO and UART
  • Pin 7: GPIO 5 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as UART receive (RX) pin.
  • Pin 8: GPIO 6 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 9-10: GND
  • Pin 9: Ground (GND)
  • + Connect to ground on your circuit or device.
  • Pin 10: Ground (GND)
  • + Connect to ground on your circuit or device.
  • Pins 11-12: GPIO and SPI
  • Pin 11: GPIO 7 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI clock (SCLK) pin.
  • Pin 12: GPIO 8 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI MISO (Master In Slave Out) pin.
  • Pins 13-14: GPIO and SPI
  • Pin 13: GPIO 9 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI MOSI (Master Out Slave In) pin.
  • Pin 14: GPIO 10 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI CS (Chip Select) pin.
  • Pins 15-16: GPIO
  • Pin 15: GPIO 11 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 16: GPIO 12 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 17-18: Power Pins
  • Pin 17: 3.3V Power (Output)
  • + Connect to devices that require a 3.3V power supply.
  • Pin 18: Ground (GND)
  • + Connect to ground on your circuit or device.
  • Pins 19-20: GPIO
  • Pin 19: GPIO 13 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 20: GPIO 14 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 21-22: GPIO and UART
  • Pin 21: GPIO 15 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as UART transmit (TX) pin.
  • Pin 22: GPIO 16 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as UART receive (RX) pin.
  • Pins 23-24: GPIO
  • Pin 23: GPIO 17 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 24: GPIO 18 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 25-26: GPIO and I2C
  • Pin 25: GPIO 19 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C clock (SCL) pin.
  • Pin 26: GPIO 20 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C data (SDA) pin.
  • Pins 27-28: GPIO
  • Pin 27: GPIO 21 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 28: GPIO 22 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 29-30: GPIO and SPI
  • Pin 29: GPIO 23 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI clock (SCLK) pin.
  • Pin 30: GPIO 24 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI MISO (Master In Slave Out) pin.
  • Pins 31-32: GPIO
  • Pin 31: GPIO 25 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 32: GPIO 26 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 33-34: GPIO and SPI
  • Pin 33: GPIO 27 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI MOSI (Master Out Slave In) pin.
  • Pin 34: GPIO 28 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as SPI CS (Chip Select) pin.
  • Pins 35-36: GPIO
  • Pin 35: GPIO 29 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 36: GPIO 30 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pins 37-38: GPIO and I2C
  • Pin 37: GPIO 31 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C clock (SCL) pin.
  • Pin 38: GPIO 32 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • + Can also be used as I2C data (SDA) pin.
  • Pins 39-40: GPIO
  • Pin 39: GPIO 33 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Pin 40: GPIO 34 (Input/Output)
  • + Can be used as a general-purpose input/output pin.
  • Connection Guidelines
  • When connecting devices to the GPIO pins, ensure that the voltage levels are compatible (3.3V or 5V).
  • Use a suitable resistor or voltage divider to step down the voltage if necessary.
  • Be careful not to apply 5V to a 3.3V-only pin, as this can damage the Raspberry Pi.
  • Use a breadboard or PCB to connect your devices, ensuring that the GPIO pins are not short-circuited.
  • Remember to always refer to the official Raspberry Pi documentation and datasheets for more detailed information on using the GPIO pins and other features of the Raspberry Pi Zero 2 W.

Code Examples

Raspberry Pi Zero 2 W Documentation
Overview
The Raspberry Pi Zero 2 W is a compact, low-cost, and highly capable single-board computer (SBC) designed for IoT and robotics projects. It is an upgraded version of the original Raspberry Pi Zero, featuring a powerful quad-core CPU, 512MB of RAM, and built-in Wi-Fi and Bluetooth capabilities.
Technical Specifications
Processor: Broadcom BCM2710A1 quad-core Cortex-A53 ( ARMv8) 64-bit SoC
 Clock Speed: 1GHz
 RAM: 512MB LPDDR2 SDRAM
 Storage: microSD Card Slot
 Wireless Connectivity: 802.11 b/g/n Wi-Fi, Bluetooth 4.2
 GPIO: 40-pin GPIO header
 Power: microUSB port for power, 5V 2.5A recommended
Code Examples
### Example 1: Blinking an LED using Python
This example demonstrates how to use the Raspberry Pi Zero 2 W's GPIO pins to control an LED.
Hardware Requirements:
Raspberry Pi Zero 2 W
 Breadboard
 LED (any color)
 1k resistor
 Jumper wires
Software Requirements:
Raspbian OS (latest version)
 Python 3.x
Code:
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Set up LED pin as output
LED_PIN = 17
GPIO.setup(LED_PIN, GPIO.OUT)
try:
    while True:
        # Turn LED on
        GPIO.output(LED_PIN, GPIO.HIGH)
        time.sleep(1)
        # Turn LED off
        GPIO.output(LED_PIN, GPIO.LOW)
        time.sleep(1)
except KeyboardInterrupt:
    # Clean up GPIO on exit
    GPIO.cleanup()
```
Explanation:
1. Import the `RPi.GPIO` module and set up the GPIO mode to Broadcom (BCM).
2. Set up the LED pin as an output.
3. Use a try-except block to handle keyboard interrupts.
4. Inside the loop, turn the LED on and off using `GPIO.output()` with a 1-second delay between each state.
### Example 2: Wi-Fi Connectivity using Python
This example demonstrates how to use the Raspberry Pi Zero 2 W's built-in Wi-Fi capabilities to connect to a network and send an HTTP request.
Software Requirements:
Raspbian OS (latest version)
 Python 3.x
 `requests` library (install using `pip install requests`)
Code:
```python
import requests
# Set up Wi-Fi credentials
ssid = "your_wifi_ssid"
password = "your_wifi_password"
# Connect to Wi-Fi network
print("Connecting to Wi-Fi...")
requests.get(f"http://your_wifi_ssid:{password}@api.github.com")
# Send an HTTP request
print("Sending HTTP request...")
response = requests.get("https://www.example.com")
print(response.status_code)
```
Explanation:
1. Import the `requests` library.
2. Set up your Wi-Fi credentials (SSID and password).
3. Use the `requests.get()` function to connect to the Wi-Fi network by sending a GET request to the GitHub API with your credentials.
4. Send an HTTP request to a sample website (in this case, `https://www.example.com`) and print the response status code.
Note: Make sure to replace `your_wifi_ssid` and `your_wifi_password` with your actual Wi-Fi credentials.
These examples demonstrate the Raspberry Pi Zero 2 W's capabilities in GPIO control and Wi-Fi connectivity, making it an ideal choice for IoT projects.