BLE MIDI Receiver

Updated 7 July 2021

I have a couple of the Yamaha UD-BT01 BLE MIDI transmitter adapters, and in the past I have used a Raspberry Pi computer to receive the transmitted MIDI and pass it on to a synth. This required the Rpi computer and an and a MIDI adapter. With the recent improvements in Arduino-style devices, it has become possible to make a very small BLE-to-DIN-Plug receiver. This document has details of the one I made with a ESP32 chip. Unfortunately a BLE to USB device is not currently possible using an Arduino-style chip, as no-one has put BLE and USB MIDI into one package (that I am aware of).

The device I used is a NodeMCU ESP 32S. It’s a simple-enough project that was pioneered by my German colleague Petra. I’ve had some requests for info about it so I thought I’d put this document together.

Basic Operation

The device looks like this:

^ Outside view ^
^ Inside view ^

The device is set up so that it will:

  • Scan for BLE MIDI hosts
  • Connect to the first host it finds
  • Decode the MIDI bytes, assuming they are all 3-byte messages (it ignores running status messages)
  • Send the messges out to the DIN plug at 31250baud and 3.3V
  • Get power from a USB socket
  • Attempt to re-connect if the connection is broken

The program is based on the BLE client example from the ESP32 BLE Arduino library. The program is here. I don’t guarantee that it will be the latest version.

The wiring to the DIN plug is simply:

  • UART Tx pin (GPIO17) connected to DIN Pin 5 via a 10 ohm resistor
  • 3V3 supply pin connected to DIN Pin 4 via a 33 ohm resistor.

Latency

I did some tests with the original client example program, and found that the latency was 23msec longer than what I get with a USB cable to my synth. I did some investigating and found that the connection interval could be adjusted, although you have to add code to the client program. I set that to the minimum for BLE (7.5msec) and the latency improved. I measured it as +14 msec over the USB cable, which is acceptable. The client program (link above) has been updated for the extra code.