Wirelessly connect your USB MIDI instruments to your iOS device using low-energy Bluetooth.
An Apple Camera Connection Kit is generally required to connect a USB MIDI instrument such as a K-Board, BopPad or Artiphon to an iOS music app such as GarageBand, DrumJam, or GeoShred. However, with the help of some Arduino components and sketches, it is easy to make an adapter that reads MIDI messages from a USB instrument and sends them to an iOS device using Bluetooth LE (BLE).
I've investigated three different approaches and provide instructions for each of them in this project.Arduino 101 / Hobbytronics USB HOST-MIDI
The first design is the simplest in terms of parts and connections. It combines the BLE support provided by the Arduino 101 with the USB Host support provided by the Hobbytronics USB HOST-MIDI breakout.
The Arduino 101 and Hobbytronics breakout communicate using Serial I/O. The sketch running on the Arduino 101 reads MIDI messages from the USB Host breakout and then writes them to its integrated BLE service.
The adapter currently operates in one direction only, receiving messages from USB but not transmitting to USB. This is true for all adapters in this project, by the way. For this reason, the Hobbytronics breakout only needs three connections: 5V, GND, and TX. Connect its TX pin to the RX pin (D0) on the Arduino 101.
To program the adapter, upload the CurieUsbMidiBridge sketch to the Arduino 101. Now you're ready to plug-in your instrument, connect your iOS app to the adapter (scan for "CurieBLE"), and start playing.
Many iOS apps support BLE MIDI connections directly. For apps that do not, the midimittr app can act as the intermediary.
For stability reasons, this implementation of the adapter only handles Note On and Note Off messages. Support for the other channel messages such as Control Change, After Touch, and Pitch Bend may be enabled in a future version, but for now they are commented-out in the sketch.Arduino Mega ADK / SparkFun nRF52832
The second design leverages the BLE support provided by the SparkFun nRF52832 Breakout and the USB Host support provided by the Arduino Mega ADK.
The SparkFun nRF52 breakout and Arduino Mega communicate using I2C. The nRF52 is the I2C master, requesting MIDI messages from the Arduino Mega. The messages received from the Arduino Mega are sent out through the nRF52's BLE service. The sketch running on the Arduino Mega responds to I2C requests, reading MIDI messages from its integrated USB Host controller and writing them to the nRF52.
The SparkFun breakout needs five connections:
- SDA (24)
- SCL (25)
Because the SparkFun nRF52 breakout operates at 3V3 and the Arduino Mega operates at 5V, the three logic pins are connected through a bi-directional level shifter.
NOTE: The SDA and SCL assignments must be redefined in the SparkFun variants.h file. For more details see this hookup guide discussion.
Upload sketch nRF52MidiWireMaster to the SparkFun breakout and UsbMidiWireSlave to the Arduino Mega. Then plug your instrument into the USB Host connector, connect your iOS app to the adapter (scan for "nRFMIDI"), and start playing!Arduino Uno / USB Host Shield / Bean+
The final design employs the BLE capability of the LightBlue Bean+, pairing it with a USB Host Shield attached to an Arduino Uno, as shown in the photo below. An Arduino Mega ADK can substitute for the USB Host Shield and Arduino Uno combination. The Fritzing diagram shows the Arduino Mega ADK version.
As in the previous design, the two MCUs communicate using I2C. The Bean+ is the I2C master, requesting MIDI messages from the Arduino Uno. The messages received from the Uno are sent out through the Bean's BLE service. The sketch running on the Uno responds to I2C requests, reading MIDI messages from the attached USB Host Shield and writing them to the Bean+.
The Bean+ needs four connections:
- SDA (A4)
- SCL (A5)
NOTE: Switch the Bean+ to 5V operation.
Upload sketch BeanMidiWireMaster to the Bean+ and upload UsbMidiWireSlave to the Arduino Uno. Then plug your instrument into the USB Host Shield, connect your iOS app to the adapter (scan for "Bean+"), and start playing.
For performance reasons, support for Control Change and After Touch channel messages has been commented-out in the sketch, but may be enabled in a future version.