The Flexible MIDI Shield includes the following features:
- Optoisolated and protected MIDI IN and MIDI OUT connectors (standard 5-pin DIN female connectors)
- Compatibility with Arduino Uno, Duemilanove, Mega/Mega2560, Ruggeduino, or other Arduino-compatible boards.
- Compatible with Arduino MIDI library
- Stacking headers so other shields can plug in on top
- MIDI IN reception on any one of pins D0, D2, D4, D6, D8 or D10 (selectable with a jumper)
- MIDI OUT transmission on any one of pins D1, D3, D5, D7, D9 or D11 (selectable with a jumper)
- A separate MIDI enable signal can be used in your sketch to enable or disable MIDI IN/OUT hardware connections. See full description below. This signal can be on any one of pins D12 through D19 (selectable with a jumper) or jumpered to always be enabled.
- Reset switch included to reset the Arduino
- Operation at either 5V or 3.3V (jumper selectable)
- 2-pin terminal pads included (terminals not included) for easily providing external Vin power
Here are some sample programs for demonstrating the applications of the Flexible MIDI Shield.
This sketch takes MIDI IN note events and adds two additional note events on MIDI OUT: one that is always a fixed interval above or below the note coming in, and one that is at a varying interval, rotating through a predefined list. This is based on an idea by Robby Kilgore and is demonstrated by him in this video.
This sketch demonstrates how the Flexible MIDI Shield can be used as a USB-to-MIDI converter. Events coming in on the MIDI IN port (using the SoftwareSerial library) are sent to the serial terminal over USB, while keypresses sent over USB are converted to MIDI OUT note events. Use your computer keyboard as a MIDI controller.
There are three main signals on the Flexible MIDI Shield:
- The MIDI IN signal carries data to the Arduino from the MIDI IN connector. This is a 31250bps serial data stream that can either by received by the hardware serial port on the Arduino (D0) or on any other digital pin using the SoftwareSerial or NewSoftSerial Arduino library (see the USB-to-MIDI sample code above for an example).
Using the included jumper, you can select which Arduino pin will see the MIDI IN signal: D0, D2, D4, D6, D8, or D10. Do not install a jumper on more than one of these pins at a time.
- The MIDI OUT signal carries data from the Arduino to the MIDI OUT connector. This is also a 31250bps serial data stream that can be transmitted by the hardware serial port on the Arduino (D1) or by using a software serial library (as for the MIDI IN signal).
Using the included jumper, you can select which Arduino pin will transmit the MIDI OUT signal: D1, D3, D5, D7, D9 or D11. Do not install a jumper on more than one of these pins at a time.
- A MIDI enable signal is used to completely disconnect the MIDI IN/OUT connectors from the Arduino. When this signal is HIGH, the MIDI connectors are connected to the Arduino, and disconnected when the signal is LOW.
Using the included jumper, you can select which Arduino pin will control the MIDI enable signal: D12 through D19 (note that D14 through D19 are also the analog inputs A0 through A5). Do not install a jumper on more than one of these pins at a time. In addition, you can install a jumper on the pins labelled “ON” (next to the pins labelled D12) and the MIDI connectors will always be enabled. This frees up all of your pins for other purposes.
Among other uses, this MIDI enable signal allows the Arduino to have sketches uploaded to it over the hardware serial port (using the bootloader) while seeing no interference from the MIDI IN connector. This is because the MIDI enable signal is pulled down LOW when the Arduino is in reset (as it is when it is being programmed).
Simple Sketch Uploading
The use of pins D0 and D1 (hardware serial port) for MIDI IN/OUT is a problem with other MIDI shields because these are the same pins used for uploading sketches to your Arduino. On the Flexible MIDI Shield this problem is solved by using the MIDI enable signal described above (jumper-selectable to be any pin from D12 through D19, or always enabled).
When the Arduino is being programmed, all I/O pins become inputs and a 10k pull-down resistor on the MIDI enable signal ensures this signal is LOW. This means the MIDI IN/OUT connectors are completely disconnected from the Arduino pins and sketch uploading works exactly as expected. This also means you won’t hear any strange sounds coming from whatever is connected to your MIDI OUT port!
In your sketch, you set the MIDI enable signal HIGH when you are ready to communicate with your MIDI devices.
Note that this is only a problem when you have also selected D0 and D1 to be the pins used for MIDI IN/OUT communication. If you have installed jumpers to select pins other than D0/D1 (and use SoftwareSerial library functions) then there is no conflict with sketch uploading and you can leave the MIDI enable signal jumpered to the ON position.
The Rotator.pde sample sketch described above assumes a D0/D1 connection and shows how to use the MIDI enable signal. The USB2MIDI.pde sample sketch uses D2/D3 and the SoftwareSerial library thus can have the MIDI enable signal always enabled. In both cases, you do not have to do anything special to upload sketches -- it just works!
External Power Input
For standalone or battery-powered operation, the two-pin terminal pads (next to the reset switch on the shield) allow you to make a sturdy connection to a battery or other power source. These terminal pads can have bare wires soldered in, or you can solder in a 3.5mm two-pin terminal block (not included).
This power input is essentially the same as the DC power jack on the Arduino. Provide a DC power source of the same voltage and current that is required by your Arduino board (e.g., 7-12VDC for an Arduino Uno, at least 100mA is recommended). Power you apply to the two-pin terminal block is available at the Vin pin on the stacking headers.
The Flexible MIDI Shield is compatible with both 5V and 3.3V Arduino-compatible boards. By default jumper J2 is connected (see the schematic) for 5V operation. For 3.3V operation, cut this jumper using a small hobby knife or other sharp tool and short jumper J1. Do not ever allow both jumpers to be connected!
Here is the schematic of the Flexible MIDI Shield.
The Flexible MIDI Shield was designed in the USA and is assembled in the USA using lead-free components and lead-free manufacturing and assembly processes.