Python Installation

Before you begin you'll need to have a fully set up Raspberry Pi computer with internet connectivity.

You can use any Raspberry Pi computer with a 2x20 connector such as a Pi 3, Pi 2, Pi A+, Zero or Zero W, etc.

Install Adafruit-Blinka, Enable I2C

We have a full guide on installing Adafruit-Blinka and enabling I2C, including CircuitPython tests. The short instructions are below:

Update OS to latest with:

  • sudo apt-get update

  • sudo apt-get upgrade

  • sudo reboot

Enable I2C following this guide. Don't forget to reboot afterwards.

Make sure you are running Python3. Python2 is installed on many Linux computers, but Python3 is required!

  • sudo apt-get install -y python3 git python3-pip
  • sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
  • sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
  • sudo update-alternatives --config python

Then install the needed CRICKIT Python 3 libraries with

pip3 install RPI.GPIO adafruit-blinka

Power off & Install HAT

Shutdown the Pi safely with sudo shutdown -h now and install the HAT as shown. There's an extra long header standoff that goes between the Pi headers and the HAT. Make sure they are lined up correctly - Plugging in the HAT wrong can damage your Pi permanently!

Start the pi up again and open a terminal window if you boot to graphics mode.

On the command line, install I2C tools so you get the detect program with sudo apt-get install -y i2c-tools

Now scan for I2C to see that the Crickit is found with i2cdetect -y 1

If you get an error Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory - Enable I2C following this guide. Don't forget to reboot afterwards.

Note that you should be able to see the i2c address 0x49 appear even if the power switch on the HAT is off, or if no power is plugged into the DC jack.

If the i2c address doesn't appear, try clicking the reset button on the HAT once, to reset it, and try again.

Install Crickit library

We will use our Crickit library to make easy work of motors and sensor readings, install it with

pip3 install adafruit-circuitpython-crickit

You can test that your software installed properly by running Python 3 and entering these commands

Download: file
from adafruit_crickit import crickit
print(crickit.touch_1.value)
print(crickit.touch_1.value)

Between the second and third command, touch your finger to the first Capacitive Touch pad on the HAT.

 

If the value changes like in the screen shot below, it's working!

This guide was first published on Dec 14, 2018. It was last updated on Dec 14, 2018. This page (Python Installation) was last updated on Dec 14, 2019.