SparkFun Auto pHAT Hookup Guide

Contributors: santaimpersonator
Favorited Favorite 0

Software Configuration

Enable the I2C Bus

Configuring an OS for the Auto pHAT is relatively simple; the I2C interface will need to be enabled.

Nvidia Jetson

The I2C bus on the Nvidia Jetson is enabled by default; no configuration is necessary.

Raspberry Pi

On the Raspberry Pi, this is easily accomplished within the Raspberry Pi PIXEL desktop. Using the graphical Raspberry Pi Configuration application from the Preferences menu will be the most user friendly option. Users can also make changes through the console based raspi-config application.

configuration app

Raspberry Pi Configuration application. (Click to enlarge)

raspi-config tool

From the Interfaces tab, enable the I2C interface. (Click to enlarge)

Once done, click the OK button. Reboot the Raspberry Pi when prompted.

Install the Python Packages

Note: This tutorial 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 packages to easily get setup and utilize the Auto pHAT. There are two methods for installing the Python packages:

  1. Install the all inclusive SparkFun Qwiic Python package.
  2. Independently install the various Python packages:
    • pi-servo-hat
      • sparkfun-qwiic-pca9685
    • sparkfun-qwiic-scmd
    • sparkfun-qwiic-dual-encoder-reader
    • sparkfun-qwiic-icm20948

The all inclusive SparkFun Qwiic Python package, is recommended as is also installs the required I2C driver as well.

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

SparkFun Qwiic Package

This repository is hosted on PyPi as the sparkfun-qwiic 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

For the current user:

pip3 install sparkfun-qwiic

Upgrading the Python Package

In the future, changes to the Python package might be made. Updating the installed packages has to be done individually for each package (i.e. sub-modules and dependencies won't update automatically and must be updated manually). For example, with the sparkfun-qwiic-scmd Python package use the following command (use pip for Python 2):

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

sudo pip3 install --upgrade sparkfun-qwiic-scmd

For the current user:

pip3 install --upgrade sparkfun-qwiic-scmd