The best tools to make your project dreams come true

Login or Signup

By Sparkfun Electronics

Qwiic pHAT for Raspberry Pi Hookup Guide

Courtesy of SparkFun


This Qwiic pHAT for Raspberry Pi is based on the Qwiic Hat. The board adds the quickest and easiest way to utilize SparkFun's Qwiic ecosystem while still using that Raspberry Pi that you've come to know and love. This Qwiic pHAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors. Since the Qwiic system allows for daisy chaining (as long as your devices are on different addresses), you can stack as many sensors as you'd like to create a tower of sensing power!


Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read the guide, and adjust the cart as necessary.

Single Board Computer

You will need Raspberry Pi with 2x20 male headers installed.

  • Raspberry Pi 3 B+

A Pi Zero W will also work but you will need to make sure to solder some male headers to it.

Or you could stack it on any single board computer (like the NVIDIA Jetson Nano) that utilizes the 40-pin Raspberry Pi header footprint.

Qwiic Board

Now you probably didn't buy the Qwiic pHAT if you didn't have any Qwiic products to use with it, right? If you don't have any Qwiic products, the following might not be a bad place to start.

Finally, you'll need our handy Qwiic cables to easily connect sensors to your Qwiic pHAT. Below are a few options.

Required Setup Tools

As a desktop, these devices are required:

  • USB Mouse
  • USB Keyboard
  • HDMI monitor/TV/adapted VGA
  • 5V Power Supply

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

1_ Qwiic-Connect-System

We would also recommend taking a look at the following tutorials if you aren't familiar with them.

  • I2C: An introduction to I2C, one of the main embedded communications protocols in use today.
  • Serial Terminal Basics: This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Hardware Overview

The Qwiic pHAT has 4x Qwiic connect ports, all on the same I2C bus. A 3.3V regulator is included to regulate voltage down for any Qwiic boards connected.


There are built-in pull-up resistors on board. If necessary, you can cut the traces to disable depending on the number of boards connected to the I2C bus.


Hardware Assembly

To get started with your Qwiic pHAT, simply plug it into the headers on the Raspberry Pi with the letters facing you.


Once the pHAT is plugged in, you can start plugging in any Qwiic enabled sensors you might have on either side.


Depending on your project, you can mount a qwiic enabled board on the mounting holes using standoffs.


Note: The Qwiic pHat is also compatible with single board computers (like the NVIDIA Jetson Nano or the Google Coral) that utilize the 40-pin Raspberry Pi header footprint.


           Qwiic pHat on Jetson                                                Qwiic pHat on Google Coral

Note: When placing a Raspberry Pi and the pHat in an enclosure (like the Pi Tin), we noticed that the pHAT was not fully inserted in Pi's header pins. You will need an additional stackable header for a secure connection depending on your enclosure. Otherwise, the original Qwiic HAT would be better if you need to use the boards in an enclosure.

Note: When placing a Raspberry Pi and the pHat in an enclosure (like the Pi Tin), we noticed that the pHAT was not fully inserted in Pi's header pins. You will need an additional stackable header for a secure connection depending on your enclosure.

I2C on Raspberry Pi

OS and Library Install

If you're starting from scratch, with a blank microSD card, you'll want to install Raspbian. If you've already got a working Raspbian system, skip ahead to step 3.

  1. Download the NOOBS image. As of this writing, it's at version 2.4.4.
  2. Follow the official installation instructions.
  3. Follow the Wiring Pi Instructions to get git, update and upgrade your Raspbian packages, then install WiringPi.

Be patient -- each of these steps takes a while.

Once you've got wiringPi installed, run the gpio commands shown below.

Copy Code
>gpio -v
>gpio readall

It should respond with some information about the wiringPi version and the Pi that its running on, then draw a table illustrating the configuration for the pins in the 40-pin connector.


Like the SPI peripheral, I2C is not turned on by default. Again, we can use raspi-config to enable it.

  1. Run sudo raspi-config.
  2. Use the down arrow to select 5 Interfacing Options.
  3. Arrow down to P5 I2C.
  4. Select yes when it asks you to enable I2C.
  5. Select OK and then Finish.

Once you return to terminal, enter this command:

Copy Code
>ls /dev/*i2c*

The Pi should respond with:

Copy Code

Which represents the user-mode I2C interface.


There is a set of command-line utility programs that can help get an I2C interface working. You can get them with the apt package manager.

Copy Code
sudo apt-get install -y i2c-tools

In particular, the i2cdetect program will probe all the addresses on a bus, and report whether any devices are present. Call i2cdetect -y 1 to probe the first I2C bus, which is what the Qwiic pHAT is connected to.

Copy Code
pi@raspberrypi:~/$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

This map indicates that there is a peripheral at address 0x60. We can read and write its registers using the i2cget, i2cset and i2cdump commands.

Resources and Going Further

For more information, check out the resources below:

Key Parts and Components

Add all Digi-Key Parts to Cart
  • 1568-DEV-15351-ND
  • 1568-1675-ND
  • 1568-1706-ND
  • 1568-1742-ND
  • 1568-1741-ND
  • 1568-1785-ND
  • 1568-1711-ND
  • 1568-1713-ND
  • 1568-1712-ND
  • 1568-1710-ND
  • 1597-1457-ND
  • 1568-1783-ND
  • 1568-1743-ND
  • 1568-1784-ND
  • 1568-1880-ND