Arduino USB HID Controller

Thanks. I will dig …
Actually where should I dig for the MKRZERO …?

Looks like the MKRZERO uses pin names D0…D7.

Doesn’t seem to make any difference. I will explore more . .

@riban is correct. These are the pin names on my microcontroller board. I’ve set this up for the ST Black Pill Clone because it has lots of GPIO pins to use. I am even using GPIO pins for the GND signal to the encoders to simplify wiring, AND I skipped GPIO pins in between the encoders so I can solder in JST connectors. So many GPIO pins…

If this is used with anything other than the Black Pill Clone(US$4) , you will need to change the encoder mappings with the Arduino pin names for your board.
ENCODER_DEF_PIN_MAP(back,PA10,PA9,PA8,PA7,PA6);
I don’t see any way possible to wire up 4 encoders and 4 buttons on the MKZERO. You might comment out 3 of the encoders, and the buttons just to give it a try, but this seems more like a dead end.

Here is what I used:
STM32F401 Development Board STM32F401CCU6 STM32F4 Development Board Learning Board for Arduino

The MKR ZERO has 21 available Digital pins so I don’t think there will be a problem and enough of them have interrupts to allow encoders to work. Indeed I’ve already use it with 4 encoders & 4 switches using the control_surface package.

What I was hoping to do was use your code base ( which is considerably more considered than mine) to provide a MIDI equivalent of what you have done with the keyboard approach.

My programming background has been Python based for twenty or so years and C in it’s various forms is pretty alien to me. Sadly that means that issues like Pin naming don’t come particularly easy to me. There are far too many symbols that are difficult to discover precise meaning for without literally learning it all from scratch.

@Wyleu,

21 IO pins is more than enough. I’ll take a better look and see if I can find a good mapping. Can you send me how you have them wired up on your project? I’ll use that as a starting point.

Pin on MKRZERO Control Device Comments
D0 Encoder Channel -
D1 Encoder Channel -
D2 Switch Channel -
D3 Encoder Back -
D4 Encoder Back -
D5 Switch Back -
D11 Encoder L/S -
D6 Encoder L/S Swapped with pin 10 for interrupt for encoder
D9 Switch L/S -
D7 Encoder Select -
D8 Encoder Select -
D10 Switch Select Swapped with pin 6 for interrupt for encoder
Front panel switches - - -
D13 Push Button 1 -
D12 Push Button 2 -
D20 Push Button 3 -
D21 Push Button 4 -

I knoocked together a quick cut & paste from the SimpleRotary example and it all seems to respond.

Ok, Perfect. I’ll take a stab at it hopefully before the weekend.

Just got the switches and encoders responding with your code.

It works! ( I’d left setup code commented)

Things occur on the zynthian interface when controls are ackled .!! :smiley:

Fill the sky with hats !!! :rescue_worker_helmet: :billed_cap: :mortar_board: :tophat: :womans_hat: :saxophone: :tophat:

There is, of course, a new thingy… Made up of two old thingy’s …

It’s beginning to look like a useable system…

3 Likes

Looking good sir. Nice clean wiring
Has anyone had a go with a raspi pico yet? I’m wondering how the pio might be useful.

1 Like

Arduino has developed their own board using the same processor as the Pi Pico, official Arduino IDE support in imminent, which will provide easier application of existing code libraries than the Pi Pico C++ tool chain.

1 Like

Sorry to be so late, this library header file containing about 60 MIDI messages:
including On/OFF, 7 bit and 14 bit CC , might be a useful reference.
And for others who might be searching for code:
The FortySevenEffects library has broken out a separate Arduino USB-MIDI Transport.
If you find the Arduino assigned USB device name annoying,
you can dig into the IDE and patch it.

1 Like

@smiths73v3 Can you modify the layer parameters with your device? I can’t seem to switch out of the select encoder allowing me to scroll up and down in the parameter lists in the centre of the screen. The encoders work because I can see movement in the sequencer but can’t get any joy out of the parameters themselves.

I don’t think this is currently possible from a QWERTY (or similar) keyboard because CUIA is not mapped / implemented everywhere. I feel this needs fixing at a low level. I added CUIA handlers for the encoders to step sequencer but it should really be in the base class from which all GUI panels derive.

Not so worried about the qwerty as the lack of layer parameters.
We can’t map the 4 encoders to operate live for a performance, which would seem to be something we should present on implementations of our interface.

Or in more specific terms give me a nice volume control pot at top of guitar stand height!
I’ll stick it in as a feature request.

I pointed out that QWERTY uses CUIA and this is not exposed so you will probably suffer same constraint.

Yeah that sounds like a trip into a room left uncleared for a good tidy up!.

Would we suffer the same confusion in the MIDI implementation or would we simply expose a similarly edge case encumbered situation?

MIDI note2cuia supports the encoder actions but the screens need to react to them so will probably have same issue.

@wyleu and @riban
Yes, this is what I encountered, and I tested both for QWERTY and MIDI. The CUIA interactions do not modify the UI Engine parameters. I attempted to dig into this a little bit to solve the issues, but my limited python skills, and lack of understanding of how all of the Zynth modules fit together keep getting in the way. I saw that it was complete for Step, but was not able to figure out how to do the same for the engines.

My apologies for not getting a config up for you, my day job got in the way of my funtime… :frowning: Glad to see that you have it working!