Qwiic HAT for Raspberry Pi Hookup Guide

Contributors: Englandsaurus
Favorited Favorite 0


This Qwiic HAT for Raspberry Pi is 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 HAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors. It also has a few important pins on the Raspberry Pi broken out for easy access. 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!

SparkFun Qwiic HAT for Raspberry Pi


Required Materials

To follow along with this hookup guide, you will need any Raspberry Pi with 2x20 male headers.

Raspberry Pi 3


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

Raspberry Pi GPIO Male Header - 2x20

Raspberry Pi Zero W


Now you probably didn’t buy the Qwiic HAT 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.

SparkFun Environmental Combo Breakout - CCS811/BME280 (Qwiic)

SparkFun Spectral Sensor Breakout - AS7262 Visible (Qwiic)

SparkFun GPS Breakout - XA1110 (Qwiic)

SparkFun Qwiic Adapter


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

Qwiic Cable - 500mm

Qwiic Cable - 100mm

Qwiic Cable - 200mm

Qwiic Cable - 50mm


Required Setup Tools

As a desktop, these devices are required:

Suggested Reading

If you aren’t familiar with our new Qwiic system, we recommend reading here for an overview. We would also recommend taking a look at the following tutorials if you aren’t familiar with them.


An introduction to I2C, one of the main embedded communications protocols in use today.

Hardware Overview

The Qwiic HAT has 4 Qwiic connect ports, all on the same I2C bus. In addition to this, some of the pins on the Raspberry Pi are broken out for the user.

Top View of Qwiic Hat

Hardware Assembly

To get started with your Qwiic HAT, simply plug it into the headers on the Raspberry Pi, make sure that the “USB” arrow on the HAT is pointing towards the USB on the Raspberry Pi.

alt text

Once the HAT is plugged in, you can start plugging in any Qwiic enabled sensors you might have.

alt text

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 Rasbpian 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.

>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

>ls /dev/*i2c*

The Pi should respond with


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.

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 HAT is connected to.

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:

Now that you have your Qwiic HAT ready to go, it’s time to check out some of SparkX’s Qwiic enabled products, many of which are on their way to becoming good old fashioned SparkFun products.

Qwiic Magnetometer - MLX90393


Qwiic Water-Resistant OLED


But I Already Have Sensors!

If you already have a handful of SparkFun sensors and parts? SparkFun has been putting our standard GND/VCC/SDA/SCL pinout on all our I2C boards for many years. This makes it possible to attach a Qwiic Adapter that will get your SparkFun I2C sensor or actuator onto the Qwiic system.

Here is the list of the boards that have the standard I2C pinout and will work with the Qwiic adapter board:

Check out this related tutorial:

Raspberry Pi SPI and I2C Tutorial

October 29, 2015

How to use the serial buses on your Raspberry Pi.