DIY: OT Pickup Machine footswitch (now with final pics!)

debouncing is/can be something needed with most of the switches out there. it can be achieved either in software or hardware, depending on the needs and the way it is handled can vary depending on the switch used as each switch is different from another and could ‘bounce’ more or less than another. although a simple delay does help in reducing the risk of wrong readings, it is not always enough to make sure that things work as expected.
there’re few articles on the subject which can help find the best solution for a specific cirtcuit/switch. for simple code that is supposed to read few switches, adding a belay between each read should be ok, but one has to consider that each software delay added to debounce a switch, will also slow down the code a bit

4 Likes

So here is my code with proper debounce. I use 5 footswitches and the internal pullups for all of them, so the logic is inverted but it’s an economy of five 10k resistors :slight_smile:.
I’ll post pictures later.

#define OT_AUTOCHANNEL 10
#define BTN_COUNT 5
#define BTN_START_PIN 2
#define DEBOUNCE_DELAY 50

int notes[BTN_COUNT] = {60, 64, 68, 69, 71};

int buttonState[BTN_COUNT];
int lastButtonState[BTN_COUNT];
unsigned long lastDebounceTime[BTN_COUNT];

void sendMidi(int b1, int b2, int b3) {
  Serial.write(b1);
  Serial.write(b2);
  Serial.write(b3);
}

void noteOn(int note, int velocity, int channel) {
  sendMidi(0x90 + channel, note, velocity);
}

void noteOff(int note, int velocity, int channel) {
  sendMidi(0x80 + channel, note, velocity);
}

void setup() {
  for (int i = 0; i < BTN_COUNT; i++) {
    buttonState[i] = HIGH;
    lastButtonState[i] = HIGH;
    lastDebounceTime[i] = 0;

    pinMode(BTN_START_PIN + i, INPUT_PULLUP);
  }

  Serial.begin(31250);
}

void loop() {
  for (int i = 0; i < BTN_COUNT; i++) {
    int reading = digitalRead(BTN_START_PIN + i);

      if (reading != lastButtonState[i]) {
        lastDebounceTime[i] = millis();
      }

      if ((millis() - lastDebounceTime[i]) > DEBOUNCE_DELAY) {
        if (reading != buttonState[i]) {
          buttonState[i] = reading;

          if (buttonState[i] == LOW) {
            noteOn(notes[i], 127, OT_AUTOCHANNEL);
          } else {
            noteOff(notes[i], 0, OT_AUTOCHANNEL);
          }
        }
      }

      lastButtonState[i] = reading;
  }
}
3 Likes

…standard MIDI baud rate is 31250, maybe worth changing/checking this one unless of course it’s all working fine :slight_smile:

2 Likes

Oh yes of course, sorry for that. I’ll edit my post.

2 Likes

And another edit (inverted note on and note off command codes). Sorry for all these typos.

2 Likes

My work bench :wink:



And another edit of previous post containing code (the autochannel was wrong).

7 Likes

What did it cost?

2 x 220 Ohms resistors -> ~0.04€
1 x cheap arduino nano knock off (Elegoo on Amazon) -> ~4€
5 x footswitches (TRU COMPONENTS TC-R13-85A-05 …) -> 18.1€
1 x MIDI DIN connector (Neutrik NYS325) -> 0.75€
1 x 45x91mm protoboard -> 0.65€

With the wires and solder, let’s say 24€. Not bad :slight_smile:

4 Likes

that XTpower battery pack… can you recommend it?

if so, is there a specific model to look out for? I see some units from that company sell for as low as 70 euros…

1 Like

Oh yeah it works perfectly. And I like the fact that all recent machines from Elektron use the same PSU so I can use it with all of my machines OTmkII, Digitone, A4mkII and ARmkII (although with these two, the battery lasts less longer).
The model is XT-20000QC2 20400mAh.

2 Likes

that is the one model I´ve seen advertised for <70€, nice.
Thanks!

I finished my footswitch using a ~20€ Ikea foot-rest (Dagotto), 8 zip ties and 2 m3 screws/nuts.


PS : please don’t pay attention to the footswitches order, I don’t know what I did :smiley:

6 Likes

Please remind what is your controller?
It looks solid, a bit high maybe. A side view?

Looks great! My enclosure should be arriving soon too!

For now it’s standard functions for pickup machines : combo rec, start/stop, sync start on the bottom row and select previous and next track on the top row.
It’s robust, clearly not a FCB1010 but it’s lighter. Note the zip ties keep the thing in place as it’s intended to be a foot-rest you can adjust.
It is a bit high but the angle makes it useable.

2 Likes

Any idea on how to implement MIDI to make the HOLD recording mode work in Pickup machines? The manual is a bit unclear about this.

Should one send the MIDI note on when pressing the footswitch, and MIDI note off when releasing? I will have to test this at some point…

Yes, this is how I implemented it and I did test with hold. It works perfectly.

2 Likes

If you’re interested, I added a system of presets. Holding a footswitch at startup select one preset. And as there’s a default configuration, you’ll have N+1 possible configurations (N being the number of footswitches, for me, 5).

5 Likes

Nice, that’s clever! I thought of maybe adding another button and some LEDs to program more presets into it, but this is a great way of doing it without adding any more clutter.

Finally got to finish up the project. Will add these two pictures to the main post!

I had a terrible accident while applying the glossy finish, which lead to a very messy finish on the top part unfortunately… I might try to fix it at some point. But it works perfectly! It just needs 4 little standoffs on the bottom. I will probably add a 9V battery inside besides the power jack as well. Also I mounted the MIDI port upside down :sweat_smile:

Currently playing around with this setup:

  1. INABrec
  2. INCDrec
  3. active track up
  4. active track down

8 Likes

:thup::red_circle:

Many facturers too !

2 Likes