Easiest ESP32 (DIN5/Serial) MIDI to BLE

I couldn't find a clear solution on the web so here it is, this is probably the easiest way to make a Serial MIDI to BLE MIDI adapter!

First you to install the Control Surface library

And use this code:

// To change the BLE device name modify the file:
// .\Arduino\libraries\Control_Surface\src\MIDI_Interfaces\BLEMIDI.hpp
// ( at line 22-> constexpr const char *BLE_MIDI_NAME = "Control Surface (BLE)"; )

#include <Control_Surface.h>
#include <MIDI_Interfaces/BluetoothMIDI_Interface.hpp>

BluetoothMIDI_Interface MIDI_BLE;
HardwareSerialMIDI_Interface MIDI_SERIAL = Serial;

MIDI_PipeFactory<2> pipes;

void setup() {
  MIDI_BLE >> pipes >> MIDI_SERIAL; // all incoming MIDI from BLE is sent to Serial
  MIDI_BLE << pipes << MIDI_SERIAL; // all incoming MIDI from Serial is sent to BLE

  MIDI_SERIAL.begin();
  MIDI_BLE.begin();
}

void loop() {
  MIDI_BLE.update();
  MIDI_SERIAL.update();
}

And that's it!

I only tried to convert Serial to BLE but it should work both ways.

For the hardware it is pretty simple, just follow the same concept that you would use to read/send MIDI data with an Arduino.

On the ESP32, RX is GPIO3 (U0_RXD) and TX is GPIO1 (U0_TXD).

2 Likes

It looks really good, how did you connect the DIN5 connectors to the board?

jesusolmedac:
It looks really good, how did you connect the DIN5 connectors to the board?

Sorry for the late reply. To connect the DIN5 I made a standard midi input circuit with an optocoupler, a diode and a couple of resistors. The circuit is very easy to find on google. It connects to RX (GPIO3 (U0_RXD)) on the ESP32.

1 Like