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.
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.
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.
| Specification | Value |
|---|---|
| Microcontroller | ATmega328P (8-bit AVR) |
| Clock Speed | 16 MHz |
| Operating Voltage | 5V |
| Flash Memory | 32 KB (0.5 KB used by bootloader) |
| SRAM | 2 KB |
| EEPROM | 1 KB |
| Digital I/O Pins | 14 (6 with PWM) |
| Analog Input Pins | 6 |
| DC Current per I/O Pin | 20 mA (40 mA absolute max) |
| Board Dimensions | 68.6 × 53.4 mm |
| Pin | Function | Notes |
|---|---|---|
| VIN | External power input | 7-12V recommended (6-20V limits) |
| 5V | Regulated 5V output | Powers external components (500mA max from USB) |
| 3.3V | Regulated 3.3V output | 50mA maximum — be careful! |
| GND | Ground | 5 ground pins available |
| IOREF | I/O reference voltage | Tells shields what voltage the board uses |
| RESET | Reset pin | Pull LOW to reset the board |
All 14 digital pins can function as inputs or outputs using pinMode(), digitalWrite(), and digitalRead().
| Pin | Special Functions |
|---|---|
| D0 (RX) | Serial receive — used for USB communication |
| D1 (TX) | Serial transmit — used for USB communication |
| D2 | External interrupt 0 (INT0) |
| D3~ | PWM, External interrupt 1 (INT1) |
| D4 | General purpose |
| D5~ | PWM |
| D6~ | PWM |
| D7 | General purpose |
| D8 | General purpose |
| D9~ | PWM |
| D10~ | PWM, SPI SS (Slave Select) |
| D11~ | PWM, SPI MOSI |
| D12 | SPI MISO |
| D13 | SPI 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.
These pins have a 10-bit ADC (Analog-to-Digital Converter), meaning they read voltages between 0-5V as values from 0-1023.
| Pin | Special Functions |
|---|---|
| A0 | Analog input only |
| A1 | Analog input only |
| A2 | Analog input only |
| A3 | Analog input only |
| A4 | Analog input, I2C SDA |
| A5 | Analog 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.
| Protocol | Pins | What It's For |
|---|---|---|
| UART/Serial | D0 (RX), D1 (TX) | Talking to your computer, GPS modules, Bluetooth |
| I2C | A4 (SDA), A5 (SCL) | Sensors, OLED displays, real-time clocks |
| SPI | D10-D13 (SS, MOSI, MISO, SCK) | SD cards, high-speed displays, some sensors |
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.
| Specification | Value |
|---|---|
| Microcontroller | ATmega328P (8-bit AVR) |
| Clock Speed | 16 MHz |
| Operating Voltage | 5V |
| Flash Memory | 32 KB |
| SRAM | 2 KB |
| EEPROM | 1 KB |
| Digital I/O Pins | 14 (6 with PWM) |
| Analog Input Pins | 8 (2 more than Uno!) |
| Board Dimensions | 45 × 18 mm |
| Weight | 7 grams |
| Feature | Arduino Uno | Arduino Nano |
|---|---|---|
| Size | 68.6 × 53.4 mm | 45 × 18 mm (73% smaller!) |
| Weight | 25g | 7g |
| Analog Inputs | 6 (A0-A5) | 8 (A0-A7) |
| USB Connector | Type-B | Mini-B |
| Power Jack | Yes (barrel) | No |
| Breadboard-friendly | No | Yes! |
| MCU Type | DIP (replaceable) | SMD (soldered) |
The Nano has 30 pins arranged in two rows of 15, making it perfect for straddling a breadboard.
| Pin | Label | Function |
|---|---|---|
| 1 | D13 | Digital, SPI SCK, Built-in LED |
| 2 | 3V3 | 3.3V output (50mA max) |
| 3 | AREF | Analog reference voltage |
| 4 | A0 | Analog input |
| 5 | A1 | Analog input |
| 6 | A2 | Analog input |
| 7 | A3 | Analog input |
| 8 | A4 | Analog input, I2C SDA |
| 9 | A5 | Analog input, I2C SCL |
| 10 | A6 | Analog input ONLY |
| 11 | A7 | Analog input ONLY |
| 12 | 5V | 5V output |
| 13 | RST | Reset |
| 14 | GND | Ground |
| 15 | VIN | External power (7-12V) |
| Pin | Label | Function |
|---|---|---|
| 16 | D1/TX | Digital, Serial transmit |
| 17 | D0/RX | Digital, Serial receive |
| 18 | RST | Reset |
| 19 | GND | Ground |
| 20 | D2 | Digital, Interrupt 0 |
| 21 | D3~ | Digital, PWM, Interrupt 1 |
| 22 | D4 | Digital |
| 23 | D5~ | Digital, PWM |
| 24 | D6~ | Digital, PWM |
| 25 | D7 | Digital |
| 26 | D8 | Digital |
| 27 | D9~ | Digital, PWM |
| 28 | D10~ | Digital, PWM, SPI SS |
| 29 | D11~ | Digital, PWM, SPI MOSI |
| 30 | D12 | Digital, 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!
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.
| Physical Pin | GPIO (BCM) | Function | Physical Pin | GPIO (BCM) | Function |
|---|---|---|---|---|---|
| 1 | — | 3.3V Power | 2 | — | 5V Power |
| 3 | GPIO2 | I2C SDA | 4 | — | 5V Power |
| 5 | GPIO3 | I2C SCL | 6 | — | Ground |
| 7 | GPIO4 | GPCLK0 | 8 | GPIO14 | UART TX |
| 9 | — | Ground | 10 | GPIO15 | UART RX |
| 11 | GPIO17 | General | 12 | GPIO18 | PWM0 |
| 13 | GPIO27 | General | 14 | — | Ground |
| 15 | GPIO22 | General | 16 | GPIO23 | General |
| 17 | — | 3.3V Power | 18 | GPIO24 | General |
| 19 | GPIO10 | SPI MOSI | 20 | — | Ground |
| 21 | GPIO9 | SPI MISO | 22 | GPIO25 | General |
| 23 | GPIO11 | SPI SCLK | 24 | GPIO8 | SPI CE0 |
| 25 | — | Ground | 26 | GPIO7 | SPI CE1 |
| 27 | GPIO0 | ID_SD (EEPROM) | 28 | GPIO1 | ID_SC (EEPROM) |
| 29 | GPIO5 | General | 30 | — | Ground |
| 31 | GPIO6 | General | 32 | GPIO12 | PWM0 |
| 33 | GPIO13 | PWM1 | 34 | — | Ground |
| 35 | GPIO19 | PWM1/SPI MISO | 36 | GPIO16 | General |
| 37 | GPIO26 | General | 38 | GPIO20 | SPI MOSI |
| 39 | — | Ground | 40 | GPIO21 | SPI SCLK |
This trips up everyone at first. There are two ways to reference Pi GPIO pins:
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.
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.
| Type | Physical Pins | Notes |
|---|---|---|
| 5V | 2, 4 | Direct from power supply. Can power external devices. |
| 3.3V | 1, 17 | Regulated. Limited current (~50mA total recommended). |
| Ground | 6, 9, 14, 20, 25, 30, 34, 39 | Eight ground pins! |
| Interface | GPIO Pins | Physical Pins | Use Cases |
|---|---|---|---|
| I2C | GPIO2 (SDA), GPIO3 (SCL) | 3, 5 | Sensors, displays, RTCs |
| SPI0 | GPIO10, 9, 11, 8, 7 | 19, 21, 23, 24, 26 | SD cards, fast displays, ADCs |
| UART | GPIO14 (TX), GPIO15 (RX) | 8, 10 | Serial debugging, GPS, Bluetooth |
| PWM | GPIO12, 13, 18, 19 | 32, 33, 12, 35 | LEDs, servos, motors |
| Model | Processor | RAM | WiFi | Best For |
|---|---|---|---|---|
| Pi Zero | 1GHz single-core ARM11 | 512MB | No | Ultra-compact embedded projects |
| Pi Zero W | 1GHz single-core ARM11 | 512MB | 2.4GHz | IoT, portable projects |
| Pi Zero 2 W | 1GHz quad-core Cortex-A53 | 512MB | 2.4GHz | 5× faster than Zero W! |
| Pi 3B+ | 1.4GHz quad-core Cortex-A53 | 1GB | Dual-band | General projects, learning |
| Pi 4B | 1.5GHz quad-core Cortex-A72 | 1-8GB | Dual-band | Desktop replacement, media, AI |
| Pi 5 | 2.4GHz quad-core Cortex-A76 | 2-16GB | Dual-band | High performance, PCIe SSD, AI |
This is the million-dollar question for beginners. Here's my honest take:
✅ 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)
✅ 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
| Feature | Arduino (Uno/Nano) | Raspberry Pi |
|---|---|---|
| Voltage Logic | 5V | 3.3V (NOT 5V tolerant!) |
| Analog Inputs | Yes (6-8 pins, 10-bit) | No — requires external ADC |
| Operating System | None (runs code directly) | Linux (Raspberry Pi OS) |
| Power Draw | ~45mA | 700mA - 5A |
| Boot Time | Instant | 15-60 seconds |
| Real-time Precision | Excellent | Poor (OS introduces jitter) |
| Current per GPIO | Up to 40mA | ~16mA max |
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:
Arduino, on the other hand, runs at 5V and can handle both 3.3V and 5V inputs just fine.
Here's a pro tip: you don't have to choose. Many advanced projects use both:
This "best of both worlds" approach is common in robotics, home automation, and IoT projects.
If terms like GPIO, PWM, and I2C make your head spin, this section is for you.
The most basic pin type. Each GPIO pin can be configured as either:
// Arduino example pinMode(13, OUTPUT); // Set pin 13 as output digitalWrite(13, HIGH); // Turn on the LED
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:
// Arduino example analogWrite(9, 127); // 50% duty cycle (0-255 range)
Analog pins read varying voltages (not just on/off) and convert them to digital numbers.
Arduino Uno/Nano:
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.
A two-wire communication protocol for talking to multiple devices:
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.
| Board | SDA Pin | SCL Pin |
|---|---|---|
| Arduino Uno/Nano | A4 | A5 |
| Raspberry Pi | GPIO2 (Pin 3) | GPIO3 (Pin 5) |
Faster than I2C but requires more wires:
SPI is used for SD cards, high-speed displays, and fast sensors.
Simple two-wire serial communication:
Used for debugging (Serial Monitor), GPS modules, and Bluetooth adapters. Remember: TX connects to RX, RX connects to TX — they're crossed!
Learn from my (and many others') expensive mistakes:
The damage: Permanent destruction of GPIO pin or entire Pi
The fix: Always use level shifters or voltage dividers with 5V devices
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
The symptom: Erratic readings from buttons and switches
The fix: Use internal pull-ups (pinMode(pin, INPUT_PULLUP)) or add external resistors
The damage: Dead board, magic smoke released
The fix: Double-check wiring before powering on. Use a multimeter.
The symptom: Upload failures, garbage data
The fix: Disconnect anything on pins 0 and 1 before uploading
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
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.
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.
Ready to get started? Here are some solid options:
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.
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.
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.
You've now got everything you need to decode those mysterious pin headers. Here's what to remember:
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.
The pinout diagrams used in this article are available under open licenses: