I'm trying to do MIDI in and out on an ESP32 (Wemos mini esp32, with the Arduino SDK). This fails: I'm not receiving any data and also transmitted data is not accepted by any MIDI device (it won't even show up on a Linux device with "amidi -p ... --dump").

The weird thing is, that the some of this setup works fine on an ESP8266 mcu (wemos d1 mini: midi in with the pc817 optocoupler and midi out with a level shifter).

These are the schematics:


Now MIDI in works fine on the ESP8266. I just do Serial.begin(31250, SWSERIAL_8N1); and I can receive all data. This does not work on the ESP32, nothing comes in.

MIDI out I only got to work on the ESP8266 by using a level shifter (like one of these) (and of course 220 ohm resistors as it then uses regular 5v). I then use SoftwareSerial on D5/D6 (D6 connected to the level shifter).

On the ESP32 I tried the schematic shown above, a level shifter and I also tried a transistor. None of them got any data out of it. I tried Serial2.begin(31250, SERIAL_8N1, 16, 17, false); and .begin(31250, SERIAL_8N1, 16, 17, true);

New contributor
Folkert van Heusden is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • (it won't even show up on a Linux device with "amidi -p ... --dump"). -- Well, no, only your USB to MIDI adaptor would show up. The ESP32/ESP8266 has nothing at all to do with that. If you're not getting anything showing in Linux you should investigate whatever your adapter is before blaming whatever the adapter is plugged into. – Majenko Jul 21 at 11:14
  • 1
    The 4.7k Ohm pull-up resistor in the MIDI-In interface might make low-to-high transitions too slow behind the optical isolator. I would try a lower resistance (1k maybe). Buffering the MIDI-Out would also be a good idea to boost the signal level and prevent I/O ports from being damaged. – StarCat Jul 21 at 12:57
  • Also, the official MIDI circuit is different, check midi.org/specifications-old/item/… – Michel Keijzers Jul 21 at 13:12
  • @majenko i fed the ESP output though a regular midi-to-usb coverter and dumped its output. Like you would do with a keyboard. – Folkert van Heusden Jul 21 at 13:23
  • 1
    The current flows from pin 4 to pin 5 of the MIDI connector; at least one of your circuits is wrong. If the input works, then you got the pin numbers wrong. – CL. Jul 24 at 12:45

Your Answer

Folkert van Heusden is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.