Prep Components

Insert 3mm LEDs to Trellis

Secure the Trellis PCB to a panavise jr. or third helping hand. With the top of the facing up, insert the 3mm LED into the Trellis PCB with the longer leg going into the +positive pin. Bend the legs apart to secure the LED in place.
Make sure to triple check the polarity of the LEDs!

Solder LEDs to Trellis

Flip the Trellis over with the back side facing up. The LEDs should be secured in place. If not, make sure they are! Solder the 16 LEDs to the Trellis PCB.

Trim Trellis LEDs

Use flush diagonal cutters to trim the excess terminals of the LEDs.

Male Jumper Wires

Grab 4 different colored male jumper wires and remove the plastic part from the one end of all 4 jumper wires. Trim off half of the exposed terminal, leaving just a small portion.

Tin Trellis PCB

Tin the GND, SLC, SDA and 5V pads on Trellis PCB. There are four different groups of each, it doesn't matter which one as long as they are in the same group. In this project, we're using the one closest to the Adafruit logo.

Solder Wires to Trellis PCB

Use a panavise Jr. to secure the Trellis PCB. Solder the 4 male jumper wires to the GND, SCL, SDA and 5V pads on the Trellis PCB.

File Trellis Edges

In order to fit the Trellis into the tray, you will need to file down the edges to remove this excess material. There's two small parts on each side.

10k Potentiometers

Bend the three terminals on each of the 10k potentiometers like in the photo.

Remove 'stubs' from Pots

A small metal 'stub' on top of the base prevents the potentiometer from being flush with the cover. Remove this metal tip by bending it off with flat pliers.

Add Pots to Enclosure Cover

Install the four potentiometers to the mini-oontz-cover.stl part with the knob facing the printed surface of the cover. They should pop into place. If the tolerance are too tight, use an x-acto knife or dremel to open up the mounting holes.

Secure Cover with Pots

You'll need to wire up the 4 pots so they share common ground and 5V. Use a panavise jr. to secure the mini-oontz-cover.stl part that has the 4 pots installed.

Wire common ground and 5V on Pots

Use 22AWG solid core wire to connect the common ground and 5V on the 4 pots together in series. Use a third-helping hand to secure the 22 gauge wire close to the pot terminal leads and solder in place.

Solder Jumper Wires to Pots

Solder one jumper wire to each of the middle terminals of the 4 potentiometers. This makes it easier to arrange and connect the wires.

Connect Trellis to Leonardo

Hook up the jumper wires on the trellis to the headers on the Leonardo to make the following connections:
  • SCL to SCL
  • SDA to SDA
  • GND to GND
  • 5V to 5V

Test Trellis

With the Trellis connect to the Leonardo, you can now upload a test sketch to check the polarity of the LEDs are all good. Copy + Paste the code below into a new sketch. Select Tools > Board > Arduino Leonardo in the top menu. Ensure programmer is set to USBTinyISP. Plug a USB micro cable into the Leonardo and connect it to the USB port of your computer, then hit the upload arrow button.
Install Trellis Arduino Library before uploading code.
Download: file
/*************************************************** 
  This is a test example for the Adafruit Trellis w/HT16K33

  Designed specifically to work with the Adafruit Trellis 
  ----> https://www.adafruit.com/products/1616
  ----> https://www.adafruit.com/products/1611

  These displays use I2C to communicate, 2 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include "Adafruit_Trellis.h"

/*************************************************** 
  This example shows reading buttons and setting/clearing buttons in a loop
  "momentary" mode has the LED light up only when a button is pressed
  "latching" mode lets you turn the LED on/off when pressed

  Up to 8 matrices can be used but this example will show 4 or 1
 ****************************************************/

#define MOMENTARY 0
#define LATCHING 1
// set the mode here
#define MODE LATCHING 


Adafruit_Trellis matrix0 = Adafruit_Trellis();

// uncomment the below to add 3 more matrices
/*
Adafruit_Trellis matrix1 = Adafruit_Trellis();
Adafruit_Trellis matrix2 = Adafruit_Trellis();
Adafruit_Trellis matrix3 = Adafruit_Trellis();
// you can add another 4, up to 8
*/

// Just one
Adafruit_TrellisSet trellis =  Adafruit_TrellisSet(&matrix0);
// or use the below to select 4, up to 8 can be passed in
//Adafruit_TrellisSet trellis =  Adafruit_TrellisSet(&matrix0, &matrix1, &matrix2, &matrix3);

// set to however many you're working with here, up to 8
#define NUMTRELLIS 1

#define numKeys (NUMTRELLIS * 16)

// Connect Trellis Vin to 5V and Ground to ground.
// Connect the INT wire to pin #A2 (can change later!)
#define INTPIN A2
// Connect I2C SDA pin to your Arduino SDA line
// Connect I2C SCL pin to your Arduino SCL line
// All Trellises share the SDA, SCL and INT pin! 
// Even 8 tiles use only 3 wires max


void setup() {
  Serial.begin(9600);
  Serial.println("Trellis Demo");

  // INT pin requires a pullup
  pinMode(INTPIN, INPUT);
  digitalWrite(INTPIN, HIGH);
  
  // begin() with the addresses of each panel in order
  // I find it easiest if the addresses are in order
  trellis.begin(0x70);  // only one
  // trellis.begin(0x70, 0x71, 0x72, 0x73);  // or four!

  // light up all the LEDs in order
  for (uint8_t i=0; i<numKeys; i++) {
    trellis.setLED(i);
    trellis.writeDisplay();    
    delay(50);
  }
  // then turn them off
  for (uint8_t i=0; i<numKeys; i++) {
    trellis.clrLED(i);
    trellis.writeDisplay();    
    delay(50);
  }
}


void loop() {
  delay(30); // 30ms delay is required, dont remove me!
  
  if (MODE == MOMENTARY) {
    // If a button was just pressed or released...
    if (trellis.readSwitches()) {
      // go through every button
      for (uint8_t i=0; i<numKeys; i++) {
	// if it was pressed, turn it on
	if (trellis.justPressed(i)) {
	  Serial.print("v"); Serial.println(i);
	  trellis.setLED(i);
	} 
	// if it was released, turn it off
	if (trellis.justReleased(i)) {
	  Serial.print("^"); Serial.println(i);
	  trellis.clrLED(i);
	}
      }
      // tell the trellis to set the LEDs we requested
      trellis.writeDisplay();
    }
  }

  if (MODE == LATCHING) {
    // If a button was just pressed or released...
    if (trellis.readSwitches()) {
      // go through every button
      for (uint8_t i=0; i<numKeys; i++) {
        // if it was pressed...
	if (trellis.justPressed(i)) {
	  Serial.print("v"); Serial.println(i);
	  // Alternate the LED
	  if (trellis.isLED(i))
	    trellis.clrLED(i);
	  else
	    trellis.setLED(i);
        } 
      }
      // tell the trellis to set the LEDs we requested
      trellis.writeDisplay();
    }
  }
}

Confirm LEDs are working on Trellis

TrellisTest Sketch

If everything is correct (trellis arduino libraries installed in the right place, polarity of LEDs, etc), you should see a short animation sequence of the LED's lighting up. As the comments note: This example shows reading buttons and setting/clearing buttons in a loop "momentary" mode has the LED light up only when a button is pressed "latching" mode lets you turn the LED on/off when pressed.
This guide was first published on Jul 30, 2014. It was last updated on Jul 30, 2014. This page (Prep Components) was last updated on Sep 15, 2019.