Raspberry Pi

The complete guide to Raspberry Pi single-board computers - From beginner projects to advanced applications

Raspberry Pi 4

What is Raspberry Pi?

Raspberry Pi is a series of small single-board computers developed in the UK to promote teaching of basic computer science in schools and developing countries.

  • Full Computer: Runs Linux-based operating systems
  • GPIO Pins: 40-pin header for electronics projects
  • Multimedia Capable: 4K video playback (Pi 4)
  • Connectivity: WiFi, Bluetooth, Ethernet, USB
  • Affordable: Starting at $5 (Pi Zero)
  • Educational: Perfect for learning computing and electronics
  • Versatile: Can function as desktop PC, server, or embedded device
  • Large Community: Massive support and documentation
  • Regular Updates: Continuous hardware and software improvements
  • HAT Compatible: Hardware add-ons for expanded functionality
  • Home Automation: Smart home hubs
  • Media Centers: Kodi, Plex servers
  • Retro Gaming: Emulation stations
  • IoT Projects: Sensor networks
  • Network Services: VPN, NAS, web servers

Raspberry Pi Models

Raspberry Pi has evolved through several generations with increasing capabilities:

Model Release Year Processor RAM Key Features Price
Pi Zero W 2017 1GHz single-core 512MB Miniature size, WiFi/BT $10
Pi 3 Model B 2016 1.2GHz quad-core 1GB First with WiFi/BT $35
Pi 3 Model B+ 2018 1.4GHz quad-core 1GB Faster Ethernet, WiFi $35
Pi 4 Model B 2019 1.5GHz quad-core 2GB/4GB/8GB USB 3.0, dual 4K output $35-$75
Compute Module 4 2020 1.5GHz quad-core 1GB-8GB Industrial form factor $25-$90
Pi 400 2020 1.8GHz quad-core 4GB Keyboard integrated $70

Popular Raspberry Pi Boards

Raspberry Pi 4

Raspberry Pi 4

The most powerful general-purpose Pi with desktop performance

Broadcom BCM2711 1.5GHz 2GB-8GB RAM 4K Output WiFi BT 5.0 Gigabit
Learn More
Pi Zero 2 W

Pi Zero 2 W

Ultra-compact board with quad-core performance

Broadcom BCM2710A1 1GHz 512MB RAM Mini HDMI 65mm x 30mm WiFi
Learn More
Raspberry Pi Pico

Raspberry Pi Pico

Microcontroller board with RP2040 chip

RP2040 133MHz 264KB RAM 26 GPIO Dual Core $4
Learn More
Compute Module 4

Compute Module 4

Industrial form factor for embedded applications

Broadcom BCM2711 1.5GHz 1GB-8GB PCIe Industrial eMMC
Learn More

Raspberry Pi 4 Architecture

The Raspberry Pi 4 represents a significant performance leap over previous models.

Block Diagram

Pi 4 Block Diagram

Key Specifications

Component Specification
SoC Broadcom BCM2711 (Cortex-A72)
CPU 4-core 1.5GHz (64-bit)
GPU VideoCore VI (500MHz)
Memory LPDDR4 (2GB/4GB/8GB)
Connectivity 2.4/5GHz WiFi, BT 5.0, Gigabit Ethernet
Video Output 2 × micro-HDMI (4K @ 60fps)
USB 2 × USB 3.0, 2 × USB 2.0

GPIO Pinout

Pi GPIO Pinout

Getting Started with Raspberry Pi OS

# Basic Python script to blink an LED
import RPi.GPIO as GPIO
import time

LED_PIN = 18
GPIO.setmode(GPIO.BCM)
GPIO.setup(LED_PIN, GPIO.OUT)

try:
    while True:
        GPIO.output(LED_PIN, GPIO.HIGH)
        time.sleep(1)
        GPIO.output(LED_PIN, GPIO.LOW)
        time.sleep(1)
except KeyboardInterrupt:
    GPIO.cleanup()

Raspberry Pi Operating Systems

Raspberry Pi OS

Raspberry Pi OS

Official Debian-based OS optimized for Pi

32/64-bit Desktop Recommended
Download
Ubuntu

Ubuntu

Full desktop Linux experience

ARM64 Server/Desktop LTS Available
Download
RetroPie

RetroPie

Turn your Pi into a retro gaming console

Emulation Gamepad Support Thousands of Games
Download
LibreELEC

LibreELEC

Lightweight Kodi media center

Minimal OS 4K HDR Media Focused
Download

Advanced Raspberry Pi Projects

Home Automation Server

Using Home Assistant to control smart devices:

# Install Home Assistant
sudo apt update
sudo apt install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev

# Create virtual environment
python3 -m venv homeassistant
cd homeassistant
source bin/activate

# Install Home Assistant Core
python3 -m pip install wheel
pip install homeassistant

# Start Home Assistant
hass

Pi Cluster with Docker Swarm

Creating a mini supercomputer with multiple Pis:

# On manager node
docker swarm init --advertise-addr <MANAGER_IP>

# On worker nodes
docker swarm join --token <TOKEN> <MANAGER_IP>:2377

# Deploy a service
docker service create --name nginx --replicas 3 -p 80:80 nginx

AI Object Detection

Using OpenCV and TensorFlow Lite:

# Install dependencies
sudo apt install libatlas-base-dev libopenjp2-7 libtiff5
pip3 install opencv-python numpy tflite-runtime

# Sample object detection code
import cv2
import tflite_runtime.interpreter as tflite

# Load TFLite model
interpreter = tflite.Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()

# Process camera input
cap = cv2.VideoCapture(0)
while True:
    ret, frame = cap.read()
    # Preprocess and run inference
    input_data = preprocess(frame)
    interpreter.set_tensor(input_index, input_data)
    interpreter.invoke()
    output_data = interpreter.get_tensor(output_index)
    # Draw detections
    draw_boxes(frame, output_data)
    cv2.imshow('Object Detection', frame)