Online Tool Store Online Tool Store
🔌 Developer Tools

· 4 min read

How to Read the Raspberry Pi GPIO Header

Manesh Jayawardhana

CIO & Co-founder

Manesh Jayawardhana is the CIO and Co-Founder of Ceyentra Technologies, where he has spent over nine years leading the design and delivery of software solutions for clients across the globe, spanning web, mobile, AI, and capital market systems. He has grown Online Tool Store's engineering team from the ground up while steering the company's technical direction. His writing draws on this breadth of experience building and shipping software across a wide range of industries and markets. View on LinkedIn

Share

How to Read the Raspberry Pi GPIO Header

A tutorial says to connect the sensor to GPIO 3. You count three pins along the header, wire it up, and nothing works — because GPIO 3 and pin 3 are different pins, and the numbering scheme you used isn’t the one the tutorial meant.

This is the single most common first-project problem on the Pi, and it’s entirely a documentation issue rather than an electronics one.

Two numbering schemes

Physical (board) numbering counts the pins as they sit on the board: 1 to 40, odd on one side, even on the other. Pin 1 is the corner nearest the SD card slot on most boards.

BCM numbering uses the Broadcom SoC’s own GPIO channel numbers. These are the numbers most libraries expect, and they don’t correspond to physical position at all.

So physical pin 3 is BCM GPIO 2. Physical pin 5 is BCM GPIO 3. Wiring to “pin 3” when the tutorial meant “GPIO 3” puts your signal on the wrong line — and since both are I2C pins in this case, it fails in a confusing way rather than an obvious one.

Pick one scheme per project, state it in a comment at the top of your code, and label your wiring with it.

The pins you’ll actually look for

Power: 3.3 V on pins 1 and 17; 5 V on pins 2 and 4.

Ground: pins 6, 9, 14, 20, 25, 30, 34 and 39 — there are plenty, and using the nearest one keeps wiring tidy.

I2C: pin 3 (BCM 2, SDA) and pin 5 (BCM 3, SCL).

SPI: pins 19, 21, 23 for MOSI, MISO and SCLK, with chip selects on 24 and 26.

UART: pins 8 and 10 (BCM 14 and 15).

The voltage rule that damages boards

GPIO pins are 3.3 V and are not 5 V tolerant. Connecting a 5 V signal to a GPIO input can permanently damage the SoC. The 5 V pins on the header supply 5 V; they don’t mean the GPIO can accept it.

Anything running at 5 V — plenty of common sensors and displays — needs a level shifter or, for a simple input, a resistor divider. This is the mistake that kills boards.

Current is the other limit: a few milliamps per pin, with a modest total across the header. Anything with a motor, a relay coil or a long LED strip needs external power and a driver transistor.

NeedUse
5 V device signal → Pi inputLevel shifter or divider
Motor, relay, LED stripExternal supply + driver
Multiple I2C devicesSame two pins, different addresses
More than a few mANot directly from a GPIO pin

Why people get stuck here

  • Numbering confusion. As above, and it accounts for most first-project failures.
  • Assuming 5 V tolerance. The header has 5 V pins, so people assume the GPIO handles it.
  • Board orientation. Counting from the wrong corner reverses everything.
  • Pins with default functions. Some pins have pull-ups or boot-time behaviour that surprises you if you use them for something else.

Common mistakes to avoid

  • Mixing physical and BCM numbering within one project.
  • Driving anything inductive directly from a GPIO pin without a driver and a flyback diode.
  • Connecting a 5 V sensor output straight to a GPIO input.
  • Powering a Pi from the 5 V header pin without understanding that it bypasses the input protection.
  • Counting pins from the wrong end of the header.

How to do it with Raspberry Pi GPIO Pinout

The Raspberry Pi GPIO Pinout shows both numbering schemes side by side with the bus pins highlighted.

  1. Choose whether you’re working in physical or BCM numbering — and stick to it.
  2. Highlight the bus you need to find its pins quickly.
  3. Check voltage before connecting anything: GPIO is 3.3 V only.
  4. Label your wiring with the scheme you chose.

The official Raspberry Pi GPIO documentation covers the electrical limits in detail. Other hardware references are in the tools directory.

Frequently asked questions

Physical or BCM numbering?

BCM is what most libraries expect; physical is what you count on the board. Pick one for a project, note it in your code, and label your wiring — pin 3 and GPIO 3 are different pins.

Are the GPIO pins 5 V tolerant?

No. They’re 3.3 V, and applying 5 V can permanently damage the chip. Use a level shifter or a divider for 5 V devices.

How much current can a pin supply?

A few milliamps per pin with a limited total across the header. Motors, relays and LED strips all need external power and a driver.

Final thought

Write the numbering scheme at the top of every script and on the label of every jumper. Two minutes of labelling prevents the most common Pi debugging session there is.

Try the free Raspberry Pi GPIO Pinout

#raspberry-pi-gpio#pin-numbering#bcm-pins#pi-electronics#online-tools#free-tools