DigitalReadSerial 16 button midi controller

Good evening Arduino community,

I have been trying to post for a while tonight now, but kept receiving 413 entity error messages.

So what I have done is take a picture of my intended post and added it as an attachment called;Original attempted post screenshot.

I know this isn’t ideal and will probably get me shot down on my first ever post! But with no other way around it, this was all I could think of, sorry and hope you understand.

Pictures related to this project will be uploaded after

Thank you

Project pics


more project pics

Finished unit, still with protective cover on.

Sorry for such an awkward way of posting but I guess due to size of my post, it was too big. Any other pictures needed please ask as I have plenty, related to design, questions asked and problems I have faced.

Thank you once again

...and what is the Programming Question?

You might be interested in my Arduino MIDI controller library. It makes setting up a MIDI controller really easy. All installation instructions are in the ReadMe, and you can find the full documentation in the Wiki, as well as a guide on how to connect the hardware.


OP’s pictures:

Thank you for your response PieterP and showing the pics in other post, much appreciated! I will be sure to try that out and get to grips with the midi library, thank you.

Sorry for such a convoluted post aarg, I was trying to understand how to use the DigitalReadSerial basic example sketch, to test all my buttons and not just button 2. I had no problem using AnalogReadSerial to test all 6 of the potentiometers signal, by changing each related number after A in the sketch. I was struggling to understand how to adapt sketch for my needs that was all.


Hello again PieterP or anyone kind enough to answer.

Trying to workout if I need the firmware update, but cannot find relevant info as shown in screenshot 1.
Shall I go ahead and install macports anyway?
Or as shown in screenshot 2, do I have correct settings there?

I have tried to research for past couple hours about this.

Thanks once again.

It's not a firmware upgrade. It's a completely different firmware, that turns the Arduino into a USB MIDI device. I'd recommend trying it out with Hairless MIDI first. Use Serial.begin(115200); at the end of the setup to use it with Hairless.

The MIDI controller library just sends out serial MIDI messages (because the ATmega2560 doesn't support MIDI over USB natively). On the Arduino Mega, there's a second microcontroller, the ATmega16U2 (8U2 on older boards) that takes these serial messages, and sends them over USB, pretending to be a USB COM (serial) port. You can then use a software tool like Hairless to convert these serial messages to actual MIDI messages. (They already are MIDI messages, but the computer doesn't know that they are, it's just meaningless serial data.)

This is quite cumbersome, because you need extra software to run in the background. If you want an easier, more permanent solution, you can flash custom firmware to the ATmega16U2, that translates the serial MIDI messages to MIDI USB packets. Once you plug it into your computer, it will be automatically detected as a USB MIDI device.

The downside is that you can't really program the Mega while this MIDI firmware is loaded, you need to flash the normal USB COM firmware first.


Ok, I had mentioned HairlessMIDI in my original post and had trouble with that just crashing (see pic please).

I do prefer the idea of having less software running in background, so flashing the device seems the most appropriate way of dealing with this, and will be the way I proceed.

The part I’m having trouble understanding is where you describe the downside. Not being able to program the mega while this MIDI firmware is loaded? Does this mean once firmware is loaded I will not be able to upload the Midi Library repository you linked earlier on?

So I will flash the normal USB COM firmware first, then flash my Arduino with MIDI firmware. I will research how to do this.

Sorry if I’m frustrating you by not understanding, but I am so willing to learn, I have only been researching Arduino projects and built my controller within the past month or so.

Thank you

at this point, wouldn't be easier to use a board with native usb like zero or DUE?

Hello nitrof,

Thank you for your suggestion I will look into these boards for potential future projects. As I’m new to this all this info will be taken on board, thanks.

But at this point i’m very much committed to this project and don’t have the money available to purchase anything else at the moment.

I picked the Arduino mega board due to the number of i/o’s and potential to add more pots or buttons in the future, and not have to worry too much about multiplexers etc on my first project.

I think through trial and error I will get somewhere regarding MIDI over USB and will try installing the macports dfu programmer (screenshot pic) and will continue having a try until I’m stuck again!


Good. just for the record, the footprint of arduino DUE is pretty similar to MEGA if you want to crossgrade some day, and for multiplexing, don't worry about it, it is under the skin. Just call analog and digital read/write as other arduino.

Continue to work hard and learn much.

Regards Nitrof

Thanks sounds interesting, ok will do.

I will definitely continue to try and learn, certain parts are blowing my mind, but feel I'm quite close to getting where I want to!


Hello yet again!

I have hit a brick wall with this MIDI over USB.

I have ended up installing command line Xcode, as I followed the macports setup instructions through DFUProgramming page here:Arduino - DFUProgramming8U2

I seem too be going round in circles and can’t figure this out, if anyone can/could suggest what I’m doing wrong etc or if I’m on right track, I would be grateful. Has the answer already been explained in a previous response to me?

Is Hiduino an option?

Thank you for time

If my post is in the wrong place or any moderators believe I should be posting this thread elsewhere, please advise me, thank you.

Forget about DFU and MIDI firmware for now. Try to get it working with Hairless first.

The instructions on the MIDI controller library page are for Hiduino. I can't help you with the Mac installation, I'm a Linux user myself. If you have a Linux computer, it's as simple as running the script that comes with the library. On Windows, it's a bit more work, but you get a graphical user interface with Atmel Flip, so it's pretty easy as well, and the step by step guide should help you through the process.


Ok thanks PieterP,

Im really struggling, but know once it works I will prob realise how simple it was!

I have tried the Hairless MIDI before but run into errors. By the time I try to fix anything or workout what is going on, Hairless MIDI will just crash.

I will persist with your suggested method, thanks once again.