0

Mini Untztrument and Trellis Issues
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Mini Untztrument and Trellis Issues

by bkoray on Mon May 17, 2021 8:43 pm

I'm working on making a mini UNTZtrument with Arduino Leonardo, following this guideline: https://learn.adafruit.com/mini-untztru ... components

I prepared all the components based on the instructions; however, when I upload the example code provided on "prep-component" page (test example for the Adafruit Trellis w/HT16K33), none of the leds mounted on the trellis board functions. I believe all the required libraries are installed in the right place. I have tried bunch of different versions of Arduino IDE, but there is no luck. I'm using version 1.8.12 currently, and ensuring Tools > Board > Arduino Leonardo is selected and programmer is set to USBTinyISP. Here is the code just in case:

Code: Select all | TOGGLE FULL SIZE
/***************************************************
  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();
    }
  }
}


My first thought was that there might be a problem with soldering, or an issue with trellis board. However, then I decided to try using Arduino Uno as described in here: https://learn.adafruit.com/adafruit-trellis-diy-open-source-led-keypad/connecting. The TrellisTest example worked like a charm. And that is the same exact code that I copied above.

Then, I decided to follow the rest of the instructions for building Mini Untztrument, https://learn.adafruit.com/mini-untztrument-3d-printed-midi-controller/software, installed Teensyduino (Version 1.53), and managed to install TeeOnArdu from the Boards Manager. Then I uploaded this code to Arduino Leonardo using Board: Leo on TeensyCore and Usb Type: MIDI under tools menu. I tested the midi messages on this website https://www.onlinemusictools.com/webmiditest/, 4 potentiometers functions perfectly; however trellis still doesn't function at all. Could you please help me figure out what's wrong? I read anything that I could find online that is related to Mini Untztrument/Trellis, and tried various combinations of different Arduino IDE and Teensyduino versions on both Windows and Macos running computers.

Thanks in advance,
Koray

bkoray
 
Posts: 5
Joined: Mon May 17, 2021 7:30 pm

Re: Mini Untztrument and Trellis Issues

by adafruit_support_mike on Tue May 18, 2021 6:50 am

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 63134
Joined: Thu Feb 11, 2010 2:51 pm

Re: Mini Untztrument and Trellis Issues

by bkoray on Tue May 18, 2021 2:56 pm

Thanks for the reply! Here are some photos, let me know if you want me to focus on a specific part.

IMG_7621-min.jpg
IMG_7621-min.jpg (891.91 KiB) Viewed 594 times

IMG_7622-min.jpg
IMG_7622-min.jpg (628.01 KiB) Viewed 594 times

IMG_7623-min.jpg
IMG_7623-min.jpg (653.11 KiB) Viewed 594 times

bkoray
 
Posts: 5
Joined: Mon May 17, 2021 7:30 pm

Re: Mini Untztrument and Trellis Issues

by adafruit_support_mike on Tue May 18, 2021 8:04 pm

Try running an I2C scanner and see if the Leonardo sees the HT16K33's address:

https://playground.arduino.cc/Main/I2cScanner/

It should see a device at address 0x70

adafruit_support_mike
 
Posts: 63134
Joined: Thu Feb 11, 2010 2:51 pm

Re: Mini Untztrument and Trellis Issues

by bkoray on Sun May 23, 2021 8:34 pm

Thanks for your reply Mike, I was away from my equipment for the last couple days, I just had a chance to try running I2C scanner by following instructions on the link you shared. Unfortunately no I2C device was found, here are the details:

i2c_scanner ss.jpg
i2c_scanner ss.jpg (282.34 KiB) Viewed 568 times


Why do you think this is the case?

Thanks,
Koray

bkoray
 
Posts: 5
Joined: Mon May 17, 2021 7:30 pm

Re: Mini Untztrument and Trellis Issues

by adafruit_support_mike on Wed May 26, 2021 2:59 pm

That’s either a connection problem or a device failure on one side or the other.

Do you have any other I2C devices you can connect to make sure the Leonardo’s I2C is working?

adafruit_support_mike
 
Posts: 63134
Joined: Thu Feb 11, 2010 2:51 pm

Re: Mini Untztrument and Trellis Issues

by bkoray on Fri May 28, 2021 12:37 pm

Thanks for the suggestion Mike. I went ahead and tried using SparkFun Qwiic MicroPressure Sensor https://www.sparkfun.com/products/16476. In order to verify that the i2c sensor is functional, I used it with Arduino Uno, SparkFun RedBoard, and Arduino Leonardo respectively.

I used the following example code with all the boards:
Code: Select all | TOGGLE FULL SIZE
/*
  Basic test of the Qwiic MicroPressure Sensor
  By: Alex Wende
  SparkFun Electronics
  Date: July 2020
  License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
  Feel like supporting our work? Buy a board from SparkFun!
  https://www.sparkfun.com/products/16476
 
  This example demonstrates how to get started with the Qwiic MicroPressure Sensor board, and read pressures in various units.
*/

// Include the SparkFun MicroPressure library.
// Click here to get the library: http://librarymanager/All#SparkFun_MicroPressure

#include<Wire.h>
#include <SparkFun_MicroPressure.h>

/*
 * Initialize Constructor
 * Optional parameters:
 *  - EOC_PIN: End Of Conversion (defualt: -1)
 *  - RST_PIN: Reset (defualt: -1)
 *  - MIN_PSI: Minimum Pressure (default: 0 PSI)
 *  - MAX_PSI: Maximum Pressure (default: 25 PSI)
 */
//SparkFun_MicroPressure mpr(EOC_PIN, RST_PIN, MIN_PSI, MAX_PSI);
SparkFun_MicroPressure mpr; // Use default values with reset and EOC pins unused

void setup() {
  // Initalize UART, I2C bus, and connect to the micropressure sensor
  Serial.begin(115200);
  Wire.begin();

  /* The micropressure sensor uses default settings with the address 0x18 using Wire.

     The mircropressure sensor has a fixed I2C address, if another address is used it
     can be defined here. If you need to use two micropressure sensors, and your
     microcontroller has multiple I2C buses, these parameters can be changed here.

     E.g. mpr.begin(ADDRESS, Wire1)

     Will return true on success or false on failure to communicate. */
  if(!mpr.begin())
  {
    Serial.println("Cannot connect to MicroPressure sensor.");
    while(1);
  }
}

void loop() {
  /* The micropressure sensor outputs pressure readings in pounds per square inch (PSI).
     Optionally, if you prefer pressure in another unit, the library can convert the
     pressure reading to: pascals, kilopascals, bar, torr, inches of murcury, and
     atmospheres.
   */
  Serial.print(mpr.readPressure(),4);
  Serial.println(" PSI");
  Serial.print(mpr.readPressure(PA),1);
  Serial.println(" Pa");
  Serial.print(mpr.readPressure(KPA),4);
  Serial.println(" kPa");
  Serial.print(mpr.readPressure(TORR),3);
  Serial.println(" torr");
  Serial.print(mpr.readPressure(INHG),4);
  Serial.println(" inHg");
  Serial.print(mpr.readPressure(ATM),6);
  Serial.println(" atm");
  Serial.print(mpr.readPressure(BAR),6);
  Serial.println(" bar");
  Serial.println();
  delay(500);
}


I used A4 (SDA) and A5 (SCL) on the Arduino Uno, it worked perfectly.
01-Arduino Uno.png
01-Arduino Uno.png (779.94 KiB) Viewed 474 times


The code and sensor worked perfectly with SparkFun RedBoard as well, this time I used the SDA and SDC pins.
02-SparkFun RedBoard.png
02-SparkFun RedBoard.png (867.21 KiB) Viewed 474 times


However, I couldn't read anything with serial monitor when I tried same procedure by using Arduino Leonardo.
03-Arduino Leonardo.png
03-Arduino Leonardo.png (855.09 KiB) Viewed 474 times


Do you have any solution for this, or there is something wrong with my Arduino Leonardo board, and it needs to be replaced?

Thanks,
Koray

bkoray
 
Posts: 5
Joined: Mon May 17, 2021 7:30 pm

Re: Mini Untztrument and Trellis Issues

by adafruit_support_mike on Fri May 28, 2021 5:55 pm

It does sound like there’s a problem with the Leonardo’s I2C on the pins nearest the USB jack.

IIRC, the Leonardo uses digital pins 2 and 3 for I2C. You can check with a multimeter to see if those pins are connected to the SDA/SCL pins near the USB jack.

If so, see if you can get an I2C connection from pins 2 and 3, or can get those pins to do anything else.

adafruit_support_mike
 
Posts: 63134
Joined: Thu Feb 11, 2010 2:51 pm

Re: Mini Untztrument and Trellis Issues

by bkoray on Sat Jun 12, 2021 10:13 am

Thanks a lot for the suggestion Mike! I didn't a multimeter available at my place, so it is something to try later when I have a chance.

Meanwhile, I went ahead and tried using digital pins 2 and 3 for I2C and it worked like a charm. It was interesting though, when I test the midi connectivity with the website that posted earlier (https://www.onlinemusictools.com/webmiditest), there is no sign of receiving incoming midi messages neither from 4x4 buttons nor from knobs. However, I could definitely send midi messages from the Mini Untztrument to the computer when I tried using Ableton Live. So, anybody reading these posts can ignore the use of webmiditest to test the midi connectivity in this context.

Once more, thanks again for your patience and support Mike!
Koray

bkoray
 
Posts: 5
Joined: Mon May 17, 2021 7:30 pm

Re: Mini Untztrument and Trellis Issues

by adafruit_support_mike on Mon Jun 14, 2021 5:15 pm

Glad to hear you have things working in general. Happy hacking!

adafruit_support_mike
 
Posts: 63134
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.