The examples in this guide are no longer supported. Please check out the Introducing Adafruit Trellis guide for CircuitPython and Python usage:


To install the Trellis python library on the Raspberry Pi follow these steps:
  • Make sure python 2.7 is installed on your Raspberry Pi. If you're using the Raspbian or Occidentalis operating system python should already be installed. However if you aren't sure, run the command 'python --version' (without quotes) at a terminal and look for an output like 'Python 2.7.3'.
  • If it isn't already enabled, follow this guide for information on setting up I2C on your Raspberry Pi.
  • Download the Adafruit Raspberry Pi Python code repository to your Raspberry Pi by following this guide.
  • Download the Trellis python library to the Raspberry Pi and unzip the archive. You can execute these commands to do both:
  • Install the library by navigating to the folder and executing
cd Adafruit_Trellis_Python-master
sudo python install
  • Note: For any python script you create to use Trellis, copy the file from the Adafruit Raspberry Pi Python code download into the same folder as your python script. Don't skip this needs to be in the same directory as your script or else the Trellis python library will fail to load!


The Raspberry Pi has one I2C bus on it's main GPIO header. This page has a great description of all the GPIO header pins, but as a summary you can use:

  • P1 pin 5 for SCL
  • P1 pin 3 for SDA

Connect Trellis power and ground to the Pi 5V power and ground pins respectively (P1 pin 2 or 4 for power, and P1 pin 6 for ground).

If you're using the Trellis INT wire as a key press interrupt, connect it to any digital GPIO pin on the Raspberry Pi. The Trellis python library doesn't use the interrupt pin directly, so you'll want to monitor the pin yourself in your code.

Finally to check the Trellis is detected and confirm which I2C bus it's on (different revisions of the Raspberry Pi have different I2C bus numbers), run these commands to probe each I2C bus:
sudo i2cdetect -y -r 0
sudo i2cdetect -y -r 1
Trellis should be devices detected at addresses starting with 70, like 70, 71, 72, etc.

This guide was first published on Feb 13, 2014. It was last updated on Mar 08, 2024.

This page (Raspberry Pi) was last updated on Mar 08, 2024.

Text editor powered by tinymce.