As you can see here, the LEDs sit inside the button cavity and the two button contacts surround it. This allows for the nice frosted LED effect.
The LEDs are seperately controlled from the buttons - an Arduino or similar is required to read data from the buttons and then write out what LEDs to light up.
You can do one LED at a time, or all at once, its up to you and how experienced you are in soldering LEDs.
Bend the LED legs out so that the LEDs sit nice and flat against the PCB. Flip over the PCB so you can solder them in
Solder each and every LED leg. I like to do one LED at a time.
Clip the legs about 2-3mm from the PCB so the leads aren't flying everywhere
Till you are done with all of them
Luckily, we wrote a library that handles all the hard work for you, making it all very easy!
Download the Trellis Arduino library from our github repository by clicking this shiny button
Place the Adafruit_Trellis library folder your sketchbookfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. You can figure out your sketchbookfolder by opening up the Preferences tab in the Arduino IDE.If you're not familiar with installing Arduino libraries, please visit our tutorial: All About Arduino Libraries!
Connect the wires:
- 5V goes to the 5V power pin on the Arduino
- GND goes to and GND ground pin
- SCL goes to the I2C clock pin, on an Uno this is also known as A5
- SDA goes to the I2C data pin, on an Uno this is also known as A4
- We connect the INT interrupt pin to A2 - this pin isn't used in our demo code so you can leave it unconnected if you wish.
This sketch tests a single tile, with the default 0x70 address. It will light up all the LEDs in order and then turn them off. Then you can place the elastomer on top & press buttons to toggle buttons
The trellis example sketch shows you just about everything you can do with the Trellis library.
Each panel has its own named object called an Adafruit_Trellis, created like this:
Adafruit_Trellis matrix = Adafruit_Trellis();when you have many Adafruit_Trellis objects, we suggest creating a TrellisSet which will read all the buttons at once, write all the LEDs at once, etc. Each TrellisSet is given the names of the Adafruit_Trellis objects you created, up to 8.
Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0, &matrix1, &matrix2, &matrix3);When you call begin to start the Adafruit_TrellisSet object, pass in the addresses that correspond to your PCBs (see the next page on how to set addresses). The addresses range from 0x70 to 0x77
trellis.begin(0x70, 0x71, 0x72, 0x73); // or four!
You can set or clear LEDs with trellis.setLED(n) and trellis.clrLED(n) where n is the LED # from 0 to (number of Trellis')*16-1. So if you have 4 Trellis's in a set, thats 0 to 63
You can only turn LEDs on or off, there is no grayscale or PWM on this chip
When you are done setting and clearing LEDs you must call writeDisplay() to send the data to all the boards: trellis.writeDisplay() will write all Trellis PCBs in the set at once
You can also test if an LED is lit with trellis.isLED(n) - will return true if the LED is lit, and false if it isn't
You can read buttons by calling
trellis.readSwitches()It will return true if there has been any change in switches since the last time you called readSwitches(). So if some buttons were pressed and now aren't or vice versa, it will return true. If nothing's changed, it will return false
Once you've read the switches, you can query the TrellisSet about them.
If you'd like to know if a key #k (k is 0..(number of Trellis')*16-1) is currently pressed, call
isKeyPressed(k)If you want to know if there was a change in the button, you can ask if it's been pressed or released since the last call to readSwitches()
You can tile up to 8 Trellis PCBs together (see the next page for the mechanical connections of doing so)
Make sure each Trellis has a unique address ID!
Open up the TrellisTest sketch and change the following
Adafruit_Trellis matrix0 = Adafruit_Trellis();
add as many matrices as you like, each with a unique name, e.g.
Adafruit_Trellis matrix1 = Adafruit_Trellis();
Adafruit_Trellis matrix2 = Adafruit_Trellis();
Next we will make a set of matrices. Instead of
Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0);
update it to add up to 8 matrix names you defined. For example, 4 panels looks like:
Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0, &matrix1, &matrix2, &matrix3);
Change this number from 1 to whatever # you are addressing
// set to however many you're working with here, up to 8
#define NUMTRELLIS 1
Change the begin() call to add more addresses. Originally we only have the default 0x70 address:
trellis.begin(0x70); // only one
Change this to add all the addresses you are using:
trellis.begin(0x70, 0x71, 0x72, 0x73); // four!
That's it! Now your TrellisSet will know and control up to 8 panels.
To start with, its a good idea to assemble and test each individually so you know each Trellis works individually.
There's little nubs on the sides of some PCBs that keep them on the assembly panel, you can file them off with any file or sandpaper.
Arrange the tiles up the way you want, we'll start with two. Make sure the Adafruit logo is lined up the same.
Solder two blobs of solder on two adjacent finger pads.
Use your soldering iron to drag solder from one pad to another, with a little effort they'll stick together and make a connection. You can add more solder to make the connection stronger. Its still not mechanically strong - so be careful not to bend or shake the arrangement
Repeat for the other 4 fingers
Check that the panels are aligned by looking from the side, gently bend/reheat until they are nice and straight
You can add a little more mechanical stability by soldering the large front tabs as well
Each Trellis tile must have a unique address. You can set the addresses on the back of each panel using a little solder over the address jumpers.
The HT16K33 driver chip on the Trellis has a default I2C address of 0x70. Since each device on an I2C bus must have a unique address, its important to avoid collisions or you'll get a lot of strange responses from your electronic devices!
Luckily, the HT16K33 has 3 address adjust pins, so that the address can be changed. Each pin changes one binary bit of the address, so you can set the address to any of the following (in hex) 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77
The panels don't have to have consecutive address #'s, they just have to be unique.
For example, this Trellis has A0 shorted, the address is 0x71