Teenys Midi Controller How To Omit Unneeded Pots?

JJJ

Member
Hi!

I am going to make this Teensy midi controller I found on GitHub that consists of 7 potentiometers sending midi cc# values;

https://github.com/andr-ew/bleached/blob/master/firmware/bleached/bleached.ino

Just starting out, I only really need three potentiometers, not seven.

I might add more later, but for now just three to control what I need.

I am an absolute beginner with all of this, so sorry for the confusion!

It seems to connect all the grounds, but each unique Teensy pin it uses controls / does the actual work of controlling one of each of the pots.

My question is do I just connect the three potentiometer physically like the circuit dictates, or do I somehow need to connect seven some-type-of-connections to make the circuit work?

Thanks!
 
You have to connect each potentiometer with the middle pin to the corresponding pin on the Teensy which are defined starting in line 46. You can choose and change the pins there. The "left" pin of each pot for the lower position is connected to ground. Right pins go all to 3.3V.
 
Forum Rule: Always post complete source code & details to reproduce any issue! - so we don't need to go looking for what you might be looking at.
 
My question is do I just connect the three potentiometer physically like the circuit dictates, or do I somehow need to connect seven some-type-of-connections to make the circuit work?
You can just connect 3 of the 7 potmeters. However you do need to modify the original code such that it limits the analogRead's to the 3 connected potmeters. Otherwise it will send out garbage CC# data. Luckily modification is easy.

Here is the orginal schematic in PNG format:

bleached.jpg

Here is the modified code:
Code:
// https://forum.pjrc.com/threads/73730-Teenys-Midi-Controller-How-To-Omit-Unneeded-Pots
#define CC01  102
#define CC02  103
#define CC03  104

#define POT01 0
#define POT02 1
#define POT03 2

#define MIDI_CHANNEL 1
#define POT_BIT_RES         10 // 10 works, 7-16 is valid
#define POT_NUM_READS       32 // 32 works

uint16_t prev_pot_val[3] = {0xffff, 0xffff, 0xffff};
uint8_t pot[3] = {POT01, POT02, POT03};
uint8_t cc[3] = {CC01, CC02, CC03};
const uint8_t nbrhd = 5;
uint16_t loop_count = 0;

void setup() {
  analogReadResolution(POT_BIT_RES);
  analogReadAveraging(POT_NUM_READS);
}

void loop() {
  for (uint8_t i = 0; i < 3; i++) {
    uint16_t pot_val = analogRead(pot[i]);
    if ((pot_val < prev_pot_val[i] - nbrhd) ||
        (pot_val > prev_pot_val[i] + nbrhd)) {
      usbMIDI.sendControlChange(cc[i], pot_val >> (POT_BIT_RES - 7), MIDI_CHANNEL);
      prev_pot_val[i] = pot_val;
    }
  }
  while (usbMIDI.read()) {
  }
}

Another question: what Teensy are you planning to use? The Teensy LC and Teensy 3.2 are obsolete.

Paul
 
Oh man thanks for all of this great info!

I will spend the afternoon on this and see how far I get.

I am sorry about not quoting the code on there. I knew that was the protocol, but also was trying to figure out how to get both the code and the circuit-diagram, which in this case isn't a schematic but just a circuit-board.

Thanks for all of the kind and knowledgable help!!!
 
You can just connect 3 of the 7 potmeters. However you do need to modify the original code such that it limits the analogRead's to the 3 connected potmeters. Otherwise it will send out garbage CC# data. Luckily modification is easy.

Here is the orginal schematic in PNG format:

View attachment 32148

Here is the modified code:
Code:
// https://forum.pjrc.com/threads/73730-Teenys-Midi-Controller-How-To-Omit-Unneeded-Pots
#define CC01  102
#define CC02  103
#define CC03  104

#define POT01 0
#define POT02 1
#define POT03 2

#define MIDI_CHANNEL 1
#define POT_BIT_RES         10 // 10 works, 7-16 is valid
#define POT_NUM_READS       32 // 32 works

uint16_t prev_pot_val[3] = {0xffff, 0xffff, 0xffff};
uint8_t pot[3] = {POT01, POT02, POT03};
uint8_t cc[3] = {CC01, CC02, CC03};
const uint8_t nbrhd = 5;
uint16_t loop_count = 0;

void setup() {
  analogReadResolution(POT_BIT_RES);
  analogReadAveraging(POT_NUM_READS);
}

void loop() {
  for (uint8_t i = 0; i < 3; i++) {
    uint16_t pot_val = analogRead(pot[i]);
    if ((pot_val < prev_pot_val[i] - nbrhd) ||
        (pot_val > prev_pot_val[i] + nbrhd)) {
      usbMIDI.sendControlChange(cc[i], pot_val >> (POT_BIT_RES - 7), MIDI_CHANNEL);
      prev_pot_val[i] = pot_val;
    }
  }
  while (usbMIDI.read()) {
  }
}

Another question: what Teensy are you planning to use? The Teensy LC and Teensy 3.2 are obsolete.

Paul

Oh hey the Teensy 3.2, only because I bought one during Covid and intended to learn about this area of life, but then got too busy and it's stil sitting in it's box.
 
Just checked the code from message #4 on my home-made, Teensy LC-based MIDI controller. It uses 3pcs 10kΩ faders connected to analog inputs A0, A1 and A2.
All is looking fine:

MIDImonitor.png

Success with your build!
Paul
 
You can just connect 3 of the 7 potmeters. However you do need to modify the original code such that it limits the analogRead's to the 3 connected potmeters. Otherwise it will send out garbage CC# data. Luckily modification is easy.

Here is the orginal schematic in PNG format:

View attachment 32148

Here is the modified code:
Code:
// https://forum.pjrc.com/threads/73730-Teenys-Midi-Controller-How-To-Omit-Unneeded-Pots
#define CC01  102
#define CC02  103
#define CC03  104

#define POT01 0
#define POT02 1
#define POT03 2

#define MIDI_CHANNEL 1
#define POT_BIT_RES         10 // 10 works, 7-16 is valid
#define POT_NUM_READS       32 // 32 works

uint16_t prev_pot_val[3] = {0xffff, 0xffff, 0xffff};
uint8_t pot[3] = {POT01, POT02, POT03};
uint8_t cc[3] = {CC01, CC02, CC03};
const uint8_t nbrhd = 5;
uint16_t loop_count = 0;

void setup() {
  analogReadResolution(POT_BIT_RES);
  analogReadAveraging(POT_NUM_READS);
}

void loop() {
  for (uint8_t i = 0; i < 3; i++) {
    uint16_t pot_val = analogRead(pot[i]);
    if ((pot_val < prev_pot_val[i] - nbrhd) ||
        (pot_val > prev_pot_val[i] + nbrhd)) {
      usbMIDI.sendControlChange(cc[i], pot_val >> (POT_BIT_RES - 7), MIDI_CHANNEL);
      prev_pot_val[i] = pot_val;
    }
  }
  while (usbMIDI.read()) {
  }
}

Another question: what Teensy are you planning to use? The Teensy LC and Teensy 3.2 are obsolete.

Paul

I too found the same code referenced and would like to give this a try, but I do not have a Teensy LC/3.2. Do you know, what other Teensy board that is currently available would this code run on without issues?

Thanks in advance
 
An except from the code above:

// Map MIDI CC channels to knobs numbered left to right.
#define CC01 102
#define CC02 103
#define CC03 104
#define CC04 105
#define CC05 106
#define CC06 107
#define CC07 108

I take it that, for instance, CC01 is a CC Number and 102 would be the knob number which it is mapped to?

Cheers
 
No, "#define CC01 102" means the software sends out CC control number 102. The corresponding value is detemined by the potmeter.
"uint8_t cc[3] = {CC01, CC02, CC03};" is equal to "uint8_t cc[3] = {102, 103, 104};"
"usbMIDI.sendControlChange(cc, pot_val >> (POT_BIT_RES - 7), MIDI_CHANNEL);" sends out the three CC messages.
The 3-byte MIDI messages would look like "0xB0, 102, value", "0xB0, 103, value" & "0xB0, 104, value" (assuming channel 1).
See here for more detail.

Paul
 
Back
Top