Arduino Code

Wiring is easy, solder the four VIN GND SDA SCL pads to wires and then connect to your Arduino compatible:

  • VIN to 5V (or 3.3V if 5V is not available)
  • GND to GND
  • SDA to I2C data SDA
  • SCL to I2C clock SCL

Install Arduino Libraries

Lets begin by installing all the libraries we need. Open up the library manager in Arduino IDE

Search for and install the latest version of the Adafruit seesaw library

Basic Example

Start by opening up the NeoTrellis -> basic under the Adafruit Seesaw library:

And upload it to your board!

You will see all the LEDs run a pattern in a color gradient. Then once the pattern is done, pressing any key will cause the led underneath to light up. Releasing the key will turn the LED off.

Using the Interrupt Pin

The pad labeled INT on the NeoTrellis board will be pulled LOW when an event the user has subscribed to is detected. To test this functionality, solder a wire to any of the four pads labeled INT and connect that to a digital pin on your host microcontroller board. 

Use the same wiring from before, but this time connect INT to digital pin #10 (you can change this later)

Open up the NeoTrellis -> interrupt under the Adafruit Seesaw library and upload to your board.

The behavior is identical to the basic example, but the INT pin is used instead of polling the NeoTrellis for new data. This frees up more time for your host microcontroller to do other things!

Tiling multiple NeoTrellis boards

Multiple NeoTrellis boards can be tiled together for a larger grid of buttons and lights without taking up any extra pins on your host microcontroller!

To do this, lay the boards you wish to connect side by side in the desired arrangement so that the pins match up. Then solder them together and set the unique I2C address on the back with solder jumpers

The alignment of the boards does matter! The pad marked '1' should always be in the top lefthand corner.

The base I2C address for the NeoTrellis board is 0x2E and to calculate the selected I2C address for a given jumper configuration use this formula:

Addr = 0x2E + (1*A0) + (2*A1) + (4*A2) + (8*A3) + (16*A4)

Where each A term is 1 if the jumper is soldered, and 0 if it is not. For example, if only the A0  jumper is soldered, the I2C address would be 0x2E + 1 = 0x2F. If both the A0 and A1 jumper were soldered, the address would be 0x2E + 1 + 2 = 0x31.

Once your boards are connected and your I2C addresses selected, load up the NeoTrellis -> multitrellis -> basic example from the Adafruit Seesaw library.

Change the definitions and variables at the top of the file to match your current configuration:

Download: file
#define Y_DIM 4 //number of rows of key
#define X_DIM 8 //number of columns of keys

//create a matrix of trellis panels
Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {

    { Adafruit_NeoTrellis(0x2E), Adafruit_NeoTrellis(0x2F) }

};

The above code works for two NeoTrellis boards connected side by side. If you were using a 2x2 array of boards, the above lines would be:

Download: file
#define Y_DIM 8 //number of rows of key
#define X_DIM 8 //number of columns of keys

//create a matrix of trellis panels
Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {

    { Adafruit_NeoTrellis(0x2E), Adafruit_NeoTrellis(0x2F) },

    {Adafruit_NeoTrellis(YOUR_ADDR), Adafruit_NeoTrellis(YOUR_ADDR2)}

};
This guide was first published on Sep 20, 2018. It was last updated on Sep 20, 2018.
This page (Arduino Code) was last updated on Jul 13, 2020.