Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The Raspberry Pi’s 40-pin header combines fixed power and ground connections with configurable 3.3V GPIO signals. A GPIO pin can be read as an input, driven high or low as an output, or assigned to a peripheral such as I2C, SPI, UART or PWM. The physical pin number printed on a wiring diagram is not the same as the BCM GPIO number used by software, so verify the exact board and numbering scheme before connecting anything.

For a model-specific map, run pinout in Raspberry Pi OS and check the official Raspberry Pi hardware documentation. Treat every GPIO signal as 3.3V logic: use a resistor with an LED, never apply 5V to a GPIO input, and drive motors through an H-bridge or motor-controller board rather than from a pin.

What the 40-pin GPIO header contains

The standard Raspberry Pi header has 40 positions on a 0.1-inch (2.54 mm) pitch. It is not a block of 40 identical outputs. Some positions are fixed 5V or 3.3V supplies, some are ground returns, and the remainder are GPIO-capable signal pins. A supply or ground pin cannot be changed into a GPIO in software.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • 5V supply: two header pins provide the board’s 5V rail. They are power connections, not 5V-tolerant GPIO inputs.
  • 3.3V supply: two pins provide 3.3V for suitable low-power circuits and pull-up networks.
  • Ground: several pins connect to the common ground plane and provide the return path for signals and loads.
  • GPIO signals: the remaining pins operate at 3.3V logic and can be configured as inputs, outputs, or alternate peripheral functions.

The exact peripheral routing and electrical specifications depend on the board family. The familiar map below is the common 40-pin arrangement used by current full-size boards, but a Compute Module or another board variant can expose different options. Always confirm the model-specific documentation before relying on an alternate function.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Raspberry Pi’s hardware reference describes the header, signal levels and warnings at https://www.raspberrypi.com/documentation/computers/raspberry-pi.html.

Physical pin numbers versus BCM GPIO numbers

Physical numbering identifies a position on the header, counting from pin 1 at one corner to pin 40 at the opposite end. BCM numbering identifies the GPIO controller signal name used by many software libraries. For example, physical pin 11 carries BCM GPIO17; “GPIO17” does not mean physical pin 17.

A wiring diagram that says “connect to pin 11” is using physical numbering. Code such as GPIO.setmode(GPIO.BCM) followed by GPIO.setup(17, GPIO.OUT) is using BCM numbering. Mixing the two can put a wire on a power pin or on an entirely different signal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Look up the board’s pinout in the Raspberry Pi documentation.
  2. Run pinout in Raspberry Pi OS for a local, board-aware diagram. The utility is installed by default with GPIO Zero on Raspberry Pi OS.
  3. Choose one numbering convention in your program and use that convention consistently in the wiring notes and code.
  4. With the board powered off, identify pin 1 from the board silkscreen or the diagram; do not infer orientation from a loose cable.

40-pin header map

This table shows the standard mapping used by the common 40-pin header. “Power” and “GND” are fixed connections. GPIO numbers are BCM numbers. Peripheral labels are common alternate functions, not a guarantee that the function is enabled by default on every board.

Physical pin Connection Physical pin Connection
1 3.3V power 2 5V power
3 GPIO2, I2C SDA 4 5V power
5 GPIO3, I2C SCL 6 Ground
7 GPIO4 8 GPIO14, UART TX
9 Ground 10 GPIO15, UART RX
11 GPIO17 12 GPIO18, hardware PWM
13 GPIO27 14 Ground
15 GPIO22 16 GPIO23
17 3.3V power 18 GPIO24
19 GPIO10, SPI0 MOSI 20 Ground
21 GPIO9, SPI0 MISO 22 GPIO25
23 GPIO11, SPI0 SCLK 24 GPIO8, SPI0 CE0
25 Ground 26 GPIO7, SPI0 CE1
27 GPIO0, advanced/reserved use 28 GPIO1, advanced/reserved use
29 GPIO5 30 Ground
31 GPIO6 32 GPIO12, hardware PWM
33 GPIO13, hardware PWM 34 Ground
35 GPIO19, hardware PWM 36 GPIO16
37 GPIO26 38 GPIO20
39 Ground 40 GPIO21

GPIO0 and GPIO1 on physical pins 27 and 28 are associated with board identification and other advanced uses in the general hardware documentation. Leave them alone unless you understand the identification bus and your board’s configuration.

How a GPIO input or output behaves

Output mode

In output mode, software drives the pin either low, approximately 0V, or high, approximately 3.3V. A high output is a logic signal, not a promise that the pin can supply power to an arbitrary load. Connect the load’s return to a ground pin and keep the load within the electrical specifications for your exact board.

Input mode

In input mode, the pin senses an external voltage. A floating input has no dependable state and can change when you touch the wire or when nearby signals switch. Use an external resistor or a software-configured pull-up or pull-down to establish a known idle state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

GPIO2 and GPIO3 have fixed pull-ups in the documented common configuration because they are the standard I2C data and clock lines. Other GPIO pulls can be selected in software, subject to the board’s supported configuration.

Alternate functions

The GPIO controller multiplexes several hardware peripherals onto selected pins. Assigning a pin to I2C, SPI, UART or hardware PWM changes how that pin is controlled. A pin cannot simultaneously be an ordinary output and an active peripheral signal. Device-tree overlays and board configuration can also alter which peripheral instance is exposed.

Common peripheral functions

I2C: GPIO2 and GPIO3

The documented common I2C mapping uses GPIO2 on physical pin 3 for SDA (data) and GPIO3 on physical pin 5 for SCL (clock). I2C devices share the two lines and normally require pull-up resistors to 3.3V. Check the module’s voltage and pull-up arrangement before connecting it; a breakout that pulls the bus to 5V is not suitable for a Raspberry Pi GPIO bus without proper level shifting.

UART serial: GPIO14 and GPIO15

GPIO14 on physical pin 8 is the usual UART transmit line, and GPIO15 on physical pin 10 is the receive line. A UART connection crosses the directions: the Pi’s TX goes to the other device’s RX, and the Pi’s RX goes to the other device’s TX, with a shared ground. Confirm the board’s console and Bluetooth configuration before assuming these pins are available for your application.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SPI0: GPIO7 through GPIO11

The standard SPI0 mapping is:

Signal BCM GPIO Physical pin
MOSI GPIO10 19
MISO GPIO9 21
SCLK GPIO11 23
CE0 GPIO8 24
CE1 GPIO7 26

MOSI carries data from the Pi, MISO carries data to the Pi, SCLK is the clock, and CE0/CE1 select devices. Additional SPI controllers and alternate mappings may be available on some board families; consult the pin/GPIO mapping documentation rather than assuming every model exposes the same choices.

PWM

Software PWM can be generated on all GPIO pins, but the documented hardware PWM-capable pins are GPIO12, GPIO13, GPIO18 and GPIO19. Hardware PWM generally gives more predictable timing while the processor is busy. The available PWM channels and alternate-function selection still depend on the board and configuration, so verify the mapping before designing a timing-sensitive circuit.

3.3V logic, 5V pins and electrical limits

Raspberry Pi GPIO outputs are specified as approximately 3.3V high and 0V low. The 5V header pins are supply rails; they do not make the neighboring GPIO pins 5V tolerant. Applying 5V to a GPIO input can damage the board. The official warning is: “Do not use 5V for 3.3V components.” Use a logic-level converter when a peripheral requires a different voltage.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Raspberry Pi publishes separate electrical tables for older BCM2835, BCM2836, BCM2837 and RP3A0-based products and for BCM2711-based 4-series devices. The older-family table lists a default drive strength of 8mA and a maximum drive-strength setting of 16mA; the BCM2711 table lists 4mA default and 8mA maximum. These are output-specification settings, not recommended current limits for a pin. Increasing a drive-strength setting does not turn a GPIO into a power supply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The hardware documentation also notes that the 3.3V supply was designed with a maximum of approximately 3mA per GPIO pin. That is a design note, not a universal safe-current rule: total loading, voltage drop, switching behavior and the particular board all matter. Loading many pins can stress the 3.3V supply and introduce interference. For a Compute Module or another specialized board, use that module’s datasheet rather than borrowing a figure from a different family.

Connect an LED safely

An LED must have a series resistor to limit current. The resistor value depends on the LED’s forward voltage, the chosen supply and the current you want, so there is no single universal value for every LED and circuit. A typical one-LED experiment uses a GPIO output, resistor and LED in series to ground.

  1. Power down the Pi and select an unused GPIO, such as BCM GPIO17 on physical pin 11.
  2. Connect physical pin 11 to one end of the resistor.
  3. Connect the resistor’s other end to the LED anode, usually the longer leg. Connect the LED cathode, usually the shorter leg or flat-edged side, to a ground pin such as physical pin 9.
  4. Check that the LED and resistor are in series and that no wire bridges 3.3V to ground.
  5. Start the pin as an output at low, then set it high only after the wiring has been checked.

With a GPIO library that uses BCM numbering, the logical pin is 17; with a library configured for physical numbering, it is pin 11. Keep the resistor in the circuit even if the LED appears dim without it. The Raspberry Pi hardware guidance explicitly states that LEDs should have resistors to limit current.

Connect a button or switch safely

A button is an input device, not a power load. Connect one side of the switch to a GPIO input and the other side to ground, then enable a pull-up so the input reads high while open and low while pressed. Alternatively, connect the switch to 3.3V and use a pull-down. Do not use 5V as the button signal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Choose an input GPIO that is not being used by a bus or boot-related function.
  2. Connect the switch between the GPIO and ground.
  3. Configure the input with a pull-up, or fit an external resistor if the circuit needs a defined value or longer cable.
  4. Handle contact bounce in software with a short debounce interval or a suitable input library.
  5. Test the idle and pressed readings before attaching other circuitry.

Long wires can pick up noise and create false transitions. Keep the ground connection close to the signal return, and use shielding, filtering or a stronger external pull resistor when the environment is electrically noisy.

Drive a motor or other high-current load

Never connect a motor directly to a GPIO pin. Motors draw startup and stall current, generate electrical noise and produce a voltage spike when switched off. A GPIO cannot safely absorb those conditions, and the resulting fault can damage both the pin and the board.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Use an H-bridge or dedicated motor-controller board. The Pi supplies a low-current logic signal to the controller; the controller switches power from a suitable motor supply. Connect the Pi ground to the controller’s logic ground unless the controller’s documentation specifies an isolated interface.

  • Choose a driver rated for the motor’s running and stall current.
  • Power the motor from its own suitable supply rather than from a GPIO pin.
  • Use the driver’s enable and direction inputs as logic signals from GPIO.
  • Follow the driver’s requirements for flyback protection, decoupling and level compatibility.
  • Keep motor wiring physically separate from sensitive I2C, UART or analog wiring.

The same principle applies to solenoids, relays, lamps and other loads that exceed a GPIO’s logic-level role: use a transistor, MOSFET, relay driver or controller designed for the load, with the required protection components.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use I2C, SPI and UART without damaging the bus

Voltage compatibility

Every device connected to a GPIO bus must use compatible logic levels. A peripheral powered at 5V may pull its signal lines to 5V even when its protocol is nominally “I2C” or “SPI.” Use a bidirectional I2C level shifter or an appropriate translator for other buses when the voltage domains differ.

Shared ground and wiring

Connect a common ground between the Pi and a non-isolated peripheral. Keep wires short for fast SPI clocks, arrange a clean return path, and avoid routing clock lines alongside motor leads. If a bus becomes unreliable, reduce the speed, shorten the wiring and check every pull-up and supply connection.

Conflicting functions

A pin assigned to SPI, I2C, UART or PWM is no longer freely available for an unrelated output. Before enabling a peripheral, check that its pins do not conflict with an existing device, a console, a display overlay or a boot-time function.

Model-aware configuration and documentation

The 40-pin layout is intentionally consistent across many Raspberry Pi boards, but “same header” does not mean “identical electrical behavior.” Peripheral instances, alternate mappings and drive-strength tables vary by SoC family. Raspberry Pi’s documentation separates older BCM2835/2836/2837/RP3A0 products from BCM2711-based 4-series devices and directs Compute Module users to the relevant datasheet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Record the exact board model and revision in a project’s wiring notes. Then verify:

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  • the physical-to-BCM mapping;
  • the alternate function and peripheral instance;
  • the GPIO voltage domain;
  • the board-family electrical specifications;
  • whether the operating system has claimed the pin for a console, overlay or other service.

If the local pinout output and a third-party diagram disagree, prefer the model-specific official documentation and the board’s own labels.

Common mistakes and how to recover

The circuit is completely dead

Check header orientation, the ground return, the selected numbering mode and whether the code is addressing BCM or physical numbers. Confirm that the chosen pin is not a 3.3V, 5V or ground position.

The input changes randomly

The input is probably floating. Add a pull-up or pull-down, shorten the wire, improve the ground connection and debounce the switch in software.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An LED is too bright or the board resets

Power down immediately and inspect for a missing resistor, a short to 5V or reversed wiring. Use a suitable series resistor and avoid driving several loads from GPIOs at once.

An I2C device is not detected

Verify SDA and SCL, common ground, the device address, pull-ups and voltage compatibility. A 5V pull-up on either line can expose the Pi to a damaging voltage.

SPI data is corrupted

Check MOSI, MISO, SCLK and chip-select wiring against the table, confirm the selected CE line, reduce the clock speed and inspect for long or noisy wires.

A motor causes crashes or resets

Disconnect it from the GPIO immediately. Replace the direct connection with a properly powered H-bridge or motor controller, add the protection and decoupling required by that driver, and share ground where the interface is non-isolated.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A safe GPIO workflow

  1. Identify the exact Raspberry Pi model and run pinout.
  2. Choose a free GPIO and write down both its physical and BCM numbers.
  3. Confirm that the attached circuit is a 3.3V logic design or add level shifting.
  4. Plan a ground return and a separate supply for loads that need more than logic current.
  5. Add required protection: an LED resistor, input pull resistor, flyback path or motor driver.
  6. Wire with the board unpowered and inspect every connection.
  7. Configure the pin in software before applying an active output.
  8. Test one function at a time, watching for heat, resets, unexpected voltage or bus errors.

Following this process keeps the distinction clear: power pins provide rails, ground pins provide returns, and GPIO pins provide 3.3V logic and peripheral signaling. The official pinout and the documentation for your exact board remain the authority when a project uses an alternate mapping or a model-specific electrical limit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.