# USB MIDI Host2Host

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/135/448/medium800/hacks_usbmidi-h2h-4079.jpg?1739945107)

USB MIDI **Hosts** such as laptops, sample stations, grooveboxes, and Raspberry Pi-based music computers love talking to Class Compliant **Devices** such as MIDI keyboards and controllers, but not with each other. How sad :(

This simple project allows two USB MIDI **Hosts** to talk to each other, opening up a world of sequencing possibilities. Yay!

https://www.youtube.com/live/Tqsvie6_pdE?feature=shared&t=683

## Parts
This project uses TWO Adafruit QT Py RP2040 boards connected via a short STEMMA QT cable. Be sure you get TWO boards and not just one.

### Adafruit QT Py RP2040

[Adafruit QT Py RP2040](https://www.adafruit.com/product/4900)
What a cutie pie! Or is it... a QT Py?&nbsp;This diminutive dev board comes with one of our new favorite chip, the RP2040. It's been made famous in the new [Raspberry Pi Pico](https://www.adafruit.com/pico) _and_ our [Feather...](http://www.adafruit.com/product/4884)

Out of Stock
[Buy Now](https://www.adafruit.com/product/4900)
[Related Guides to the Product](https://learn.adafruit.com/products/4900/guides)
![Video of hand holding a QT Py PCB in their hand. An LED glows rainbow colors.](https://cdn-shop.adafruit.com/product-videos/640x480/4900-06.jpg)

### STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long

[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long](https://www.adafruit.com/product/4399)
This 4-wire cable is&nbsp;50mm / 1.9" long and fitted with JST SH female 4-pin connectors on both ends. Compared with the chunkier JST PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4399)
[Related Guides to the Product](https://learn.adafruit.com/products/4399/guides)
![Angled of of JST SH 4-Pin Cable.](https://cdn-shop.adafruit.com/640x480/4399-00.jpg)

This cable is used to program the QT Py boards. Also if your MIDI devices have USB A connections, you'll need two cables like this to connect each MIDI host to the project.

### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
![Angled shot of a coiled black, USB-C to USB-A cable.](https://cdn-shop.adafruit.com/640x480/4474-02.jpg)

# USB MIDI Host2Host

## Code

The easiest way to get up and running is to drag-and-drop the code to your QT Py RP2040 boards. First, download the two&nbsp; **.UF2** files linked below to your computer.

[Host2Host_red.uf2](https://cdn-learn.adafruit.com/assets/assets/000/135/441/original/USBMIDIHost2Host_QTPyRP2040_red.uf2?1739942619)
[Host2Host_blue.uf2](https://cdn-learn.adafruit.com/assets/assets/000/135/442/original/USBMIDIHost2Host_QTPyRP2040_blue.uf2?1739942624)
Then, plug in the first QT Py RP2040 to your computer using a known good USB data cable.

Put the board into bootloader mode by pressing and holding the **BOOT** button, then press-release the **RESET** button, and finally release the **BOOT** button. You'll see a new drive appear on your computer called **RPI-RP2**.

Drag the `USBMIDIHost2Host_QTPyRP2040_red.uf2` file onto the RPI-RP2 drive. It will copy over for a moment and then the board will automatically restart, running the code.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/443/medium640/hacks_drive.jpg?1739942920)

Unplug the QT Py and plug in the second one. Repeat the process of putting the board into bootloader mode and this time drag over the `USBMIDIHost2Host_QTPyRP2040_blue.uf2` file.

## Source Code

If you want to dig deeper into the code here's the source code (you may need to first go to the Arduino IDE Setup Page of this guide to prepare if you want to change the code):

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/USB_MIDI_Host2Host/USBMIDIHost2Host_QTPyRP2040.ino

# USB MIDI Host2Host

## Arduino IDE Setup

The [**Arduino**  **Philhower core**](https://github.com/earlephilhower/arduino-pico) provides support for RP2040 microcontroller boards. This page covers getting your Arduino IDE set up to include your board.

## Arduino IDE Download

The first thing you will need to do is to download the latest release of the Arduino IDE. The Philhower core requires **version 1.8** &nbsp;or higher.

[Arduino IDE Download](https://www.arduino.cc/en/software)
Download and install it to your computer.

Once installed, open the Arduino IDE.

## Adding the Philhower Board Manager URL

In the Arduino IDE, navigate to the **Preferences** window. You can access it through **File \> Preferences** on Windows&nbsp;or&nbsp;Linux, or **Arduino \> Preferences** on OS X.

The **Preferences** window will open.

In the **Additional Boards Manager URLs** field, you'll want to add a new URL. The list of URLs is comma separated, and&nbsp;_you will only have to add each&nbsp;URL once._ The URLs point to index files that the Board Manager uses to build the list of available & installed boards.

Copy the following URL.

`https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json`

Add the URL to the the **Additional Boards Manager URLs** field (highlighted in red below).

![](https://cdn-learn.adafruit.com/assets/assets/000/107/121/medium800/rp2040_arduino_ide_setup_Arduino_Template_preferences_window.png?1638917398)

Click **OK** to save and close **Preferences**.

## Add Board Support Package

In the Arduino IDE, click on **Tools \> Board \> Boards Manager**. If you have previously selected a board, the **Board** menu item may have a board name after it.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/260/medium800/arduino_compatibles_Untitled1b.png?1759870723)

In the **Boards Manager** , search for RP2040. Scroll down to the **Raspberry Pi Pico/RP2040/RP2350 by Earle F Philhower, III** entry. Click **Install** to install it. If it was previously installed, look to make sure you have the latest version.

![](https://cdn-learn.adafruit.com/assets/assets/000/140/261/medium800/arduino_compatibles_b.png?1759870757)

Warning: 

Once installation is complete, click **Close** to close the Boards Manager.

## Choose Your Board

In the **Tools \> Boards** menu, you should now see **Raspberry Pi RP2040 Boards** (possibly followed by a version number).

![](https://cdn-learn.adafruit.com/assets/assets/000/140/259/medium800/arduino_compatibles_Untitled1a.png?1759870630)

Navigate to the **Raspberry Pi Pico RP2040/RP2350** menu. You will see the available boards listed.

Navigate to the **Raspberry Pi RP2040 Boards** menu and choose **Adafruit QT Py RP2040**.

![](https://cdn-learn.adafruit.com/assets/assets/000/108/381/medium800/adafruit_products_QTRP_Arduino_boards_menu.png?1643219187)

Danger: 

Now you're ready to begin using Arduino with your RP2040 board!

# USB MIDI Host2Host

## Prep the Boards

The two QT Py boards will talk to each other over UART serial -- however, in order to simplify wiring and keep it solderless, we'll use the STEMMA QT ports and re-assign the pins that are normally used for I2C to be PIO-based serial pins.

Since the pin assignments are mutable, we'll even be able to get away with a regular cable and avoid having to build a cross-over. The only modification we'll make is to remove the red V+ cable since it isn't necessary and could potentially cause power contention or noise on the serial lines if there are power fluctuations between the two separately powered devices.

## Wire Modification

Use a pair of tweezers or dental pick to carefully pry up the connector housing where the red cable connects and extract the red wire from each end.

You'll want to keep the black ground wire and the colored signal wires as is.

Or, make it reeeeally simple and simply cut the red wire near both connector ends. You can even pretend you're defusing the detonator in an 80s action film to make it super exciting! DON'T CUT THE BLUE WIRE!! (or the black or yellow for that matter!)

&nbsp;

![two qt boards and a short stemma qt cable](https://cdn-learn.adafruit.com/assets/assets/000/135/420/medium640/hacks_usbmidi-h2h-2-2.jpg?1739928363)

![stemma qt cable](https://cdn-learn.adafruit.com/assets/assets/000/135/421/medium640/hacks_usbmidi-h2h-2-5.jpg?1739928375)

![stemma qt cable wtih the red wire being removed with a pair of tweezers](https://cdn-learn.adafruit.com/assets/assets/000/135/422/medium640/hacks_usbmidi-h2h-2-6.jpg?1739928400)

![STEMMA QT cable with the red wire fully removed](https://cdn-learn.adafruit.com/assets/assets/000/135/423/medium640/hacks_usbmidi-h2h-2-8.jpg?1739928430)

## 3D Printed Case

If you'd like to print a case and lid (or have a service do so), the files are below in the blue link. Use PLA with moderate 0.2mm height settings.&nbsp;

Big thanks to the Ruiz Bros. for their cool [QT Py case design](https://learn.adafruit.com/qt-py-snap-fit-case)&nbsp;that I remixed to build this!

![a 3d printed case and lid for the two QT Py boards](https://cdn-learn.adafruit.com/assets/assets/000/135/430/medium640/hacks_usbmidi-h2h-2-4.jpg?1739928594)

[USB MIDI H2H models ](https://cdn-learn.adafruit.com/assets/assets/000/135/432/original/USB_MIDI_H2H_models.zip?1739928756)
## Plug 'em In

We know, it looks kinda wacky, but it's gonna be OK we promise! Go ahead and plug the modified STEMMA QT cable into both QT Py boards as shown.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/424/medium800/hacks_usbmidi-h2h-2-9.jpg?1739928488)

## Pop Into Case

Pop the two QT Py boards into the case. Seat each board into place and press fit them in, oriented as shown with their USB C connectors facing out.

![two qt py boards connected w modified stemma qt cable and the 3d case](https://cdn-learn.adafruit.com/assets/assets/000/135/433/medium640/hacks_usbmidi-h2h-2-10.jpg?1739929217)

![](https://cdn-learn.adafruit.com/assets/assets/000/135/434/medium640/hacks_usbmidi-h2h-2-11.jpg?1739929228)

![](https://cdn-learn.adafruit.com/assets/assets/000/135/435/medium640/hacks_usbmidi-h2h-2-12.jpg?1739929238)

![](https://cdn-learn.adafruit.com/assets/assets/000/135/438/medium800/hacks_usbmidi-h2h-2-13.jpg?1739929362)

# USB MIDI Host2Host

## Use the Host2Host

## Plug 'em In

Plug the two QT Py RP2040 boards into two USB MIDI Host devices, such as an iPhone and a Macbook, or a 1010 Music blackbox and a Raspberry Pi-based Shield XL/norns music computer as shown above.&nbsp;

On most devices the connection will be USB-C to the QT Py RP2040 and USB-A on the USB MIDI Host machine. If you involve an older iOS device this may require a [Lightning to USB Camera Adapter](https://www.apple.com/shop/product/MD821AM/A/lightning-to-usb-camera-adapter) or similar.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/444/medium800/hacks_usbmidi-h2h-4075.jpg?1739945069)

## Pick Device

On your Host machines select the device to send and receive MIDI messages. In the example here, the norns software **System \> Devices \> MIDI** menu has been used to pick the `QTHost2 Red`.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/445/medium640/hacks_usbmidi-h2h-4077.jpg?1740528342)

## Enable MIDI

Here on the blackbox in the **Tools \> MIDI \> MIDI Out** menu the output has been `enabled`.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/446/medium640/hacks_usbmidi-h2h-4078.jpg?1740528370)

## Sequence MIDI

Using one USB MIDI Host as a sequencer -- the **blackbox** in this case -- the MIDI messages are sent to the **QTHost2 Blue** over **USB** , then from there to the **QTHost2 Red** via **UART** , and then finally over **USB** to the second host, the **Shield XL/norns** machine.

![](https://cdn-learn.adafruit.com/assets/assets/000/135/447/medium800/hacks_usbmidi-h2h-4079.jpg?1739945093)

Here's a demo of this in action between an iPhone and the ShieldXL:

https://www.youtube.com/live/Tqsvie6_pdE?feature=shared&t=683

Warning: If your device names don't seem to change on MacOS after updating the firmware, go to Audio MIDI Setup.app, open MIDI Studio, delete the offending devices, and then re-connect them. _Voila!_ New names.


## Featured Products

### Adafruit QT Py RP2040

[Adafruit QT Py RP2040](https://www.adafruit.com/product/4900)
What a cutie pie! Or is it... a QT Py?&nbsp;This diminutive dev board comes with one of our new favorite chip, the RP2040. It's been made famous in the new [Raspberry Pi Pico](https://www.adafruit.com/pico) _and_ our [Feather...](http://www.adafruit.com/product/4884)

Out of Stock
[Buy Now](https://www.adafruit.com/product/4900)
[Related Guides to the Product](https://learn.adafruit.com/products/4900/guides)
### STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long

[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long](https://www.adafruit.com/product/4399)
This 4-wire cable is&nbsp;50mm / 1.9" long and fitted with JST SH female 4-pin connectors on both ends. Compared with the chunkier JST PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4399)
[Related Guides to the Product](https://learn.adafruit.com/products/4399/guides)
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)

## Related Guides

- [Adafruit QT Py RP2040](https://learn.adafruit.com/adafruit-qt-py-2040.md)
- [NeoKey Emoji Keyboard](https://learn.adafruit.com/neokey-emoji-keyboard.md)
- [Split Ortho Keyboard with TCA8418 Matrix Expanders](https://learn.adafruit.com/split-ortho-keyboard.md)
- [Three Button Foot Switch](https://learn.adafruit.com/three-button-foot-switch.md)
- [Halloween Neon LED Signs](https://learn.adafruit.com/halloween-neon-led-signs.md)
- [An Introduction to RP2040 PIO with CircuitPython](https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython.md)
- [NeoPixel Menorah](https://learn.adafruit.com/neopixel-menorah.md)
- [Audio Synthesis with CircuitPython synthio](https://learn.adafruit.com/audio-synthesis-with-circuitpython-synthio.md)
- [LED Neon Signs with NeoPixels](https://learn.adafruit.com/led-neon-signs-with-neopixels.md)
- [NeoPixel Novelty Cufflinks with Scrolling Text](https://learn.adafruit.com/neopixel-novelty-cufflinks-with-scrolling-text.md)
- [USB Rotary Media Dial](https://learn.adafruit.com/usb-rotary-media-dial.md)
- [Tandy 1000 Keyboard to USB with CircuitPython](https://learn.adafruit.com/tandy-1000-keyboard-to-usb-with-circuitpython.md)
- ["Mother of all Demos" USB Keyset](https://learn.adafruit.com/usb-keyset.md)
- [LED Noodle Holiday Tree](https://learn.adafruit.com/led-noodle-tree.md)
- [MIDI for Makers](https://learn.adafruit.com/midi-for-makers.md)
