Enter your credentials to continue
Join our secure network
Reset your password via email
The Raspberry Pi Zero series offers compact, cost-effective, and versatile computing solutions. These single-board computers are ideal for small-scale projects, embedded systems, and learning programming and electronics. In this page, we cover the key features of the Raspberry Pi Zero, Zero W, Zero 2, and Zero 2 W, as well as their performance capabilities, Wi-Fi & Bluetooth features, and use as USB devices.
Image: Simon Waldherr / Wikimedia Commons, licensed CC BY‑SA 4.0.
More info: Raspberry Pi Zero – Official Site
Image: Simon Waldherr / Wikimedia Commons, CC BY‑SA 4.0 :contentReference[oaicite:11]{index=11}
The original Raspberry Pi Zero is a small, affordable computer that offers an excellent entry point into the world of microcomputers. Its low cost and compact size make it perfect for DIY electronics projects, robotics, and embedded systems.
The Pi Zero is powered by a 1GHz single-core ARM11 processor. While it's not as powerful as other models, its efficiency and low power consumption make it ideal for lightweight tasks and simple embedded applications.
The original Pi Zero does not come with built-in Wi-Fi or Bluetooth. However, it can be extended with a Pi Zero W or external USB dongles for connectivity.
With a USB OTG (On-The-Go) port, the Raspberry Pi Zero can function as a USB device. This allows it to be connected to other computers and be used as a USB gadget, such as a keyboard, mouse, or network device.
The Raspberry Pi Zero W is an upgraded version of the Pi Zero, adding built-in Wi-Fi and Bluetooth 4.1. It retains the same size and low cost while providing improved connectivity for wireless applications.
The Pi Zero W uses the same 1GHz single-core ARM11 processor as the original Pi Zero. It is still suitable for lightweight computing tasks, but performance is limited compared to newer models.
One of the key improvements of the Pi Zero W over the original Pi Zero is the addition of Wi-Fi (802.11n) and Bluetooth 4.1. These features make the Pi Zero W perfect for IoT projects, portable devices, and other wireless applications without the need for external Wi-Fi/Bluetooth dongles.
Like the Pi Zero, the Pi Zero W also features a USB OTG port, allowing it to function as a USB device connected to other systems for use as a keyboard, mouse, or network adapter.
The Raspberry Pi Zero 2 is a major upgrade to the Pi Zero series, providing significantly improved performance with the addition of a quad-core Cortex-A53 CPU. This makes it ideal for more demanding applications while maintaining its small form factor and low power consumption.
The Pi Zero 2 is powered by a 1GHz quad-core ARM Cortex-A53 processor (the same architecture used in the Raspberry Pi 3). This provides a substantial boost in performance, making the Pi Zero 2 suitable for more complex tasks such as running web servers, media centers, and real-time control systems.
The Pi Zero 2 retains the Wi-Fi (802.11n) and Bluetooth 4.2 features of the Pi Zero W. These connectivity options are essential for many IoT and wireless applications, allowing easy connection to networks and devices.
The Pi Zero 2 also supports USB OTG functionality, enabling it to be used as a USB device, just like the Zero W. You can connect it to other computers as a USB gadget or peripheral device for various purposes.
The Raspberry Pi Zero 2 W combines the best of the Pi Zero 2 with Wi-Fi and Bluetooth capabilities. It provides the same improved performance as the Pi Zero 2 but with the added benefit of wireless connectivity, making it the most versatile model in the Zero series.
With its 1GHz quad-core ARM Cortex-A53 processor, the Pi Zero 2 W is capable of handling much more demanding tasks than the original Pi Zero or Pi Zero W. Its performance makes it a suitable choice for more advanced applications such as robotics, wireless sensors, and small-scale server projects.
The Pi Zero 2 W features Wi-Fi 802.11n and Bluetooth 4.2, which are perfect for IoT and wireless communication. These built-in wireless capabilities make the Pi Zero 2 W an excellent choice for remote control systems, smart devices, and wearable technology.
Like the other models in the Zero series, the Pi Zero 2 W includes USB OTG, enabling it to be used as a USB device when connected to another computer. This opens up possibilities for creating USB gadgets, network devices, and custom peripherals.
| Model | CPU | RAM | Wi-Fi | Bluetooth | USB OTG |
|---|---|---|---|---|---|
| Raspberry Pi Zero | 1GHz Single-Core ARM11 | 512MB | None | None | Yes |
| Raspberry Pi Zero W | 1GHz Single-Core ARM11 | 512MB | Wi-Fi 802.11n | Bluetooth 4.1 | Yes |
| Raspberry Pi Zero 2 | 1GHz Quad-Core Cortex-A53 | 512MB | None | None | Yes |
| Raspberry Pi Zero 2 W | 1GHz Quad-Core Cortex-A53 | 512MB | Wi-Fi 802.11n | Bluetooth 4.2 | Yes |
I2C (Inter-Integrated Circuit) is a popular communication protocol for connecting low-speed devices like sensors, displays, and EEPROMs. The Raspberry Pi provides native support for I2C communication, which can be easily enabled and used for a variety of projects.
To use I2C on the Raspberry Pi, you'll first need to enable it in the Raspberry Pi's configuration settings. Follow these steps:
sudo raspi-config.
Once I2C is enabled, you can use the i2c-tools package to interact with I2C devices. To install it, run:
sudo apt-get install i2c-tools
Raspberry Pi has two I2C bus interfaces available. The default I2C bus is typically on the GPIO pins 3 (SDA) and 5 (SCL). Connect any I2C-enabled device to these pins, ensuring correct voltage levels and pull-up resistors.
After connecting an I2C device, detect it with:
sudo i2cdetect -y 1
This will show a map of I2C devices connected to your Raspberry Pi.
To communicate with I2C devices, you can use Python libraries such as smbus. Here's an example of how to use I2C with Python to read data from an I2C sensor:
import smbus
bus = smbus.SMBus(1) # Initialize I2C bus 1
address = 0x48 # I2C address of the device
# Reading a byte from a register (example)
data = bus.read_byte_data(address, 0x00)
print(data)
I²S is a synchronous digital audio interface used to connect external DACs, ADCs, and audio codecs. On Raspberry Pi, I²S is provided by the SoC PCM peripheral and is routed to the GPIO header for external use.
The following GPIO pins are used for I²S on Raspberry Pi:
Ground can be taken from any GND pin (e.g. Pin 6).
Edit /boot/config.txt and add the following lines:
# Disable onboard analog audio
dtparam=audio=off
# Enable I2S / PCM interface
dtparam=i2s=on
# Optional: load an I2S DAC overlay
# dtoverlay=hifiberry-dac
Reboot after saving. The I²S device will then be available via ALSA.
SPI (Serial Peripheral Interface) is a high-speed communication protocol used for connecting peripherals like sensors, displays, and memory chips. Raspberry Pi supports SPI communication for fast data transfer.
To enable SPI, activate it through the Raspberry Pi configuration settings:
sudo raspi-config.Check if SPI is enabled by running:
lsmod | grep spi
SPI communication on the Raspberry Pi uses the following pins:
The spidev library in Python allows communication with SPI devices. Example usage:
import spidev
spi = spidev.SpiDev()
spi.open(0, 0) # Open SPI bus 0, device 0
spi.max_speed_hz = 50000 # Set the clock speed
# Send and receive data
response = spi.xfer2([0x01, 0x02, 0x03])
print(response)
Raspberry Pi supports hardware timers and Pulse Width Modulation (PWM), essential for controlling motors, LEDs, and other components that require precise timing or signal modulation.
The Raspberry Pi has multiple timers for precise time management, accessible via Python libraries like RPi.GPIO or pigpio. They are useful for scheduling tasks or triggering events at regular intervals.
Common uses include:
Pulse Width Modulation (PWM) allows control of power to devices like LEDs and motors. Raspberry Pi supports PWM on several GPIO pins.
RPi.GPIO to configure a GPIO pin for PWM.
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 1000) # Pin 18, frequency 1 kHz
pwm.start(50) # 50% duty cycle
# Change duty cycle after 5 seconds
pwm.ChangeDutyCycle(75)
Serial communication allows the Raspberry Pi to communicate with other devices like sensors, modules, and microcontrollers over a serial link. It is commonly used for debugging, interfacing with peripherals, or controlling other systems.
By default, the serial interface on the Raspberry Pi is disabled. To enable it:
sudo raspi-config.
The pyserial library is commonly used for serial communication in Python. Install it using:
sudo apt-get install python3-serial
Example of using serial communication:
import serial
ser = serial.Serial('/dev/ttyAMA0', 9600) # Open serial port at 9600 baud rate
# Write to serial
ser.write(b'Hello, Raspberry Pi!')
# Read from serial
data = ser.readline()
print(data)
The GPIO pins on the Raspberry Pi provide a versatile interface for connecting sensors, actuators, and other external components. With up to 40 GPIO pins available on various models, you can interact with the physical world, controlling LEDs, motors, buttons, and more.
The GPIO pins are connected to the Broadcom SoC and can be configured in software for digital input, digital output, PWM, and communication protocols such as I2C and SPI.
RPi.GPIO Python library to configure GPIO pins for input or output.gpiozero Python library for higher-level control with simplified syntax.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
while True:
GPIO.output(17, GPIO.HIGH)
time.sleep(1)
GPIO.output(17, GPIO.LOW)
time.sleep(1)
Interrupts are a powerful feature of Raspberry Pi's GPIO (General Purpose Input/Output) pins, allowing the Pi to react to events such as changes in input signals. Interrupts enable efficient event handling, letting the Pi act only when needed instead of polling continuously.
A GPIO interrupt occurs when a GPIO pin changes state. When the trigger condition is met, the Raspberry Pi executes an ISR (interrupt service routine), allowing immediate reaction without wasting CPU time polling.
Interrupts require configuring a GPIO pin as input, selecting the interrupt edge type, and defining an ISR to handle the event.
WiringPi or RPi.GPIO.
Example using RPi.GPIO to configure an interrupt on GPIO 17:
import RPi.GPIO as GPIO
import time
# Set the GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the pin to listen for interrupts
pin = 17
# Setup the pin as an input with a pull-up resistor
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Define the callback function that will be triggered by the interrupt
def gpio_callback(channel):
print("Interrupt detected on GPIO pin", channel)
# Add an interrupt to GPIO pin 17, looking for a rising edge
GPIO.add_event_detect(pin, GPIO.RISING, callback=gpio_callback)
# Keep the program running to listen for interrupts
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Program terminated")
finally:
GPIO.cleanup()
Mechanical switches can generate multiple false triggers. Debouncing prevents this by enforcing a delay between valid events.
import RPi.GPIO as GPIO
import time
# Set the GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the pin for the button
button_pin = 17
# Setup the button pin as an input with a pull-up resistor
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Define a debounce delay (in seconds)
debounce_delay = 0.2
# Define the callback function with debounce
def gpio_callback(channel):
print("Button pressed!")
time.sleep(debounce_delay)
# Add an event detection on the button pin with a falling edge (button press)
GPIO.add_event_detect(button_pin, GPIO.FALLING, callback=gpio_callback, bouncetime=int(debounce_delay * 1000))
# Keep the program running to listen for interrupts
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Program terminated")
finally:
GPIO.cleanup()
Multiple pins can be configured to trigger interrupts independently.
import RPi.GPIO as GPIO
import time
# Set the GPIO mode
GPIO.setmode(GPIO.BCM)
# Define pins for input
pin1 = 17
pin2 = 18
# Setup the pins as inputs with pull-up resistors
GPIO.setup(pin1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Define the callback function for pin interrupts
def gpio_callback(channel):
print(f"Interrupt detected on GPIO pin {channel}")
# Add events for multiple pins
GPIO.add_event_detect(pin1, GPIO.RISING, callback=gpio_callback)
GPIO.add_event_detect(pin2, GPIO.RISING, callback=gpio_callback)
# Keep the program running to listen for interrupts
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Program terminated")
finally:
GPIO.cleanup()
GPIO interrupts allow Raspberry Pi to respond instantly to external events, making them essential for buttons, sensors, and real-time signalling applications.
Wi-Fi functionality on Raspberry Pi boards enables wireless network connectivity, ideal for IoT, web servers, remote control systems, and other projects requiring internet or local network access. Many Raspberry Pi models come with built-in Wi-Fi, while others can use a USB adapter.
Several Raspberry Pi models include integrated Wi-Fi, simplifying wireless networking without additional hardware. These models include:
These models feature Wi-Fi 802.11n (Wi-Fi 4) for reliable connectivity. The Raspberry Pi 4 supports dual-band 2.4GHz and 5GHz Wi-Fi for faster speeds and better performance in congested networks.
Wi-Fi on Raspberry Pi boards is easy to configure and supported by the wpa_supplicant tool, which handles wireless connections on Linux-based systems.
raspi-config (headless).wpa_supplicant.conf file with network details.For Raspberry Pi models without built-in Wi-Fi (e.g., Pi 2 or earlier), you can add Wi-Fi functionality with a compatible USB Wi-Fi adapter. These adapters are supported by Raspberry Pi OS and widely available.
Bluetooth functionality on Raspberry Pi boards enables wireless communication for IoT projects, remote control, and peripheral connectivity. Many Raspberry Pi models have Bluetooth built-in, while others can use USB Bluetooth adapters.
These Raspberry Pi models include integrated Bluetooth hardware:
Most models provide Bluetooth 4.2 support, including BLE, suitable for wireless peripherals, audio devices, and sensors.
Bluetooth support is provided by the BlueZ stack, enabling interaction with Bluetooth devices through tools such as bluetoothctl.
bluetoothctl to pair and manage devices.bluez and pi-bluetooth for extended features.The Raspberry Pi Zero W and Zero 2 W include integrated Bluetooth 4.2 support, making them ideal for compact IoT and low-power wireless communication projects.
Older Raspberry Pi boards without built-in Bluetooth (such as the Raspberry Pi 2) can use USB Bluetooth adapters. These work with the BlueZ stack and provide the same functionality as integrated Bluetooth.
The Raspberry Pi models support various camera modules through the CSI (Camera Serial Interface) port. Below is a description of the camera compatibility for each model.
The Raspberry Pi Zero supports the official Raspberry Pi camera modules through its CSI interface. The camera can be connected using a small ribbon cable. The Zero uses a mini version of the standard CSI connector found on other models.
The original Raspberry Pi Model B (rev 1 and rev 2) supports the CSI interface for connecting a camera. It was the first model to introduce camera support.
The Raspberry Pi 2 Model B also supports the CSI interface, similar to the original Model B, but with improved processing power.
The Raspberry Pi 3 Model B and B+ continue to support the CSI interface, and the improved performance allows higher frame rates and more advanced camera uses.
The Raspberry Pi 4 Model B supports the CSI interface and is ideal for high-performance camera projects.
The Raspberry Pi 5 is expected to continue supporting the CSI camera interface with possible improvements.
All models support the raspistill and raspivid tools for image and video capture.
raspistill -o image.jpg
raspivid -o video.h264 -t 10000
sudo raspi-config
Raspberry Pi models support video output through various interfaces, including composite video and the CSI camera interface. HDMI is most common, but alternative outputs exist for legacy or specialized setups.
The Raspberry Pi Zero does not have a native composite video jack. Video output is via HDMI or GPIO pins with an external adapter.
The original Raspberry Pi Model B (rev 1 and 2) includes a 3.5mm jack for analog audio and RCA socket for composite video.
The Raspberry Pi 2 Model B retains the 3.5mm jack for composite video and analog audio, like the original Model B.
The Raspberry Pi 3 Model B and B+ maintain the 3.5mm jack for composite video/audio alongside HDMI support.
The Raspberry Pi 4 Model B has a 3.5mm jack for composite video/audio, alongside HDMI for 4K digital output.
The Raspberry Pi 5 is expected to continue offering the 3.5mm jack for composite video/audio alongside HDMI digital output.
Raspberry Pi models with audio output support 3.5mm audio jacks or HDMI audio through adapters. The audio connectors vary depending on the model, with some models featuring a dedicated audio jack, while others rely on HDMI or other digital interfaces.
The Raspberry Pi Zero does not have a dedicated 3.5mm audio jack. Audio is available through the HDMI interface or via a GPIO pin using a DAC HAT or external module.
The Raspberry Pi Model B (rev 1 and rev 2) features a 3.5mm audio jack for analog audio output. It supports both audio and composite video output through this jack.
The Raspberry Pi 2 Model B features a 3.5mm audio jack for analog output along with composite video. HDMI provides digital audio output as well.
The Raspberry Pi 3 Model B and B+ continue to offer the 3.5mm audio jack for analog audio, alongside HDMI digital audio output. Improved processing power allows better handling of digital audio.
The Raspberry Pi 4 Model B includes a 3.5mm audio jack for analog output and digital audio via HDMI. Audio quality is improved, supporting better digital audio output.
The Raspberry Pi 5 is expected to provide a 3.5mm audio jack for analog output and digital audio via HDMI, with potential improvements in quality and formats.
The Raspberry Pi features multiple USB ports for connecting peripherals such as keyboards, mice, storage devices, and network adapters. The USB interface provides both data transfer and power to connected devices.
Different Raspberry Pi models support various USB versions. Most have USB 2.0 ports, while newer models like Raspberry Pi 4 and Raspberry Pi 400 offer USB 3.0 for faster data transfer.
Some Raspberry Pi models can power external devices through USB ports, such as keyboards, mice, or small external drives. High-power devices may require an external power source.
On micro-USB models (Pi Zero, Pi 3), the USB port supports OTG, allowing the Pi to act as a host or a device. Useful for creating USB gadgets or connecting the Pi to a smartphone or PC.
Plug the USB device into a Raspberry Pi port. Common devices work out of the box; specialized peripherals may require drivers or tools.
Plug the USB WiFi adapter into a port and install required drivers (usually included in Raspberry Pi OS):
sudo apt-get update
sudo apt-get install firmware-ralink
If a USB device is not working:
dmesg to check system logs for USB errors.lsusb: Lists all connected USB devices.dmesg | grep usb: Displays detailed USB logs.USB On-The-Go (OTG) and Gadget Mode allow Raspberry Pi boards to act as USB devices, enabling them to function as network adapters, mass storage devices, serial devices, and even multiple devices at once. This is particularly useful for Raspberry Pi models that have USB OTG support, such as the Pi Zero and Pi Zero 2, but it also works on other Pi models under specific configurations.
By enabling USB OTG and Gadget Mode, you can turn your Raspberry Pi into a USB device such as:
Enable multiple USB gadgets simultaneously to serve as network adapter, mass storage, serial, and optionally audio devices.
/boot/boot/config.txtdtoverlay=dwc2,dr_mode=peripheral/boot/cmdline.txtmodules-load=dwc2,g_ether,g_mass_storage,g_serialmodules-load=dwc2,g_audiog_etherg_mass_storageg_mass_storage.file=/path/to/your/disk.imgg_serialg_audioMultiple USB gadgets require sufficient processing power. Zero models are ideal; Pi 4 and 400 provide more capability for complex setups. Host drivers/software may be needed for full functionality.
Turn your Raspberry Pi into a USB gadget that provides:
Step 1: Enable USB OTG Mode by editing
/boot/config.txtdtoverlay=dwc2Edit
/boot/cmdline.txtmodules-load=dwc2rootwaitsudo rebootStep 2: Create the USB Gadget script:
sudo nano /root/usb-gadget.shAdd the provided bash script to configure network, serial, mass storage, and optional audio.
Step 3: Install and configure DHCP server:
sudo apt install isc-dhcp-serverEdit DHCP config
/etc/dhcp/dhcpd.confusb0sudo systemctl restart isc-dhcp-serverStep 4: Enable Internet sharing with iptables:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADEsudo iptables -A FORWARD -i usb0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPTsudo iptables -A FORWARD -i wlan0 -o usb0 -j ACCEPTsudo apt install iptables-persistentStep 5: Run the USB Gadget on boot by editing
/etc/rc.local/root/usb-gadget.shexit 0Step 6: Reboot and test:
sudo rebootHost computer should get IP automatically and access the internet via Pi.
Raspberry Pi supports a wide range of operating systems, including Linux distributions, Android, Ultibo, and various real-time operating systems (RTOS). This guide covers installation on SD cards for Raspberry Pi with instructions for Windows and Linux hosts.
sudo apt install rpi-imagerrpi-imagerAndroid allows Raspberry Pi to run Android apps. Installation uses a prebuilt image file and works on both Windows and Linux hosts.
Ultibo is a bare-metal OS for Raspberry Pi, allowing programs to be written in Pascal with direct hardware access. It provides real-time performance and is ideal for embedded systems.
Several real-time operating systems (RTOS) are available for Raspberry Pi, providing precise timing, fast response, and low-latency performance for embedded or IoT applications.