Raspberry Pi – Complete Guide

Everything you need to know — from basics to advanced projects

Raspberry Pi is a small, affordable single-board computer developed by the Raspberry Pi Foundation. Learn about all models, GPIO, ports, projects, and more.

What is Raspberry Pi?

Raspberry Pi is a small, affordable single-board computer developed by the Raspberry Pi Foundation. Despite its tiny size, it functions as a fully capable computer that can run Linux-based operating systems.

What is it used for?

Programming
Electronics Projects
Robotics
IoT
Servers
AI & Edge Computing
Cybersecurity Labs

Raspberry Pi Versions (All Major Models)

Raspberry Pi 5
Latest & Most Powerful
  • Quad-core ARM Cortex-A76 (2.4 GHz)
  • RAM: 4GB / 8GB
  • Dual 4K HDMI
  • PCIe support
  • USB 3.0 ports
  • Best for AI, servers, heavy tasks
Raspberry Pi 4 Model B
Most Popular
  • Quad-core Cortex-A72
  • RAM: 2GB / 4GB / 8GB
  • Dual HDMI
  • USB 3.0
  • Gigabit Ethernet
  • Most popular for students
Raspberry Pi 3 Model B+
Reliable
  • 1GB RAM
  • WiFi + Bluetooth
  • Good for IoT projects
Raspberry Pi Zero 2 W
Ultra Compact
  • Very small size
  • Built-in WiFi
  • Used in embedded systems

How to Install Raspberry Pi OS

Step 1: Download Raspberry Pi Imager

Download from the official website of Raspberry Pi Foundation. Install on:

Step 2: Insert MicroSD Card

Minimum requirements:

SpecRequirement
Capacity16GB minimum (32GB recommended)
ClassClass 10

Step 3: Use Raspberry Pi Imager

Open Imager application
Choose OS → Raspberry Pi OS (64-bit recommended)
Choose Storage → Select SD card
Click Write
Optional settings in Imager: Enable SSH, Set WiFi credentials, Set username/password — these save time on first boot!

Step 4: Insert SD into Pi and Power On

Connect the following:

ConnectionDetails
HDMIConnect to monitor
KeyboardUSB keyboard
MouseUSB mouse
Power Supply5V USB-C
System boots automatically. You'll see the Raspberry Pi desktop on first successful boot.

Raspberry Pi GPIO Pinout Diagram (40 Pins)

GPIO = General Purpose Input Output. The Raspberry Pi has 40 physical pins that allow you to interface with sensors, LEDs, motors, and more.

Types of Pins

5V
Power output
3.3V
Power output
GND
Ground
GPIO
Input/Output pins
I2C
Sensor communication
SPI
High-speed communication
UART
Serial communication
PWM
Motor control

Important: BCM vs BOARD Numbering

ModeDescriptionExample
BCMInternal GPIO number (Broadcom SoC)GPIO17 = BCM pin 17
BOARDPhysical pin number on the headerPhysical pin 11 = GPIO17
Python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)  # Use BCM numbering
BCM mode is recommended for most projects as it's consistent across Pi models and widely used in library documentation.

How to Use GPIO – LED Blink Example

Components Required

ComponentQuantity
LED1
220Ω Resistor1
Breadboard1
Jumper Wires2

Connection

Raspberry Pi LED Circuit ┌──────────────────┐ │ │ │ GPIO17 ─────────┼───── 220Ω Resistor ───── LED (+) ───── LED (-) ──┐ │ │ │ │ GND ────────────┼────────────────────────────────────────────────────┘ │ │ └──────────────────┘ Connection: GPIO17 → Resistor → LED (Anode) → LED (Cathode) → GND

Python Code

Python — led_blink.py
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)

while True:
    GPIO.output(17, GPIO.HIGH)   # LED ON
    time.sleep(1)                # Wait 1 second
    GPIO.output(17, GPIO.LOW)    # LED OFF
    time.sleep(1)                # Wait 1 second

Code Explanation

Line / BlockWhat It Does
import RPi.GPIO as GPIOImport GPIO library
GPIO.setmode(GPIO.BCM)Use BCM pin numbering
GPIO.setup(17, GPIO.OUT)Set GPIO17 as output
GPIO.output(17, GPIO.HIGH)Turn LED ON (3.3V)
GPIO.output(17, GPIO.LOW)Turn LED OFF (0V)
time.sleep(1)Wait 1 second

Ports Explained (What Each Port Does)

Power Port

USB-C (Pi 4 & 5)

Needs 5V 3A power supply

HDMI Port

Connect to monitor

Supports dual display (Pi 4 & 5)

USB Ports

USB 2.0 → Keyboard / Mouse

USB 3.0 → Fast storage

Ethernet Port

Wired internet connection

Gigabit in Pi 4 & 5

WiFi + Bluetooth

Built-in wireless module

No external adapter needed

CSI Camera Port

Raspberry Pi Camera Module

Used for AI Vision Projects

DSI Display Port

Official Raspberry Pi Touch Display

7-inch touchscreen support

Operating Systems for Raspberry Pi

Besides Raspberry Pi OS (default), you can install many other operating systems:

Raspberry Pi OS
Default OS, Debian-based
Ubuntu Server
Server workloads
Kali Linux
Cybersecurity & Pentesting
RetroPie
Retro Gaming
Home Assistant OS
Smart Home Automation
Windows IoT Core
Microsoft IoT platform

Headless Setup (Without Monitor)

You can use Raspberry Pi without a monitor, keyboard, or mouse using SSH over WiFi.

Flash OS to SD card using Raspberry Pi Imager
Enable SSH in Imager settings (Advanced options)
Configure WiFi in Imager settings
Insert SD into Pi and power on
Connect via SSH from your computer:
Terminal
ssh pi@raspberrypi.local
Tip: Both your computer and Raspberry Pi must be connected to the same WiFi network for SSH to work.

Common Projects You Can Build

Smart Home System
CCTV Camera
Web Server
AI Object Detection
IoT Sensor Dashboard
Robot
Cluster Computing

Raspberry Pi vs Arduino

Feature Raspberry Pi Arduino
Type Mini Computer Microcontroller
OS Runs full OS (Linux) No OS
Multi-tasking Yes — multi-tasking Single task at a time
Languages Python / Linux / Any C / C++
GPIO 40 pins, 3.3V logic 14-54 pins, 5V logic
Connectivity WiFi, Bluetooth, Ethernet built-in Requires external modules
Price $35 – $80 $3 – $25
Best For Complex projects, AI, servers Simple sensor projects, motor control
Key takeaway: Use Raspberry Pi when you need an OS, networking, or complex processing. Use Arduino for simple, real-time hardware control.

Important Safety Rules

Warning: GPIO damage is irreversible. Always verify connections before powering on. When in doubt, use a multimeter to check voltages.

Advanced Usage

Since you're into Medical Electronics, IoT, and AI, here's what you can build with Raspberry Pi:

Real-time Health Monitoring
ECG, SpO2, Heart Rate sensors connected to Pi for live monitoring
Thermal Camera Integration
MLX90640 thermal sensor for contactless temperature scanning
Edge AI with TensorFlow Lite
Run ML models locally on Pi for object detection & classification
Radar Signal Processing
Interface with radar modules for distance & motion analysis
Portable Medical Diagnostic
Build a portable device with multiple sensors & a touchscreen
Pro tip: Combine Raspberry Pi with an ESP32 for distributed IoT — Pi as the gateway/hub and ESP32 as remote sensor nodes.