Simple Midi Controller: Single Button

Midi Switch

To show feasibility for the midi pedal controller, I wanted to start with a simple project: a single button midi controller. In essence, my pedal board will consist of mostly buttons and two expression pedals. If we can get a single button to work, we just follow the same process for all of the other buttons.

Hardware

The hardware required for this project is as follows:

  • 1 Teensy 3.1 with USB Connection
  • 1 Breadboard
  • 1 tactile button
  • 2 jumper wires

Breadboard Setup

We will breadboard the parts as per the diagram below. We will connect the digital 2 pin to one side of the button, and connect the other side to ground.

Single Button Midi

The Teensy allows us to use the digital inputs in “pull up” mode, meaning the pin always reads high until it is connected to ground. We just have to remember when we program that when the button is pressed, the input with go from HIGH to LOW.

If we wanted the pin to always read low until we pushed the button, we would connect one side of the button to Vin (5V) and the other side to both a 10K ohm resistor (connected to ground) and the digital 2 pin. When the button is pressed, the pin would sense HIGH, and when the button is released, the remaining charge on the pin would pass through the resistor and return the signal to ground, or LOW.

Program

Make sure you set the board to your Teensy 3.1 board in the Tools menu. You also will want to change the Tools > USB Type to MIDI instead of Serial.

Enter the following sketch:

If when you verify the sketch, you get the message “fatal error: Bounce.h: No such file or directory”, then you are missing the Bounce library in your project. Check out this post to make sure you have installed the library to your Arduino Library list.

If your sketch verified smoothly, upload it to the Teensy 3.1. Your computer should now detect a Midi Controller Device. Try it out with your program of choice! It’s essentially a single key (middle C) piano.

Leave a Message!

Your email address will not be published. Required fields are marked *