MIDI input circuit for RP2040

Hello, I’m trying to make a Input circuit using the RP2040.
I have done a similar circuit with the Arduino UNO, and the controller was able to receive midi messages.

I need 5V for MIDI. So i use the GND and VSYS pins to get 5 Volts. Then I’ve tried different Pins. Like GP0, GP1, … Theoretically i need a RX pin for this. I thought GP0 would be standard. Maybe the problem is that i use the 5V from the VSYS. Maybe I’m mistaken or i need some extra configuration in the code. The Midi In circuit goes with an octocoupler and was working with an Arduino, there i was not describing it here.

I’m not sure why i dont receive any midi message. If i receive MIDI On message, it should turn on the LED. I’m glad for any help!

I use Arduino code via Platformio to upload it:

#include <Arduino.h>
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
const int ledPin = 25;

void respondOn(byte channel, byte number, byte velocity){
  digitalWrite(ledPin, HIGH);
}
void respondOff(byte channel, byte number, byte velocity){
  digitalWrite(ledPin, LOW);
}

void setup() {
  pinMode(ledPin, OUTPUT);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.setHandleNoteOn(respondOn);
  MIDI.setHandleNoteOff(respondOff);
}

void loop() {
  MIDI.read();
}

VSYS is the voltage of VUSB (actual 5V) after a diode drop, not sure if you want that

Please post your exact circuit.

So this ends up using what Serial object? Because Serial is the USB-CDC (serial for the USB port), while Serial1 is the first hardware UART (GP0, GP1).

1 Like

Thank you very much for your response!
I’ve been experimenting around andt the circuit with the RP2040 ended up working by using 5V on MIDI in and 3.3V for MIDI out and also implementing this MIDI instance:

MIDI_CREATE_INSTANCE(HardwareSerial,  Serial1, MIDI);