SparkFun Qwiic Quad Solid State Relay Kit Hookup Guide

Favorited Favorite 0

Qwiic Relay Python Package

Note: This example assumes you are using the latest version of Python 3. If this is your first time using Python or I2C hardware on a Raspberry Pi, please checkout our tutorial on Python Programming with the Raspberry Pi and the Raspberry Pi SPI and I2C Tutorial.

We've written a Python package to control the Qwiic Relay family including the Quad Solid State Relay Kit. You can install the sparkfun-qwiic-relay Python package hosted by PyPi. However, if you prefer to manually download and build the libraries from the GitHub repository, you can grab them here (*Please be aware of any package dependencies. You can also check out the repository documentation page, hosted on Read the Docs.):


Note: Don't forget to double check that the hardware I2C connection is enabled on your Raspberry Pi or other single board computer.

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-relay package. On systems that support PyPi installation via pip3 (use pip for Python 2) is simple, using the following commands:

For all users (note: the user must have sudo privileges):

sudo pip3 install sparkfun-qwiic-relay

For the current user:

pip3 install sparkfun-qwiic-relay

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line (use python for Python 2):

python3 install

To build a package for use with pip3:

python3 sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip3.

cd dist
pip3 install sparkfun_qwiic_relay-<version>.tar.gz


This Python package has a few dependencies in the code, listed below:

from __future__ import print_function
import math
import qwiic_i2c

Function Overview

For a full overview of all the functions included with the Qwiic Relay Py package, head on over to the ReadtheDocs page.