Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 37 ยท Getting Started

Hardware Tour and the 40-Pin Header

Walk around the Raspberry Pi board: processor, memory, ports, the camera and display connectors, and the 40-pin GPIO header with power and ground pins.

Pick up a Raspberry Pi and turn it over in your hands. At first the board looks like a jumble of metal boxes and tiny chips, but only a handful of parts matter. Knowing what each one does makes everything later, from powering the board to wiring an LED, much easier. This lesson is a guided tour of a typical full-size Pi, with extra attention to the 40-pin header that makes the board special.

The parts you can see

  • The SoC. The big square chip, often under a metal lid, is the system on a chip: processor cores, graphics unit and memory controller in one package. On most boards the RAM chip sits right next to it.
  • USB ports. Plug in a keyboard, mouse, storage or webcam. Blue ports are USB 3 and faster on boards that have them.
  • Ethernet port. A wired network connection. Wi-Fi and Bluetooth come from a separate radio chip with its own small metal can.
  • HDMI ports. The Pi 4 and Pi 5 have two micro-HDMI ports and can drive two screens. Zero boards have one mini-HDMI.
  • USB-C power input. Full-size modern boards take power here. Older boards and Zeros use micro-USB.
  • microSD card slot. On the underside. It holds the operating system and your files unless you boot from an SSD.
  • Audio/composite jack. A 3.5 mm jack on some models (the Pi 5 dropped it).
  • CSI and DSI connectors. Thin, flat-cable sockets. CSI takes a camera, DSI takes a display.
  • The 40-pin GPIO header. The double row of metal pins along one edge. This is your gateway to electronics.

Around the board

Power USB-C input
Display micro-HDMI and DSI
1 / 2

The 40-pin header

The GPIO header has 40 pins arranged in two rows of 20. Pin numbering (the physical or board numbering) counts across: pin 1 is at one corner, pin 2 is directly next to it in the other row, pin 3 is below pin 1, and so on. Odd pins are on one row, even pins on the other. Pin 1 (3.3 V) is the corner pin nearest the microSD card end of the board, and on the underside its solder pad is square instead of round, which helps you find it.

Not every pin is a general-purpose signal. The 40 pins split into groups:

Group Pins Purpose
3.3 V power 1 and 17 Power for 3.3 V parts (low current)
5 V power 2 and 4 Straight from the USB supply
Ground (GND) 6, 9, 14, 20, 25, 30, 34, 39 Common return for current
GPIO 26 pins Programmable inputs and outputs
ID EEPROM 27 and 28 Reserved for HATs; leave alone

That leaves 26 GPIO pins named GPIO2 to GPIO27. Many of them have a second job: GPIO2 and GPIO3 are the I2C pair, GPIO14 and GPIO15 are the serial port, and GPIO7 to GPIO11 are the SPI bus. You will use those in Buses: I2C, SPI and UART.

GPIO pins work at 3.3 V, not 5 V. Feeding 5 V into a GPIO pin can permanently damage the chip. A pin can safely deliver only a few milliamps, so never connect a motor or a bright light directly to it. Use a resistor, a transistor or a driver board.

Printing the header with code

A helper that knows the pin layout is handy when planning wiring. The stand-in below rebuilds the layout from a list and prints it as the two columns you would see on the board.

Python Stand-in: print the 40-pin header

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Counting the pins

Once the layout lives in a dictionary, you can ask questions about it. How many pins are power, how many are ground, and how many are usable as general-purpose signals?

Python Stand-in: classify pins

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The totals add up to 40, and 26 pins remain for your projects. If you want a live pinout on a real Pi, the pinout command that comes with gpiozero draws an ASCII diagram of your own board (read-only):

Terminal
pinout

Other connectors worth knowing

The camera and display ribbon cables are fragile: lift the latch, slide the cable in with the contacts facing the right way, and push the latch down. A PoE header (the four pins near the corner) powers the board over Ethernet with a special HAT. The Pi 5 adds a small power button, a real-time clock battery connector and a PCIe connector for fast SSD adapters. Do not worry about them yet; you will meet the useful ones in later lessons.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What voltage do the Raspberry Pi GPIO pins use?

    GPIO logic is 3.3 V. Feeding 5 V into a pin can damage the chip.
  2. 2. How many pins does the standard GPIO header have, and how many are usable GPIO?

    There are 40 pins, but power, ground and the HAT ID pins leave 26 GPIO pins.
  3. 3. Which connector takes a camera ribbon cable?

    CSI is the camera serial interface. DSI is for displays.
  4. 4. Why should you not connect a motor directly to a GPIO pin?

    A GPIO pin can supply only a few milliamps; motors need a transistor or driver.

Summary

  • The key parts are the SoC, USB, Ethernet, HDMI, power input, microSD slot, CSI/DSI and the GPIO header.
  • The header has 40 pins: power, ground, a reserved pair and 26 GPIO pins.
  • Many GPIO pins also serve I2C, SPI and serial functions.
  • GPIO is 3.3 V and low current; protect your board with resistors and drivers.

Next: Accessories and a Starter Shopping List