Custom MIDI controller for Zynth

I want to create custom MIDI foot keyboard controller from scratch using Arduino or ideally ATTiny85, but with no success. I started with MIDI examples available for Arduino (https://docs.arduino.cc/built-in-examples/communication/Midi/) and community ( Notes and Volts: MIDI for the Arduino - Build a MIDI Output Circuit ). Flashed it first to ATTiny85 (software serial) and then tried to use hardware serial from Arduino, but I get no MIDI events in Zynthian input (for other controller like e.g. Yamaha MODX this works fine with zynth), so this is definitely something with my circuit or boards (I use Ali clones both for Arduino Nano and ATTiny85).

Can anyone help me with some sanity checks? Do you have any minimal credible and working schematic for Arduino or RPI? Just sending single midi message would be perfect.

Schematic seems really simple, so I would expect that I can just use UART from my RPI3 with proper resitstors (10R & 33R as here: https://drive.google.com/file/d/1L2YHBOZdSCuMg-RFR3TTEJcdV6KWkLZ9/view). Should this be enough to test my case?

At this point I am considering skipping this part with using dedicated MIDI module, but any help or guidance on getting this working from the scratch will be much appreciated.

1 Like

If your Arduino board is supported you could use Opendeck so that you could test your hardware connectivity before you run your own code.

2 Likes

Here’s a very simple hand drawn schematic that worked, followed by links to a few good articles or websites about DIY MIDI.

1 Like

Unfortunately Arduino Nano and tiny85 are not listed uder supported boards.

This schematic is for MIDI in, but I need out (on the internet tutorials use 220R resistors on Vcc and 220R on TX without additional ICs). But I see that Digispark shield uses additional IC.

Here is an instruction video using the Nano TX to send midi, with example code

https://www.youtube.com/live/ellhUszaMZs?si=XOVKr3mQ7O2UUhQv

1 Like

Hi @multim ,

What do you want, DIN5 or USB?

It is simple in principle.
The part you are missing is that your USB device must identify itself as a MIDI device (class compatible as it is called).
As far as I know the only Arduino’s that can do that are the UNO and the boards with a ATmega32u4 processor (Leonardo, Pro Micro).

The Arduino UNO uses a separate USB handling controller, a 16U2. If you want it to behave as a MIDI device, it must be reflashed. I use USBMidiKlik. Advantage is that you can switch between MIDI and HID (keyboard).

The Pro Micro I use can be programmed directly for USB MIDI if you use the proper library (MIDIUSB).

This of course applies only to USB MIDI out.

If you use a DIN 5 port you can simply use the normal UART set to 31250 baud.

        //  Set MIDI baud rate:
        Serial.begin(31250);

If it does not work you have reversed pin 4 and 5 (yes, happens to me all the time).

What does the RPI3 do in this context? I thought you were using and Arduino?
If you want to connect a 5V DIN 5 MIDI to the RPi3, you must use an optocoupler like @tunagenes writes.

Kind regards,
Hans.

3 Likes

I don’t know what to say… Thank you so much, if you hadn’t written that I would have not checked myself :smiley: I was looking at the female connector schematic and wiring male one :man_facepalming:

I got this finally on Nano, now trying with ATTiny, fingers crossed.

Edit:

This little guy also works nice:

Thank you guys again

1 Like

Happened to me too to much, so I have this one printed and hanging above my desk :wink:

3 Likes

Yes it often catches me out too. More accurately, on the output pin 4 is tied to +5V (via 220 ohm resistor) and pin 5 has the signal whilst on the input pin 4 is connected the anode (via 220 ohm resistor) and pin 5 is connected to the cathode of the opto isolator.

Exactly, the signal line on MIDI IN is mirrored compared to THRU and OUT. That’s why it is often confusing.

No, the opposite. MIDI has straight cables so signal is on pin 4 on both input and output.

1 Like

Right. Much confusion :grin: