Making my accordion a MIDI controller


I've been playing the accordion for a long time but I've also been making a lot of electronic music. An old wish is to have my accordion act as a MIDI controller. Unfortunately there are no good sets to turn an accordion in a MIDI controller. In daily life I am a software engineer and I while ago I had to cooperate with hardware engineers who were working with Arduino. That gave me the spark to start an Arduino project. I have the following idea, feedback would be really appreciated.

I'll use light gates to trigger MIDI NoteOn and NoteOff. It really needs to be binary. But I have a lot of tones and a series of registers, around 100. So I'll need 13 ShiftOut registers. Examples are already provided with the CD4021B and the SN74HC165N at the Arduino site. But I found so many shift registers, it is hard too choose. Questions I have: Is having 13 shift registers ok? Are there any concerns with shift registers that I should be aware of like power consumption?

The Uno is a bit too big to fit so I would like to try the Micro. It has the ATmega32U4 but I still am not sure that I can use that as a HID device. I would like to have the device popup as a MIDI device (using ddiakopoulos/hiduino. I've done that now for the Uno but I still searching for the confirmation that it will work with the Micro. Has anybody experience with that?

Last but not least, volume should be controlled with a pressure sensor. With this I'll be able to have the initial volume as well as aftertouch volumes. I am now aiming for the Freescale mpxv7002dp. My biggest concern is that I should have a pretty stable signal and remove erratic behaviour. Probably it won't work as linearly as I hope so I have to do signal processing. Does anybody have experience with that in real time with the Micro?

Let me know your thoughts!



The MPXV7002 seems like a good choice. I use a lot of them for various functions. I often use an infinite-impulse-response (IIR) filter. For example, take seven-eighths of the previous value and add one-eighth of the latest measurement. By experimenting with different ratios, you can change the filter response. (But it must always add up to one.) You also run into some unexpected issues with the resolution of integers but that's an implementation detail.

13 shift registers should not be too taxing. An accordion has a LOT of buttons doesn't it? Just look at how quickly you can step through all those bits and see if you can do it fast enough to seem responsive. I guess for music, you need to do it at least 50 times per second or the lag will be noticeable.

The HIDuino project reprograms the 16U2 chip on the Uno or Mega. With a Micro or Teensy, you can do this directly in the main processor without any special effort. See Teensyduino: Using USB MIDI with Teensy on the Arduino IDE

There exist port expanders, which can be used like shift registers, and signal whenever an input signal (button…) changes. This may simplify monitoring the many keys of an accordion.

I expect more problems with just interfacing the many mechanical keys to an electronic digital controller. How do you intend to bridge this gap? Sensors have to be connected to every key, summing up into a large circuit. Do you intend to detach the keyboards from the accordion sound elements, or should the accordion still play sound?

Thanks for your reactions. I’ll fiddle with the IIR filter. And the link is really useful. With respect to response, it needs to respond preferably within a couple of microseconds, less if possible. Starting from 10 to 20 ms you can notice latency when playing. But the midi controller is not the only object in the music chain.

Interesting idea the port expanders, I’ll look into it.
Basically I have a light gate for every key. In the picture below from Wikipedia It woul place the light gate on the rod from the key to the pallet.

The side with all the buttons has a similar but more complex system. The buttons can represent chords and press multiple levers. Although there are 120 buttons there are less actual tones.

The accordion should still function as it does. And it will be a large circuit connecting all the keys. But the light gates are quite tiny so I plan to make small two sided pcb’s each with one or two shift registers, the light gates and smd resistors were required. Looking forward making it.