Skip to content

Accordion Mega story

accordion-mega edited this page Dec 9, 2010 · 35 revisions

I like to play accordion & have a dog. People say dogs are singing with squeezeboxes and some people find it funny. Not for me. I know that my pet hears note harmonics much better then me & suffers from high pitches very much. So, no real practice at home just because of humanity. That sucks. I like to play accordion. Programmers see cycle here. Let's get out.

THIS IS IT.
It plays to headphones, produces MIDI output, etc. etc. It costs $6,699.00 on e-bay (buy now offer) as of 17 of November 2010. In US I can buy Peugeot Partner for the same price. In Ukraine where i live both items cost a half higher. For that money i'll get beautiful device to practice at home and no service centers available within 400Km radius. Weird.

Another cycle, getting out of it just below.
Let's build MIDI accordion. What do we require:

  1. Old accordion to be reborn
  • scan 41 keys of right hand
  • scan 120 buttons of left hand
  • measure pressure inside box
  • send all of that via MIDI message to much smarter device i'm writing this text on.

Googling a bit, microcontrollers, robots, hurray 2,3,5 are done by MIDI Chromatic Button Accordion (CBA) and costs 75 euro. Nice try, Tom, however for a pre-programmed device, price is too high. Soldering 120 reed switches for the left hand & 41 for the right will give me much soldering experience and quite dumb device. It will produce notes without a feel, being closed for further development. No, thanks. But thanks for informative site, really!

Another hobbyst, Mike Szczys with impressive youtube video. It works, huh? No source code. You will not have a chance even to make a copy of that toy. Thanks anyway, Mike, you proved we can do it.

So, arduino. As of 2010 this project looks slightly outdated, but, who cares. It has descent hardware (comparing with Sinclair 48K i had long time ago), some IDE, lots of libraries and ready-made projects.

Lets try to solve our requirements one by one.

  1. you have one if read this article up to here. Solved.
  2. keyboard

it have to be

  • fast
  • cheap
  • chorded (allow pressing of any button combination)
  • fit inside old accordion.

candidates are:

  • matrix keyboard: possible (with diodes)
  • 1-wire keyboard: no, no chording
  • PC keyboard chip: cheap, no chording
  • hall sensors: cheap? no way
  • optointerruptors: yes, read below

Since optointerruptor is a pair of diode and phototransitor we have to light up every diode one by one & get the value from pulled-up input arduino pin. For me it's logical to combine diodes not to octaves (by 12) but to bytes (by 8) to read the result faster. No debouncing required. Looks like a dream, huh?

Left hand schematics Right hand schematics

Output transistor may be pulled up to +5v by external resistor, but we know how to turn on internal pull-up resistors in Atmega chip, so, keeping things simple.

As you see in schematics I don't want to scan every button of left hand. Accordion does not, it has patented hardware encoder, it is already producing the feeling of button pressed, already opens up needed vents, and, there are 24 vents only, not 120. This gives us a chance to scan keys fast enough and reduce number of wires & power requirements.

Some constructing, some sawing, some etching, some soldering. Both hands are equiped with optointerruptors now:

Left hand photo Right hand photo

3.keyboard Solved

4.air pressure.

BMP085 – digital barometric pressure sensor just does it. This page describes everything you need.

4.Solved

5.send MIDI message.

3 bytes MIDI message is easy to send:

 Serial.print(midi_cmd, BYTE);
 Serial.print(notes_number, BYTE);
 Serial.print(midi_vel, BYTE);

but not so easy to recieve. Something have to tell computer these 3 bytes are MIDI and route it to synthesizer or sampler you use. Of course we can turn off debug, leave MIDI the only bytes on serial connection and route that to sampler somehow. I want to keep the debug connection clean and use different port for MIDI data. MIDI tutorial is easy & helpful, but I don't have MIDI-USB dongle and don't want to buy one. At least now. So, i propose to connect something like BTM-112 to spare serial port of arduino to transfer MIDI data and make instrument wireless.
For me it worked out of the box, spent some time to find its AT command set and figure out how to speed it up. 115Kb/sec is more then needed in this case.
Now most tricky part. We have to tell computer that this exact serial line transmits MIDI data to play. Windows users luckily do have Roland Serial Midi driver which may work. I'm MacOS user and not found anything suitable to just feed ready-made bytes from serial line to IAC driver of CoreMIDI sybsystem. Serial_MIDI_Converter works, but it is a bad joke to start Java for such easy task.
Finally i had to write my own 4Kb utility to do that, you will find it here, it is based on rtmidi package and will work in any OS.

5.Solved

After programming arduino with firmware we have 41/120 wireless MIDI accordion.
Roland, you lost one more customer ;)

bill of materials:

  • old accordion free
  • ArduinoMega from e-bay. 30$
  • BMP085 13$
  • optointerruptors BPI-470-T51 65x0.2$ = 13$
  • WH0802A-NGG-CT 3.75$
  • 5x1.2v NI-MH cells 22.50$
  • phone 6pin connectors, wires, usb connectors, etc. ~15$

sum: 97.25$

Looks like we can buy any MacOS computer with Logic and any sample package for the change. Have fun!

Clone this wiki locally