Can Arduino act as a Bluetooth MIDI host device?

Hi, I've got a Nano 33 BLE and I've done a few projects where it acts as a Bluetooth MIDI controller using the BLE-MIDI library, where I can connect it to my MacBook or iPad. This is great, but can I do the opposite? I'd like to connect an existing Bluetooth MIDI keyboard to control the Arduino.

I tried a workaround by connecting both the keyboard and the Arduino to my MacBook, and relaying the keyboard messages to the Arduino, but with very unreliable results. Is there something in that library which could put it in host mode, list available devices, and select one to connect by name? Similar to how I might do it for an HC-05?

Shocked that there are no replies. Did you discover if it works as a USB MIDI host?

Oh man, I forgot I posted this :joy: I've set that project aside for a bit, but still need answers whenever I have time to pick it up again...

BLE does not have a host mode. There are peripherals/servers and there are central/client devices. The Arduino Nano 33 BLE can be used for both. The programming is quite different though.

A peripheral is fairly simple, you define services and characteristics and write data to the characteristics. There are examples in the ArduinoBLE library and in the forum.

File -> Examples -> ArduinoBLE -> Peripheral

The central device needs a little bit more complex code because it needs to discover the services and characteristics and then act according to what is available on the peripheral. e.g., subscribe, read, and write characteristics. You can also find examples in the ArduinoBLE library.

File -> Examples -> ArduinoBLE -> Central

If your MIDI thingy is a peripheral, you can explore it using a smartphone with a generic BLE app like BLE Scanner or the PeripheralExplorer example from the ArduinoBLE library.

If your MIDI thingy is a central, you will need to build a peripheral that provides the services and characteristics that the MIDI thingy is looking for.

Once you understand how BLE works you should be able to tell whether your BLE-MIDI library can do one or the other or both. If you have a link to the library e.g., on GitHub we can have a quick look.

The Nano 33 iOT works fine with USB Host using the libraries at gdsports ยท GitHub

In my case I modified the code from the coprocessor, not writing to a UART, but using the data gathered from the USB MIDI Host to send over BLE.

Next the blasted antenna broke (Arduino manufactures it with HOT GLUE for support - SMH). They have not stepped up and replaced it yet. In the meantime I grabbed a RP2040 connect what should work also. I will know in the next hour.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.