← Back to Blog
Electronics2025-12-0825 min read

Arduino & Raspberry Pi Pinout Guide: Complete GPIO Reference for Beginners (2025)

#Arduino#Raspberry Pi#GPIO#Pinout#Electronics#Embedded Systems#Microcontrollers
Loading...

Arduino & Raspberry Pi Pinout Guide: Complete GPIO Reference for Beginners

Ever stared at those rows of pins on your Arduino or Raspberry Pi and thought, "What do all these actually do?" You're not alone. When I first picked up an Arduino Uno, I spent an embarrassing amount of time wondering why my LED wouldn't blink — turns out I had it plugged into an analog input pin instead of a digital output. Rookie mistake, but that's exactly why I'm writing this guide.

Whether you're building your first blinking LED circuit or planning a home automation system, understanding pinouts is the foundation of everything. This guide covers the Arduino Nano, Arduino Uno, and the entire Raspberry Pi family (Zero through Pi 5) — all in one place, with diagrams you can actually reference while you're elbow-deep in wires.

Let's dive in.


Table of Contents

  1. Before We Start: What Even Is a "Pin"?
  2. Arduino Uno R3 Pinout
  3. Arduino Nano Pinout
  4. Raspberry Pi GPIO Pinout (Universal 40-Pin)
  5. Arduino vs. Raspberry Pi: Which Should You Use?
  6. Pin Types Explained for Beginners
  7. Common Mistakes to Avoid
  8. Starter Project Ideas
  9. Recommended Boards and Kits

Before We Start: What Even Is a "Pin"?

If you're completely new to electronics, let's get the basics out of the way.

Those little metal legs sticking out of your microcontroller board? Those are pins. They're how your board talks to the outside world — sensors, LEDs, motors, displays, you name it. Some pins provide power, some read inputs, some send outputs, and some do fancy communication stuff.

The tricky part is that not all pins are created equal. Some can read analog voltages (like from a light sensor), others can only do digital on/off signals, and some have special superpowers like generating PWM signals for motor control.

That's where pinout diagrams come in. They're basically treasure maps that tell you what each pin can do.


Arduino Uno R3 Pinout

The Arduino Uno is the gateway drug of microcontrollers. It's big enough to see what you're doing, forgiving enough to survive beginner mistakes, and powerful enough for surprisingly complex projects.

The Diagram

Loading...
Arduino Uno R3 complete pinout diagram. Source: pighixxx, CC BY-SA 4.0

Loading...
Official Arduino Uno R3 pinout with all pin functions. Source: Arduino, CC BY-SA 4.0

Quick Specs

SpecificationValue
MicrocontrollerATmega328P (8-bit AVR)
Clock Speed16 MHz
Operating Voltage5V
Flash Memory32 KB (0.5 KB used by bootloader)
SRAM2 KB
EEPROM1 KB
Digital I/O Pins14 (6 with PWM)
Analog Input Pins6
DC Current per I/O Pin20 mA (40 mA absolute max)
Board Dimensions68.6 × 53.4 mm

Pin-by-Pin Breakdown

Power Pins

PinFunctionNotes
VINExternal power input7-12V recommended (6-20V limits)
5VRegulated 5V outputPowers external components (500mA max from USB)
3.3VRegulated 3.3V output50mA maximum — be careful!
GNDGround5 ground pins available
IOREFI/O reference voltageTells shields what voltage the board uses
RESETReset pinPull LOW to reset the board

Digital Pins (D0-D13)

All 14 digital pins can function as inputs or outputs using pinMode(), digitalWrite(), and digitalRead().

PinSpecial Functions
D0 (RX)Serial receive — used for USB communication
D1 (TX)Serial transmit — used for USB communication
D2External interrupt 0 (INT0)
D3~PWM, External interrupt 1 (INT1)
D4General purpose
D5~PWM
D6~PWM
D7General purpose
D8General purpose
D9~PWM
D10~PWM, SPI SS (Slave Select)
D11~PWM, SPI MOSI
D12SPI MISO
D13SPI SCK, Built-in LED

The ~ symbol indicates PWM capability.

Pro tip: Avoid using D0 and D1 for general I/O if you're also using Serial communication (including uploading code). You'll get weird conflicts.

Analog Pins (A0-A5)

These pins have a 10-bit ADC (Analog-to-Digital Converter), meaning they read voltages between 0-5V as values from 0-1023.

PinSpecial Functions
A0Analog input only
A1Analog input only
A2Analog input only
A3Analog input only
A4Analog input, I2C SDA
A5Analog input, I2C SCL

Good to know: You can use analog pins as digital pins too! Just reference them as A0, A1, etc., or as digital pins 14-19.

Communication Interfaces

ProtocolPinsWhat It's For
UART/SerialD0 (RX), D1 (TX)Talking to your computer, GPS modules, Bluetooth
I2CA4 (SDA), A5 (SCL)Sensors, OLED displays, real-time clocks
SPID10-D13 (SS, MOSI, MISO, SCK)SD cards, high-speed displays, some sensors

Arduino Nano Pinout

The Arduino Nano is essentially an Uno that hit the gym and got compact. Same ATmega328P brain, same capabilities, but small enough to fit on a breadboard. It's perfect for when your project needs to be small.

The Diagram

Loading...
Official Arduino Nano pinout diagram with all pin functions. Source: Arduino, CC BY-SA 4.0

Quick Specs

SpecificationValue
MicrocontrollerATmega328P (8-bit AVR)
Clock Speed16 MHz
Operating Voltage5V
Flash Memory32 KB
SRAM2 KB
EEPROM1 KB
Digital I/O Pins14 (6 with PWM)
Analog Input Pins8 (2 more than Uno!)
Board Dimensions45 × 18 mm
Weight7 grams

Nano vs. Uno: What's Different?

FeatureArduino UnoArduino Nano
Size68.6 × 53.4 mm45 × 18 mm (73% smaller!)
Weight25g7g
Analog Inputs6 (A0-A5)8 (A0-A7)
USB ConnectorType-BMini-B
Power JackYes (barrel)No
Breadboard-friendlyNoYes!
MCU TypeDIP (replaceable)SMD (soldered)

Pin Layout

The Nano has 30 pins arranged in two rows of 15, making it perfect for straddling a breadboard.

Left Side (Pin 1-15)

PinLabelFunction
1D13Digital, SPI SCK, Built-in LED
23V33.3V output (50mA max)
3AREFAnalog reference voltage
4A0Analog input
5A1Analog input
6A2Analog input
7A3Analog input
8A4Analog input, I2C SDA
9A5Analog input, I2C SCL
10A6Analog input ONLY
11A7Analog input ONLY
125V5V output
13RSTReset
14GNDGround
15VINExternal power (7-12V)

Right Side (Pin 16-30)

PinLabelFunction
16D1/TXDigital, Serial transmit
17D0/RXDigital, Serial receive
18RSTReset
19GNDGround
20D2Digital, Interrupt 0
21D3~Digital, PWM, Interrupt 1
22D4Digital
23D5~Digital, PWM
24D6~Digital, PWM
25D7Digital
26D8Digital
27D9~Digital, PWM
28D10~Digital, PWM, SPI SS
29D11~Digital, PWM, SPI MOSI
30D12Digital, SPI MISO

Important note about A6 and A7: Unlike other analog pins, these two are analog input only — they cannot be used as digital outputs. Don't waste time trying to blink an LED with them!


Raspberry Pi GPIO Pinout (Universal 40-Pin)

Here's something beautiful about Raspberry Pi: every Pi with a 40-pin header uses the exact same GPIO layout. Whether you're using a $15 Pi Zero 2 W or a $80 Pi 5, the pinout is identical. Buy a HAT (Hardware Attached on Top) once, and it works on all your Pis.

This has been true since the Raspberry Pi Model B+ in July 2014.

The Diagram

Loading...
Universal Raspberry Pi 40-pin GPIO pinout. Works for Pi Zero, Zero 2 W, 3B, 3B+, 4B, and Pi 5. Source: FreeSVG, Public Domain

Loading...
Raspberry Pi GPIO shown with board orientation. Source: FreeSVG, Public Domain

Quick Reference Table

Physical PinGPIO (BCM)FunctionPhysical PinGPIO (BCM)Function
13.3V Power25V Power
3GPIO2I2C SDA45V Power
5GPIO3I2C SCL6Ground
7GPIO4GPCLK08GPIO14UART TX
9Ground10GPIO15UART RX
11GPIO17General12GPIO18PWM0
13GPIO27General14Ground
15GPIO22General16GPIO23General
173.3V Power18GPIO24General
19GPIO10SPI MOSI20Ground
21GPIO9SPI MISO22GPIO25General
23GPIO11SPI SCLK24GPIO8SPI CE0
25Ground26GPIO7SPI CE1
27GPIO0ID_SD (EEPROM)28GPIO1ID_SC (EEPROM)
29GPIO5General30Ground
31GPIO6General32GPIO12PWM0
33GPIO13PWM134Ground
35GPIO19PWM1/SPI MISO36GPIO16General
37GPIO26General38GPIO20SPI MOSI
39Ground40GPIO21SPI SCLK

Understanding GPIO Numbering

This trips up everyone at first. There are two ways to reference Pi GPIO pins:

  1. Physical/Board numbering: Count the pins 1-40 starting from the corner (pin 1 has a square solder pad underneath). Simple, but not how most code works.

  2. BCM/GPIO numbering: The Broadcom chip's internal GPIO numbers. This is what Python libraries like GPIO Zero use. GPIO17 isn't pin 17 — it's physical pin 11.

My recommendation: Use BCM numbering in your code and keep a pinout diagram handy. It becomes second nature after a few projects.

Power Pins

TypePhysical PinsNotes
5V2, 4Direct from power supply. Can power external devices.
3.3V1, 17Regulated. Limited current (~50mA total recommended).
Ground6, 9, 14, 20, 25, 30, 34, 39Eight ground pins!

Communication Interfaces

InterfaceGPIO PinsPhysical PinsUse Cases
I2CGPIO2 (SDA), GPIO3 (SCL)3, 5Sensors, displays, RTCs
SPI0GPIO10, 9, 11, 8, 719, 21, 23, 24, 26SD cards, fast displays, ADCs
UARTGPIO14 (TX), GPIO15 (RX)8, 10Serial debugging, GPS, Bluetooth
PWMGPIO12, 13, 18, 1932, 33, 12, 35LEDs, servos, motors

Raspberry Pi Models Comparison

ModelProcessorRAMWiFiBest For
Pi Zero1GHz single-core ARM11512MBNoUltra-compact embedded projects
Pi Zero W1GHz single-core ARM11512MB2.4GHzIoT, portable projects
Pi Zero 2 W1GHz quad-core Cortex-A53512MB2.4GHz5× faster than Zero W!
Pi 3B+1.4GHz quad-core Cortex-A531GBDual-bandGeneral projects, learning
Pi 4B1.5GHz quad-core Cortex-A721-8GBDual-bandDesktop replacement, media, AI
Pi 52.4GHz quad-core Cortex-A762-16GBDual-bandHigh performance, PCIe SSD, AI

Arduino vs. Raspberry Pi: Which Should You Use?

This is the million-dollar question for beginners. Here's my honest take:

Choose Arduino When...

✅ Your project does one thing repeatedly (read sensor, control motor, blink LED)
✅ You need precise timing (microsecond accuracy for signals)
Low power consumption matters (battery-powered projects)
✅ You want to read analog sensors directly without extra hardware
✅ You're learning fundamental electronics concepts
✅ Budget is tight (Nano clones cost $3-5)

Arduino excels at: Weather stations, plant watering systems, motor control, LED projects, sensor monitoring, robotics (motor/sensor layer)

Choose Raspberry Pi When...

✅ Your project needs networking (WiFi, web server, remote access)
✅ You want to program in Python or other high-level languages
✅ You need a graphical interface or display output
✅ The project involves computer vision or machine learning
✅ You're doing multitasking (running multiple programs)
✅ You need data logging with storage

Pi excels at: Home servers, media centers, retro gaming, home automation hubs, security cameras, AI/ML projects, web dashboards

The Critical Hardware Differences

FeatureArduino (Uno/Nano)Raspberry Pi
Voltage Logic5V3.3V (NOT 5V tolerant!)
Analog InputsYes (6-8 pins, 10-bit)No — requires external ADC
Operating SystemNone (runs code directly)Linux (Raspberry Pi OS)
Power Draw~45mA700mA - 5A
Boot TimeInstant15-60 seconds
Real-time PrecisionExcellentPoor (OS introduces jitter)
Current per GPIOUp to 40mA~16mA max

⚠️ Critical Warning: 3.3V vs 5V

This is the #1 way beginners fry their Raspberry Pi.

Raspberry Pi GPIO pins operate at 3.3V logic and are NOT 5V tolerant. Connecting a 5V signal directly to a GPIO pin will permanently damage your Pi. No warnings, no second chances — just a dead pin (or dead Pi).

When interfacing with 5V devices:

  • Use a logic level shifter (bidirectional for I2C)
  • Use a voltage divider (resistors, for simple inputs)
  • Choose 3.3V-compatible sensors when possible

Arduino, on the other hand, runs at 5V and can handle both 3.3V and 5V inputs just fine.

When to Use Both Together

Here's a pro tip: you don't have to choose. Many advanced projects use both:

  • Pi handles networking, data processing, and user interface
  • Arduino handles real-time sensor reading and motor control
  • They communicate via Serial (UART), I2C, or USB

This "best of both worlds" approach is common in robotics, home automation, and IoT projects.


Pin Types Explained for Beginners

If terms like GPIO, PWM, and I2C make your head spin, this section is for you.

GPIO (General Purpose Input/Output)

The most basic pin type. Each GPIO pin can be configured as either:

  • Input: Reads whether voltage is present (HIGH/1) or absent (LOW/0). Used for buttons, switches, and digital sensors.
  • Output: Sends voltage (HIGH) or no voltage (LOW) to control things like LEDs and relays.
// Arduino example pinMode(13, OUTPUT); // Set pin 13 as output digitalWrite(13, HIGH); // Turn on the LED

PWM (Pulse Width Modulation)

PWM is how we fake analog output from a digital pin. Instead of outputting a steady voltage, the pin rapidly switches between HIGH and LOW. The ratio of on-time to off-time (duty cycle) creates an "average" voltage.

Real-world uses:

  • LED dimming: 50% duty cycle = LED at half brightness
  • Motor speed control: 75% duty cycle = motor at 75% speed
  • Servo positioning: Specific pulse widths move the servo to specific angles
// Arduino example analogWrite(9, 127); // 50% duty cycle (0-255 range)

ADC (Analog-to-Digital Converter)

Analog pins read varying voltages (not just on/off) and convert them to digital numbers.

Arduino Uno/Nano:

  • 10-bit resolution: 0V = 0, 5V = 1023
  • Step size: 5V ÷ 1023 ≈ 4.88mV per step
int sensorValue = analogRead(A0); // Returns 0-1023

Raspberry Pi: Has no built-in ADC. To read analog sensors, you need an external ADC chip like the MCP3008 or ADS1115. The DFRobot IO Expansion HAT is an elegant solution that adds 8 analog inputs to any Pi.

I2C (Inter-Integrated Circuit)

A two-wire communication protocol for talking to multiple devices:

  • SDA (Data): Carries the actual data
  • SCL (Clock): Synchronizes the communication

Each device has a unique address (7-bit), so up to 127 devices can share the same two wires. Common I2C devices include OLED displays, temperature sensors, and accelerometers.

BoardSDA PinSCL Pin
Arduino Uno/NanoA4A5
Raspberry PiGPIO2 (Pin 3)GPIO3 (Pin 5)

SPI (Serial Peripheral Interface)

Faster than I2C but requires more wires:

  • MOSI: Data from controller to peripheral
  • MISO: Data from peripheral to controller
  • SCLK: Clock signal
  • CS/SS: Chip select (one per device)

SPI is used for SD cards, high-speed displays, and fast sensors.

UART (Universal Asynchronous Receiver-Transmitter)

Simple two-wire serial communication:

  • TX: Transmit (connect to other device's RX)
  • RX: Receive (connect to other device's TX)

Used for debugging (Serial Monitor), GPS modules, and Bluetooth adapters. Remember: TX connects to RX, RX connects to TX — they're crossed!


Common Mistakes to Avoid

Learn from my (and many others') expensive mistakes:

1. Connecting 5V to Raspberry Pi GPIO

The damage: Permanent destruction of GPIO pin or entire Pi
The fix: Always use level shifters or voltage dividers with 5V devices

2. Exceeding Current Limits

Arduino: Max 40mA per pin, 200mA total across all pins
Raspberry Pi: Max ~16mA per pin, ~50mA total GPIO budget
The fix: Use transistors or MOSFETs to switch high-current loads

3. Forgetting Pull-up/Pull-down Resistors

The symptom: Erratic readings from buttons and switches
The fix: Use internal pull-ups (pinMode(pin, INPUT_PULLUP)) or add external resistors

4. Shorting Power to Ground

The damage: Dead board, magic smoke released
The fix: Double-check wiring before powering on. Use a multimeter.

5. Using D0/D1 While Serial is Active (Arduino)

The symptom: Upload failures, garbage data
The fix: Disconnect anything on pins 0 and 1 before uploading

6. Using RPi.GPIO on Raspberry Pi 5

The symptom: RuntimeError: Cannot determine SOC peripheral base address
The fix: Use GPIO Zero or lgpio instead — RPi.GPIO doesn't support Pi 5's RP1 chip


Starter Project Ideas

Arduino Projects

Blink (Your First Program) The "Hello World" of microcontrollers. Wire an LED to pin 13 through a 220Ω resistor and make it blink. If you can do this, you can do anything.

Temperature Logger Connect a DHT11 or DHT22 sensor and display readings on the Serial Monitor. Upgrade to an OLED display when you're ready.

Servo Tester Use a potentiometer to control a servo position. Great for learning analog input and PWM output.

Traffic Light Controller Three LEDs, some timing logic, and you've got a working traffic light simulation.

Raspberry Pi Projects

Headless LED Control SSH into your Pi and control an LED with Python. No monitor needed.

Temperature Web Dashboard Read a sensor, log data to a file, and display it on a simple Flask web page.

Pi-hole Ad Blocker Turn your Pi into a network-wide ad blocker. Genuinely useful from day one.

Security Camera Add a Pi Camera module and set up motion detection with MotionEye.


Recommended Boards and Kits

Ready to get started? Here are some solid options:

For Arduino Beginners

DFRduino Nano (Arduino Compatible)
A breadboard-friendly Nano with USB. Perfect for learning without the premium Arduino price tag.

DFRobot Beginner Kit for Arduino ($34.90)
Everything you need to start: DFRduino UNO R3, 35 components, and 30 tutorials. This is what I wish I had when I started.

Gravity: Starter Kit for Arduino
Plug-and-play sensors with the Gravity interface — no soldering, no breadboard jungle. Great if you want to skip the wiring frustration and focus on code.

27-Sensor Kit for Arduino
Light, temperature, sound, touch, accelerometer... this kit has it all. Perfect once you've outgrown the basics.

For Raspberry Pi Beginners

Raspberry Pi 5 - 4GB ($60)
The latest and greatest. Overkill for blinking LEDs, but future-proof for when you want to do AI or run a desktop.

Raspberry Pi 4 Model B - 4GB ($55)
Still an excellent choice. Tons of tutorials, rock-solid Linux support, and enough power for most projects.

IO Expansion HAT ($10.90)
Adds something Raspberry Pi desperately needs: analog inputs (8 channels, 12-bit). Also breaks out I2C, UART, and digital pins to convenient headers. I genuinely use this on almost every Pi project.

GPIO Terminal Block HAT ($24.90)
All GPIO pins broken out to screw terminals. Great for permanent installations where you don't want jumper wires popping loose.

For Learning Microcontrollers (Raspberry Pi Pico)

Raspberry Pi Pico ($4)
Not a full Linux computer, but a microcontroller like Arduino. Programs in MicroPython or C. Amazing value at $4.

Gravity: Expansion Board for Pico
Adds Gravity connectors to the Pico for easy sensor hookups.


Wrapping Up

You've now got everything you need to decode those mysterious pin headers. Here's what to remember:

  1. Arduino Uno and Nano share the same brains (ATmega328P) — code works on both
  2. All modern Raspberry Pi boards share the same 40-pin GPIO layout — tutorials and HATs are cross-compatible
  3. Arduino is 5V, Raspberry Pi is 3.3V — never mix without level shifters
  4. Pi has no analog inputs — use an ADC or expansion HAT if you need them
  5. Keep a pinout diagram handy while building — I still do after years of projects

Save those diagrams, bookmark this page, and go build something. The best way to learn is by doing — even if you blow up a few LEDs along the way. (We've all been there.)

Happy making! 🔧


Have questions? Found an error? Leave a comment below or reach out — I'm always happy to help fellow makers.


Image Attribution

The pinout diagrams used in this article are available under open licenses:

  • Arduino Uno detailed pinout by pighixxx — CC BY-SA 4.0
  • Official Arduino Uno and Nano pinouts by Arduino — CC BY-SA 4.0
  • Raspberry Pi GPIO diagrams from FreeSVG — Public Domain

Follow Me