Midi controller with encoders

Hi, I want to build a midi controller with only encoders. I will have to use an arduino mega to accommodate the number rotary encoder.

I know there are such programs as HIDuino.

Would it be easier to send the midi over a 5 pin din to the pc, and would the remove the need for extra software i.e. HIDuino?

What your thought?

Thanks you

It's really a matter of what kind of fun you want to have, and what kind of approach will work for you.

I did MIDI before there was USBHID to help. I have other MIDI junk, so for me it's been adapters and old school. And would be where I started if I dusted any of that old stuff off.

As it would be easiest for me. And cheapest.

a7

I guess the easiest way to get me up and running with the amount of encoders I need.

Sry, yes. That seems like a separate and more important question.

How many encoders? Do you have a part number for that, yet?

Seems like you will need lotsa input pins or clever code.

The number of encoders may be what dictates the board choice.

a7

Well first of all, there is a way to make the 16u2 which takes care of the USB connection on a (Genuine) Mega to act as a USB-Midi device, but does mean that the bootloader gets overwritten and so you would have to upload any new program via the ICSP header, i have never done it, but i'm sure it can be done.

The reason i have never done it is because on a Micro & Leonardo, which are both 32u8 based, it is a really easy thing to do.
There is one really good and extensive library i know (though personally not use, i modify stuff i don't built controllers) being control surface which was created and is being maintained by someone here on the forum.

As far as i know though, encoders require an update system that is interrupt driven, which sort of excludes the use of multiplexers (which control surface does support) But even the Mega doesn't have a lot of pins that can be used as interrupt pins, although there is a way around that. There are other boards that support interrupts on any pin and support them being recognized as a USB midi device as well, like a teensy (I think, i'm not wasting my budget on all that)

A Mega is a poor choice for MIDI over USB and a poor choice for that many encoders. Consider using a Teensy instead, Teensies support MIDI over USB natively, and you can get them with many pins.

Either way, this might help:

I want around 20

Teensy seems quite expensive. which one has lots of out puts?

Can i link more than one Leonardo?

I guess it depends on where you live. I just checked a local web shop, and they list the Arduino Mega for €48 and a Teensy 4.1 for €38. Two Leonardos would set you back around €50.

The Teensy 4.1 has 55 I/O lines in total, 42 of which are breadboard-accessible. It is vastly superior to the Arduino Mega in almost every aspect, which may or may not be overkill for your project.

Although you could connect multiple Leonardos, involving multiple microcontrollers usually makes the project significantly more complex, so I would advise against it.

Hi Pieter, I have a few questions.

I don’t know anything about teensy do the use arduino code?

I have Leonard which I could use as test subject. Will your linked library’s and code been needed if I’m using a Leonardo with encoders.

Also, let’s say I have volume mapped to an encoder in my daw, and let’s say the volume in the daw is set a halfway. If I move then encoder will it pick up the current state of the level in the daw?

Thank you

Hi, I want to build a usb midi controller with 20 or more encoders. The problem I see is that, I will not have enough physical inputs on a Arduino. Is there a way round this?

Thank you

Hello gman30000

Take a view here to get some ideas:

Have a nice day and enjoy coding in C++.

Thanks, seems they're not available anymore.

Did you scroll down to
image
?

Your two topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

The user was already overwhelmed with this. :sunglasses:

Yes, you can just use the Arduino IDE to program them.

You'll need to make sure that you're reading the encoders often enough.
If there's nothing else going on in your code, you can just continuously poll them in the main loop.
If you're doing other things apart from polling the encoders, you can use the pin change interrupt or timer interrupt code I linked to.
Either way, direct port manipulation is going to be significantly more performant than using digitalRead, although you have to keep in mind that the Leonardo pin mapping is a mess (adjacent bits in the ports are usually not adjacent digital pins).

The library works well with the Leonardo, but you might have to adapt the examples a bit to change the pin numbers or the timer you're using, every microcontroller is a bit different on that front.

If you use the relative encoder mode, then yes. But not all DAWs support this.

[quote="PieterP, post:19, topic:1079722"]
Leonardo pin mapping is a mess

What do you mean by this?

Thanks