It is currently Tue Jul 16, 2024 10:08 am


Alternatives to Leonardo for MIDI over USB?

Building organ consoles for use with Hauptwerk, adding MIDI to existing consoles, obtaining parts, ...
  • Author
  • Message
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Alternatives to Leonardo for MIDI over USB?

PostSun Dec 12, 2021 11:09 am

I'm interested in implementing some pistons for my HW organ. I thought this would be a good opportunity for doing some Arduino-based tinkering. I have a lot of experience as a programmer and a fair amount of experience working with the Arduino (mostly UNO). I just acquired an Arduino Leonardo, since its firmware includes support for MIDI over USB out of the box. It turns out, as I discovered after I tried to upload my first sketch, that the Leonardo bootloader has some peculiarity such that you have to press the RESET button and then release it at exactly the right time during the upload process. Otherwise, the upload fails (which turns out to be most of the time). And, it turns out to be really easy to brick the Leonardo. Fortunately, I'm equipped to re-burn the bootloader.

So, I'm wondering if there is an alternative to the Leonardo that avoids this messiness. An Arduino-sized platform is ideal is most respects ... no keyboard or monitor required to run once you've finished development. Or maybe hints to use the Leonardo that work around this messiness.

EDIT: Any experience with using Teensy for this kind of application?

Any suggestions are much appreciated.

- Bruce
Offline

GrahamH

Member

  • Posts: 621
  • Joined: Tue Sep 09, 2008 6:39 am
  • Location: Near Manchester, England

Re: Alternatives to Leonardo for MIDI over USB?

PostSun Dec 12, 2021 2:06 pm

I've recently been experimenting with Arduinos but I've no programming experience so I adapted a sketch posted by 'larason2' on the Arduino Project Hub.
I also like the idea of MIDI via USB rather than via 5 pin DIN socket, so I made a Pedal Board encoder based on the PRO MICRO (or a cheap imitation thereof). I guess the PRO MICRO is to the LEONARDO as the NANO is to the UNO.
My PRO MICRO encoder supports 64 key switches arranged in an 8 x 8 matrix generating Note on/Note off MIDI messages, plus 3 expression pedals.
I didn't experience any issues of the kind that you describe. I think it would be fine as a Piston encoder.
Please PM me with an email address if you would like more details.

Graham
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostSun Dec 12, 2021 2:14 pm

Thanks for the info, Graham.

I've seen mention of the Pro Micro ... don't know anything about it (aside from it seems to be related to the
Leonardo), so I will dig into that more.

Also, I'm looking at the Teensy, which is hardware compatible to the Leonardo ... there is even a Teensy plug-in
to the the Arduino IDE, so all the Arduino libraries are usable ... but it has its own bootloader. A MIDI over USB
implementation comes with the plug-in, so worth looking into.

But will certainly look at the Pro Micro first.

Thanks again!

- Bruce
Offline

larason2

Member

  • Posts: 783
  • Joined: Thu Feb 04, 2016 9:32 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostSun Dec 12, 2021 2:44 pm

I wasn’t aware of the limitations to the Leonardo that you mention, but I’m wondering if there is another way to reprogram the leonardo so that it’s easier? Anyway, I’ve been using one of John Kinkennon’s teensy boards, and it’s very easy to program for Midi USB and works great. In the past I’ve avoided Teensy’s because they have a limited number of pins, but I’ve since come across some midi through code that makes it very easy to daisy chain midi messages from one board to another, so that in the future I might consider getting several teensy’s and daisy chaining them. I can give you more details if you’re interested.

That being said, using Hardware midi output is also pretty simple, and once you have a USB midi interface it’s just as convenient, in my opinion. I buy cheap 5 pin DIN plugs and port mounts, and they also work great. Graham’s system also sounds pretty convenient, and I’m pleased at how he’s been using my code. Someday I’ll upload his 8x8 code to my arduino hub page, but I’ve been so busy! Thanks Graham for the plug.
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostSun Dec 12, 2021 4:11 pm

@larason2 -

Thanks again for a helpful response.

I've done more digging and, as far as I can tell, the Arduino is "supposed" to do whatever magic is required to do this reset before upload. I have no explanation for why it's not working. The IDE code to accomplish this has been around for years. Perhaps my authentic Leonardo is not so authentic(?). I have found that I can reliably upload new code to it using the ICSP method, using an Arduino UNO as a programmer ... just requires swapping which Arduino is plugged into the USB port on my computer, but that will get old during development.

Anyway, I was glad to hear your reference to the Teensy ... I'll probably go ahead and order one.

Thanks again -

Bruce
Offline

JmG

Member

  • Posts: 23
  • Joined: Sun Feb 07, 2021 1:45 am

Re: Alternatives to Leonardo for MIDI over USB?

PostMon Dec 13, 2021 1:44 am

Hello,
I'm using Arduino Mega and midi over usb since one year without problems. have a look to these links:
https://tttapa.github.io/Control-Surfac ... r-USB.html
and
https://github.com/kuwatay/mocolufa

With mocolufa you can switch with only moving a strap between a normal configuration for the atmel chip programming and using midi over usb.
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostMon Dec 13, 2021 7:54 am

@JmG -

Thanks for the info ... I'll have a look at this as well.

Meanwhile, I have ordered a Teensy 3.2 ... looking forward to tinkering with it. One possibility might be to use the Teensy for development and, since I'm able to upload to the Leonardo using ICSP, use it for deployment. Anyway, this is all a good way to keep busy during the dark part of the year here in Massachusetts.

Best -

Bruce
Offline

jkinkennon

Member

  • Posts: 1208
  • Joined: Thu May 07, 2009 9:43 am
  • Location: Hastings, NE

Re: Alternatives to Leonardo for MIDI over USB?

PostMon Dec 13, 2021 10:43 am

I use a lot of Teensy boards, most recently the Teensy 4.1 because it is such a bargain for one of the most powerful boards of its type with a clock speed of 600Mhz. It will want to run too fast for most MIDI applications but it's easy to adjust the timing of the main program loop. The Teensy 3.6 or 4.1 has plenty of pins as well to do a matrix encoder that will handle four manuals or a pedal or pistons encoder without needing an expansion board. If you need 5v signals there's the Teensy 3.5.

Programming is possible on the Arduino IDE but I prefer Visual Studio with the vMicro entension. There are tons of example programs so no one needs to start from scratch.

Another interesting possibility is the use of STM Nucleo boards like the Nucleo-H743Z12. This development board features an ARM Cortex-M7 running at 480Mhz. It's easy to program using the Mbed Studio IDE plus it is also Arduino compatible.

These top end choices are almost as affordable as the traditional Arduino hardware and are in a whole different class if the simple projects end up becoming more challenging ones.
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostMon Dec 13, 2021 11:26 am

@jkinkennon ... thanks for all the info and suggestions.

For my purposes, the Teensy 3.2 is itself probably way more than I need. All I'm trying to implement initially are a couple of pistons to be able to do a "stepper +" and "stepper -".

This will be my first attempt at MIDI programming. My thought was to use two of the general purpose Control Change messages, one for each piston. Does that make sense? Other suggestions for what MIDI message to generate?

Thanks to all!

- Bruce
Offline

jkinkennon

Member

  • Posts: 1208
  • Joined: Thu May 07, 2009 9:43 am
  • Location: Hastings, NE

Re: Alternatives to Leonardo for MIDI over USB?

PostTue Dec 14, 2021 10:20 am

Just to get started you might want to check out the example programs in the Arduino IDE.
Look under File->Examples->Teensy->MIDI where you will find the Buttons program (sketch). It sends NoteOn and NoteOff messages which work fine.
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostTue Dec 14, 2021 10:47 am

@jkinkennon ... thanks for that.

I went ahead yesterday, while I wait for the Teensy to arrive here, and installed the latest version of the Arduino IDE
and Teensy plug-in. I had a quick peek and saw the "Button" example program is there ... that will be my first stop
when the board arrives.

- Bruce
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostThu Dec 16, 2021 12:19 pm

I should possibly have opened up a new topic for this.

I've seen mention in this topic ... and in many other places where "do it yourself" MIDI is discussed ... the term "matrix". While I understand the term generally speaking ... essentially an X x Y array ... I would appreciate it if someone could point me to a description of specifically what it means for constructing VPO MIDI devices, i.e., what's the hardware involved, how it is connected to, for example, an Aruduino, and what's the programming involved. Probably a pointer to an example would be the most helpful.

My initial MIDI device is going to be just two pistons, so I assume anything matrix-y would be way overkill, but I'd like to get a better understanding of what's involved going forward.

Thanks!

- Bruce
Offline

GrahamH

Member

  • Posts: 621
  • Joined: Tue Sep 09, 2008 6:39 am
  • Location: Near Manchester, England

Re: Alternatives to Leonardo for MIDI over USB?

PostThu Dec 16, 2021 2:11 pm

Hi Bruce
If you wire your switches in a conventional “busbar” arrangement, you would need a wire to each switch plus a “common” or “busbar” connected to all the switches. So for a 61 note keyboard you would need 61 + 1 = 62 wires altogether.
If you wire your switches in (say) an 8 x 8 matrix arrangement, you can connect 64 switches to a MIDI encoder with only 16 wires.
Hence an Arduino MEGA (which can make 64 pins available for digital input) would support a single keyboard if you used the busbar wiring arrangement.
But if you used the matrix wiring arrangement, the same Arduino MEGA could encode four 61-note keyboards.
In order for matrix wiring to work, you need to connect a small signal diode in series with each switch.
Matrix wiring seems a bit complicated when you first encounter it, but when you have done it a couple of times, you will never look back!
I like the 8 x 8 arrangement because it works nicely with 16-way flat cable and 16-pin IDC connectors, but there are other arrangements such as 6 x 10.
Hopefully this diagram will help clarify things:
https://1drv.ms/u/s!AkOZ2I3AWrKRh3V6j_bBGwHOLMUN?e=gqUiiS

There are other ways of presenting the same circuit diagram, and some people talk about "rows" and "columns" but I've never been able to figure out which are the "rows" and which are the "columns" :?

Obviously matrix wiring would be overkill for your current project!
Graham
Offline

larason2

Member

  • Posts: 783
  • Joined: Thu Feb 04, 2016 9:32 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostThu Dec 16, 2021 2:45 pm

I suppose I should have posted this earlier, but here is my writeup, as well as circuit diagrams and code examples for matrixed keyboards for an organ. I proved a "bussed" example, but that is also a kind of matrix! I don't think it matters too much what you call columns or rows, but going by the convention I have seen online, the columns are the pins you activate one at a time, and the rows are the pins that you "read" to get the notes.

https://create.arduino.cc/projecthub/La ... ans-f3756c
Offline

brucerosen

Member

  • Posts: 20
  • Joined: Thu Jun 10, 2021 6:25 pm

Re: Alternatives to Leonardo for MIDI over USB?

PostThu Dec 16, 2021 2:48 pm

Graham and @larason2 -

Many thanks for the info and pointers ... just what I was hoping to get!!

- Bruce
Next

Return to DIY organ consoles / MIDI

Who is online

Users browsing this forum: No registered users and 1 guest