Raspberry Pi 4 Kit Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t1131

Contents

Introduction

The improved Raspberry Pi 4 Model B [ 2GB, 4GB, and 8GB ] is another upgrade in the line of Raspberry Pi single board computers, what's new? This hookup guide goes through the same process of getting going that worked with the previous Raspberry Pi Models.

Raspberry Pi 4 Model B (2 GB)

Raspberry Pi 4 Model B (2 GB)

DEV-15446
$45.00
4
Raspberry Pi 4 Model B (4 GB)

Raspberry Pi 4 Model B (4 GB)

DEV-15447
$55.00
19
Raspberry Pi 4 Model B (8 GB)

Raspberry Pi 4 Model B (8 GB)

DEV-16811
$75.00
9

There are a few kits available depending on your project. Depending on the version that you order, you can have one that includes the 2GB, 4GB, or 8GB RAM.

Basic Kit Version Desktop Kit Hardware Starter Kit Version
Basic Kit Desktop Kit Hardware Starter Kit

Materials Required

You'll need a mouse, keyboard, monitor, wall adapter with minimum power requirements, and cables to begin. Once configured, the Pi can be operated from its own peripherals or another computer connected over the Internet.

Kit Versions

There are three versions of the kit available at SparkFun. Each version includes a Raspberry Pi 4 with a different size RAM. Check out below for the different kit versions available!

Basic Kit Version

The basic kit offers the bare bones of what you need to get up and running. This is assuming that you have a monitor, keyboard, mouse, and card reader [1] on hand. The connectors are different on the Pi 4 so the kit provides a mini-HDMI to HDMI cable and USB-C wall adapter at a minimum. The kits include a raw microSD card and SD card adapter so that you can flash your favorite Linux distribution. A Qwiic Shim is included to easily connect a I2C device to the Raspberry Pi. A Raspberry Pi 4 with either a 2GB, 4GB, or 8GB RAM is included in the kit. We also have a kit without a Raspberry Pi 4 if you already have one.

SparkFun Raspberry Pi 4 Basic Kit - Without Raspberry Pi

SparkFun Raspberry Pi 4 Basic Kit - Without Raspberry Pi

KIT-17237
$48.50
SparkFun Raspberry Pi 4 Basic Kit - 2GB

SparkFun Raspberry Pi 4 Basic Kit - 2GB

KIT-16383
$84.95
1
SparkFun Raspberry Pi 4 Basic Kit - 4GB

SparkFun Raspberry Pi 4 Basic Kit - 4GB

KIT-16384
$96.50
8
SparkFun Raspberry Pi 4 Basic Kit - 8GB

SparkFun Raspberry Pi 4 Basic Kit - 8GB

KIT-17980
$123.50
1

Desktop Kit Version

The desktop kit is pretty much the basic. However, a wireless keyboard with touchpad is included. We also include a heat sink case to keep your Pi cool as a cucumber when pushing your Pi's processing capabilities. The power supply included in this kit is provides a modular power system with the USB Type C wall adapter and Type C to Type C USB cable. Compared to the basic kit, the raw microSD card [1] included in this kit has a faster read/write speeds to take advantage of the Pi 4's processing power. This cuts the amount of time to flash or update the Linux distribution of your choice down significantly. A Raspberry Pi 4 with either a 2GB, 4GB, or 8GB RAM is included in the kit. We also have a kit without a Raspberry Pi 4 if you already have one.

SparkFun Raspberry Pi 4 Desktop Kit - Without Raspberry Pi

SparkFun Raspberry Pi 4 Desktop Kit - Without Raspberry Pi

KIT-17727
$104.95

SparkFun Raspberry Pi 4 Desktop Kit - 2GB

KIT-16385
Retired
SparkFun Raspberry Pi 4 Desktop Kit - 4GB

SparkFun Raspberry Pi 4 Desktop Kit - 4GB

KIT-16386
$171.50
SparkFun Raspberry Pi 4 Desktop Kit - 8GB

SparkFun Raspberry Pi 4 Desktop Kit - 8GB

KIT-16812
$192.95

Hardware Starter Kit Version

The hardware kit is designed for those that are interested in prototyping a circuit on a breadboard. It includes components from both the basic and desktop kits. In addition, the hardware starter kit includes a breadboard, Pi Wedge adapter, IDC cable, LEDs, current limiting resistors, buttons, jumper wires, 2x20 extension header, 3.3V USB-to-Serial converter, and mini-B USB cable. A Raspberry Pi 4 with either a 4GB or 8GB RAM is included in the kit. We also have a kit without a Raspberry Pi 4 if you already have one.

SparkFun Raspberry Pi 4 Hardware Starter Kit - Without Raspberry Pi

SparkFun Raspberry Pi 4 Hardware Starter Kit - Without Raspberry Pi

KIT-17726
$106.95
SparkFun Raspberry Pi 4 Hardware Starter Kit - 4GB

SparkFun Raspberry Pi 4 Hardware Starter Kit - 4GB

KIT-16388
$171.50
1
SparkFun Raspberry Pi 4 Hardware Starter Kit - 8GB

SparkFun Raspberry Pi 4 Hardware Starter Kit - 8GB

KIT-17380
$192.95
1

Comparison Chart

Below is a table that shows the differences between the basic, desktop, and hardware kits.

Includes Basic Desktop Hardware
Pi 4 Basic Kit Pi 4 Desktop Kit Pi 4 Hardware Starter Kit
Raspberry Pi 4 Version 2 GB / 4 GB / 8 GB /
Without Pi 4
2 GB / 4 GB / 8 GB /
Without Pi 4
4 GB / 8 GB /
Without Pi 4
Wall Adapter w/ Type C Cable ✓ (for the 2GB, 4GB, and 8GB, and without Pi 4 versions)
USB Type C Wall Adapter ✓ (initial release in the older 8GB version)
USB Type C Cable ✓ (initial release in the older 8GB version)
HDMI Micro to HDMI
MicroSD Card w/ Adapter
✓ (initial release of the 2GB version)
High Speed MicroSD Card w/ Adapter
Logitech N400 Plus Wireless Keyboard & Touchpad
Qwiic Shim
Heat Sink Case
2x20 Extension Header
Raspberry Pi Wedge w/ IDC Cable
Breadboard
M/F Premium Jumper Wires 6"
(10 Pack)
M/M Standard Jumper Wires 7"
(30 Pack)
Assorted Colored LEDs
(20 Pack)
330Ω 1/4 Watt Current Limiting Resistors
(20 Pack)
Multicolored Buttons
(4 Pack)
3.3V FTDI Basic Breakout
Mini-B USB Cable

Getting an OS

The microSD card included in each kit does not have an image flashed. You'll need to flash a new image to the microSD card if you are just starting out or if your existing image becomes corrupt somewhere down the line. There are a few Linux-based images available depending on your application. Or feel free to power down your Pi and switch microSD cards out to experiment with a different image. For beginners, we recommend getting NOOBS. Otherwise, the Raspbian with the PIXEL desktop would be the best.

For the scope of this tutorial, we will summarize two of the images from the Pi foundation.

Flashing the Image NOOBS

If you decide to use NOOBS, you will need to:

Flashing the Image Raspbian and 3rd Party OS Images

Then follow the steps below to flash an image using the Raspberry Pi Imager.

Hardware Assembly

The Pi is straight-forward and easy to put together, but in the event that something doesn't seem right, this section will give you an idea of what it is supposed to look like to get the Pi up and running.

Basic Kit Desktop Kit Hardware Starter Kit
Basic Kit Desktop Kit Hardware Starter Kit

Unbox and gather these components before beginning the assembly

Attaching a Heat Sink Enclosure Optional

If you are using the heat sink enclosure, grab the thermal pad that matches the size of the Pi's CPU. Remove the thin, clear plastic film and paper from both sides of the thermal pad. Attach the side that had the paper to the Pi's CPU. There are thermal pads shaped for other IC and can be added on those chips as well. However, those do not get hot.

Thermal Pad

Grab the top of the heat sink case with the cutout for the GPIO pins and place it on the Pi. If you are using the DSI port or Raspberry Pi camera, now would be good time to insert the ribbon cable between the Pi and the top of the heat sink.

Top of Heat Sink

Align the mounting holes of the bottom of the heat sink case.

Bottom of Heat Sink

Screw and tighten the hex bolts using the allen key.

Tighten

Rotate the Pi. Your heat sink enclosure should look like the image below!

Raspberry Pi with Heat Sink

Insert the microSD Card

With the image flashed on the microSD Card, insert it into the microSD socket.

MicroSD Card Being Inserted without Enclosure MicroSD Card Being Inserted with Enclosure

Attaching Peripherals

Attach desired consumer computer equipment. At a minimum to get up and running or navigate through the Pi, we recommend using a monitor, keyboard, and mouse. The following images will use a Pi without an enclosure to show where to connect the peripherals.

Monitor

Using a monitor with a HDMI port [3], insert the HDMI end of the cable to the connector. Then connect the mini-HDMI end of the cable to the connector. Note that the Pi 4 has two mini-HDMI outputs. You will need to connect to the HDMI0 port. closest to the USB-C connector.

mini-HDMI Cable to Pi

Keyboard and Mouse

Connect a keyboard and mouse to the USB ports. In this case, we were using a wireless keyboard and mouse that had a USB dongle. While you can insert the HID device into any USB port, we recommend connecting it to the USB 2.0 port so that you have the faster USB 3.0 ports (with blue) are available for certain devices (i.e. flash drives).

Wireless USB Dongle for Keyboard and Mouse

If you are using a wireless keyboard/mouse combo, the wireless USB dongle that is included maybe hidden in the battery compartment. If you are using the Logitech K400 Plus, flip it over and slide the compartment for the battery holder off.

Slide Cover Off Battery Compartment Logitech K400

Flipping over the cover, you'll notice that the dongle is attached inconspicuously on the back. Grab the wireless dongle from the back to insert into the Pi's USB port and slide the cover back on the Logitech K400 Plus.

Hidden Dongle on Logitech K400

To power the keyboard, make sure to flip the power switch to the green position on the side of the Logitech K400 Plus. Feel free to flip the power switch back to the red position to remove power.

Flip Switch to On Position

Power Supply

If you have not already, make sure that you inserted the microSD card into the microSD socket. Once everything is connected, insert the power supply [4]!

Power Up the Pi

Completed Setup

At this point, your setup should look similar to the images below to get the Pi up and running. You could add ethernet, a second monitor, headphones, speakers, or a camera depending on your setup as well!

Full Setup Full Setup with Enclosure

Connecting Hardware

Need easy access to the GPIO pins on the board? If you ordered a Qwiic cable, Qwiic enabled device, and any of the kits, take a look at the Qwiic SHIM [5] to quickly access the I2C pins. If you are looking to use certain I2C devices with Python, we recommend taking a look at the Qwiic SHIM Kit or Qwiic Starter Kit for Raspberry Pi to get started.

Qwiic SHIM for Raspberry Pi Hookup Guide

December 5, 2019

Ever wanted to prototype I2C components on a Pi? Now you can!

Qwiic SHIM Kit for Raspberry Pi Hookup Guide

February 16, 2021

Get started with the Serial LCD with RGB backlight and 9DoF IMU (ICM-20948) via I2C using the Qwiic system and Python on a Raspberry Pi! Take sensor readings and display them in the serial terminal or SerLCD.

If you included the Pi Wedge with prototyping parts in your order or the Hardware Starter Kit, check out the associated tutorial for the Pi Wedge[5] to easily access the GPIO pins on a breadboard. We recommend taking a look at the Raspberry gPIo tutorial to get started with LEDs and buttons. If you decide to go headless, you can use the 3.3V FTDI to configure or control your Pi via serial.

Preassembled 40-pin Pi Wedge Hookup Guide

October 29, 2015

Using the Preassembled Pi Wedge to prototype with the Raspberry Pi B+.

Raspberry gPIo

October 29, 2015

How to use either Python or C++ to drive the I/O lines on a Raspberry Pi.

Headless Raspberry Pi Setup

April 23, 2018

Configure a Raspberry Pi without a keyboard, mouse, or monitor.

Methods of Working with the Pi

Once the Pi is configured, there are a few methods of using it depending on if you want to use it like a desktop or manage it remotely.

This section covers using the Pi in the following ways

Using HDMI-out with a Monitor

If this is the first time you are booting NOOBS, you'll need to connect your Raspberry Pi to a monitor and follow the installer. In the window, select Raspbian Full [RECOMMENDED] and click on the button to Install. You'll need to be patient as the software installs the OS to the microSD card. Once finished, click on OK. This will restart the Pi.

PIXEL Desktop (GUI)

By selecting NOOBS with Raspbian, it automatically logs in and starts a graphical user interface. Once the desktop installs, follow the wizard to configure your Raspberry Pi! You'll need to configure the settings based on your region, monitor, keyboard, Internet settings, and password. It is best to have the Pi check for updates and restart for the changes to take effect.

Set Up Wizard

If you ever need to update the settings, just head to the Raspberry Pi Start Menu > Preferences > Raspberry Pi Configuration.

Raspberry Pi Configuration from Start Menu

A window will pop up allowing you to easily update the region, monitor, keyboard, password, and turn on any peripherals.

Raspberry Pi Configuration

As for the Internet settings, simply click on the "Wireless & Wired Network icon" in the menu bar. This should be by the clock on the upper right corner of the screen. Then select the network and enter its respective password.

Raspberry Pi Wireless and Wired Connections Icon Desktop

Command Line Interface (CLI)

If configured to boot to shell, log in with the following credentials:

     username: pi
     password: raspberry

Then, enter in the command line to enter a graphical environment should you decide to take advantage of the desktop-type menu-driven operating system.

language:bash
startx

If you need to get back to text land, you can either

Remember, shutdown with the task bar menu or enter the following command from a shell, and wait for the system to halt before removing power [6].

language:bash
sudo shutdown -h now

Headless without a Monitor

As an alternative, you can also log into the Pi as a "headless" computer. This is basically a Raspberry Pi without a monitor, keyboard, or mouse. You can decide to connect to the Pi using a serial UART or SSH. For advanced users, you will need to turn on the interfaces before you can take advantage of these setups.

Headless Raspberry Pi Setup

April 23, 2018

Configure a Raspberry Pi without a keyboard, mouse, or monitor.

How to Use Remote Desktop on the Raspberry Pi with VNC

July 9, 2018

Use RealVNC to connect to your Raspberry Pi to control the graphical desktop remotely across the network.

Configuring the Pi

This section goes over configuring the keyboard, wired, and wireless internet.

The Raspbian distribution comes defaulted to European hardware. With US keyboards, the " (quotation mark) symbol is replaced by @ (commercial at) and our number sign # is replaced by the European pound sign £. This can make it aggravating when trying to #define things.

PIXEL Desktop (GUI)

The easiest method of configuring the Pi is using the PIXEL desktop. For those that need to adjust the settings again after the initial setup, check below!

Configuring the Keyboard Layout

To configure the keyboard layout again, head to the Task Bar Menu by clicking the Pi Start Menu > Preferences > Raspberry Pi Configuration > Localisation > Set Keyboard....

Raspberry Pi Configuration Region

Configuring the Internet Interfaces

Raspbian does a good job of configuring wireless networks automatically. By default, DHCP is configured so that the Pi will receive an IP address when a network cable is plugged it to the Ethernet port or when a wireless network is connected.

To use the graphical network tool, right click on the icon on the right side of the task bar, and click "WiFi Networks (dhcpcdui) Settings". Then, select the interface desired (wlan0 or eth0) to disable the DHCP and set your own IP, if necessary.

To connect to a wireless network, click on the icon, select the desired network, and enter the password.

Raspberry Pi Wireless and Wired Connections Icon Desktop

Hovering over the icon will bring up a status of wlan0 and eth0 that also shows the IP address.

Command Line Interface (CLI)

For advanced users using the command line, you can use the CLI to adjust the settings. Open a Terminal Window to configure the Raspberry Pi.

Configuring the Keyboard Layout

Invoke the config tool with the following command in the command line:

language:bash
sudo raspi-config

Then take the following actions to change the keyboard settings. We'll change the settings to US in the following example. If you are in another region, just select the option that best fits your preferences:

We recommend restarting the Pi at this point to ensure that the changes take effect.

Changing Your Password

Type the following command to change the password.

language:bash
sudo passwd

You will be prompted to enter your new password. Type in your new password, and your Pi will be that much more secure from unwanted visitors.

Configuring the Internet Interfaces

At this time, the network configuration works out of the box so there's really nothing to configure, but in case something goes awry, here's the basics of what can be played with and a known-working configuration to compare with.

A configuration file, interfaces, configures both wired and wireless devices. Enter the following command into a terminal to edit the interfaces file.

language:bash
sudo nano /etc/network/interfaces

Replace "nano" with "leafpad" if you prefer graphics. Here's what our Pi 3 is using:

language:bash
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

By default, this file is set up to get its configuration from /etc/wpa_supplicant/wpa_supplicant.conf, which is really the proper place for wifi information. Here are the contents:

language:bash
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="myNetworkSSID"
        psk="mySuperSecurePassword"
        key_mgmt=WPA-PSK
}
A note on network configuration: Try the GUI tool first, and only modify the files as a last resort. If you find the tool doesn't work, save your configuration files as a backup, and don't be afraid to try your hand at a manual configuration.

Applying the Changes

Sometimes the link should be cycled for a new configuration to take. Rather than shutting down the pi and restarting, use ifdown and ifup to bring the link down and back up.

For wireless connections, use

language:bash
sudo ifdown wlan

and

language:bash
sudo ifup wlan0

For wired connections, use

language:bash
sudo ifdown eth0

and

language:bash
sudo ifup eth0

Updating Software

Software packages are constantly updated. Luckily, Linux uses a package manager. All we have to do is tell our package manager to update everything, and then sit back and watch. Make sure to update the image so that we have the latest distribution. Enter the following commands in the command line individually to update your image.

language:bash
sudo apt-get update

This will go fetch the latest package information and tell the package manager what needs to be updated.

language:bash
sudo apt-get upgrade

This will download and upgrade all the packages. Please note that this upgrade will take a while. It will also prompt you if this is really what you want to do, the correct answer is "Y".

If needed, type the following command to restart.

language:bash
sudo reboot 

Over time, you'll start accumulating old packages during updates. To save space and remove unnecessary packages that were automatically installed that are no longer needed, you can enter the following command. It will also prompt you if this is really what you want to do, the correct answer is "Y".

language:bash
sudo apt-get autoremove

Then clear the package cache by entering the following command.

language:bash
sudo apt-get clean

Other Useful Linux Commands

A few other useful commands for use in the terminal command line:

At this point you should be interacting with your Raspberry Pi like you would any other computer. You can teach yourself the finer points of Linux, learn Python, program the GPIO pins, setup a minecraft server, build a network storage system, game console, or media center, or just surf the web.

Troubleshooting

Having issues getting the Raspberry Pi to work? Check out this sticky note from the Raspberry Pi Foundation's forum for basic troubleshooting.

Pi Foundation Forums: Basic Troubleshooting with the Raspberry Pi

Having problems with a piece of SparkFun hardware designed for the Raspberry Pi and interfacing it? Try checking out the SparkFun forums to see if we can assist.

SparkFun Forums

Resources and Going Further

Raspberry Pi Accessories

If you are looking to add additional features, check out the accessories to power your Raspberry Pi remotely, build a homemade motion-activated security system, or go retro by building your own arcade controller to emulate classic video games!

Raspberry Pi LCD - 7" Touchscreen

Raspberry Pi LCD - 7" Touchscreen

LCD-13733
$60.00
54

SparkFun PiRetrocade

KIT-14007
7 Retired

Raspberry Pi Camera Module V2

DEV-14028
16

PiJuice HAT - Raspberry Pi Portable Power Platform

PRT-14803
5

Click to Browse More Raspberry Pi Accessories


Here are some links to our other Pi resources.

Need some inspiration? Check out these tutorials and projects.

Serial Terminal Basics

This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Hackers in Residence: The Sound Visualizer Pt. 2

An addition to a previous project, this time using a PC and a custom Java app to create your own music visualizer using a RGB LED matrix.

Introduction to MQTT

An introduction to MQTT, one of the main communication protocols used with the Internet of Things (IoT).

Pi Servo pHAT (v2) Hookup Guide

This hookup guide will get you started with connecting and using the Pi Servo pHAT on a Raspberry Pi.

Or check out some of these blog posts for ideas.

Enginursday: Time-lapse with the Raspberry Pi

November 21, 2013

Enginursday: Monitor Twitter With a Raspberry Pi

December 5, 2013

Enginursday: Time-lapse with the Raspberry Pi Pt. 2

February 13, 2014

Raspberry Pi 3

February 29, 2016

T³: Raspberry Pi and the Stereo Arcana

July 19, 2016

T³: IoT Smart Pantry (Part 1)

September 27, 2016

Friday Product Post: In Vivid 1080pi

October 7, 2016

Taking Your PiRetrocade to the Next Level

November 10, 2016

Enginursday: Fun with Sockets

December 22, 2016

Enginursday: Mort and Mary Present...Fun with Sockets, Part Deux - Old Products Never Die

December 29, 2016

Enginursday: Eniac, The Data-Logging Web Server

January 26, 2017

IoTuesday: New Year's Resolution #2 – Healthier Eating

January 31, 2017

IoTuesday: Web-Style GUIs for your Raspberry Pi Hardware Project

February 21, 2017

Hardware Hump Day: Cloning your Raspberry Pi

March 8, 2017

Hardware Hump Day: USB Device Rules on Raspberry Pi

March 15, 2017

Enginursday: Home-Brew Alexa Endpoint

March 30, 2017

Automated Conference Room Signage

November 8, 2017

Swarming to Space on the Wings of XBee, RPi

November 9, 2017

Mort and Mary Present: The Mind-Controlled Light Switch

January 25, 2018

Raspberry Pi Python IDE Comparison

June 12, 2018

Friday Product Post: Power up your Pi!

August 17, 2018

Hackbot in the Morning

November 13, 2018

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado