MIDI input circuit / arduino code for RP2040

Hello, I’m trying to make a Input circuit using arduino code but now on the RP2040.
I have done a similar circuit with the Arduino UNO, and the controller was able to receive midi messages. Now I decided to switch, because the RP is faster, but i'd like to keep the code.

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();
}

not really

oh, really? why ?

means USB is used. not GP0, not GP1, not RX, etc.
does MIDI.h support RP2040 ?

1 Like

Mh, its hard to find sources on how to use arduino on RP2040. I was hoping the implementation would be compatible, since many other things are.
I know its possible to use the pins rather than usb for midi.

is it possible to use a 3.3 volt midi circuit?
the circuit with the optocoupler typically uses a 220 ohm resistor and a 4.7k resistor. would that need to be changed?

its hard to find out how to make a midi library work from the arduino programming language to the rp2040.

thank you for your response!

yes, find my month old post about it.

1 Like

The RP2040 as such will not support MIDI. However, if you program it with Circuit Python then you can get a MIDI output.

1 Like

Yes, and yes. See 5 Pin DIN Electrical Specs – MIDI.org.

An alternative could be to use Control Surface: MIDI Tutorial.

1 Like

Thanks everybody for you responses!!
I’ve been experimenting around and 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);

Pins are GPIO 0 and 1 for out and in then.

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