This Arduino that is sold by Tom Scarff is called 'boarduino' He ships quickly and is very reliable and responsive to silly questions by beginners. It's an ATmega168 microcontroller chip; analog 0 thru 5 pins; and comes preprogrammed with a "no-wait" Arduino bootloader 2 red LEDs, power and "pin 13" just like the Arduino Diecimila with a 16 hz clock (resonator) It has the 2-pin header for MIDI OUT.
The arduino source code is available on his site.
Step 1: Building a Midi Controller With the Boarduino
So I turned to him for this project and found that he already had a kit (called a boarduino) ready to go.
http://midikits.net23.net/midi_boarduino/midi_boarduino.htm The Boarduino is interesting because of its size. It's tiny (.75" x 3.75") and will fit in a small spot and the price is good. I prefer to buy it assembled - one less variable.
The easiest way to get started is to put a 9v battery on the standard 2.1 mm. Here a word of warning. You need to keep the power source within spec. I left my battery plugged in over a week or so, it dropped down below 9v and the microprocessor (trying as hard as it might) lost its marbles. Fortunately one can re-upload the code and you are back in business.
You can also provide 5vDC to the serial pin or the board but be very careful as there is no diode to protect you for reverse polarity (as there is with the 9v external plug).
Step 2: Setting Up the Scarff Boarduino
The only thing that I left out that was the pull down resistors. Yes it's on the website and yup - I messed up. So I had a terrible cacophonous howling which was mildly interesting until i put some 1M ohm resistors from ground to the analog input. The howling was all of the channels going on or off depending on ambient RF and such.
Plug the midi cable from the boarduino to your synth (or midi in on your keyboard) and it works right out of the box.
Step 3: Adding Piezos
The piezo generates electricity based on the amount of deflection in the crystal. Some piezos used in instrumentation are gripped on the side (a cantilever mount). I chose to make small indentations in the backing material that would allow the piezos to bend and flex. So mounting the piezos is an important consideration when your goal is to read the current from individual keystrokes. It's not like using a piezo as a pickup on a guitar.
One must be careful when attaching devices to the analog pins. The piezos can generate voltages from -20vdc to +60vdc. I put them on a scope and it's quite an interesting wave form. The clamping diodes on the ATmel allow up to 1 milliamp (1000 microamps). So the 1M ohm pull down resistor helps protect the analog inputs on the arduino.
In the end the piezos worked fine - but getting the analog inputs on the board to recognize and turn them reliably into a midi signal is a work in progress. This is why I like working with Tom. He's already come up with some different designs for my unique needs. So the next task is figuring out how to add some subtle circuitry that will make the arduino a little more responsive.
I've tried implementing this simple circuit (below) to the output and I think that with some changes in the code and tuning of the circuit I will have a good basic design.
Now onto the next step - adding a mux. Which again - Tom Scarff cranked out in short order. There is still quite a bit of design work left but i'm very pleased with the initial product; a six note midi controller (soon to be expanded).
Step 4: Hooking the BUB Up to the Boarduino to Download Code
To get the arduino software going follow instructions for mac drivers.
When editing the source files using arduino software on my mac i used these settings.
tools -> serial port : tty.usbserial*
tools-> board : Arduino Diecimila or Duemilanovie w/ ATmega 168
tools-> programmer: avirisp mkIII
Oh! When it comes to using the BUB (mind from modern devices) to upload the software on the boarduino you may need to flip it upside down. If you read the labels on the pins it will make sense. If there is no light on the board and you have your BUB hooked up, the reversed pin-out cold be the reason.
Hook it up and download!
Step 5: Finally, I Hooked This Up to Piezos
i cut this out in a few minutes after dinner so i had something to test the piezos with. i mounted it to a standard break-out box and put a midi jack on the side. a 9v battery fits inside. So - a complete, battery powered midi controller that is 2" x 6". The scarff board really works well in situations where you want to fit it into a small area !
Step 6: Low Pass Filters for Piezos Used As a Keyboard
No need for a Zener to limit the analog input. Arduino can handle up to 100 volts, as long as the amperage is below a 1 milliamp. So brief signal spikes of 5-10 volts on the analog inputs should not be an issue.
This arrangement (with a diode right off the piezo, and a 1M pull down) seems to be the best starting point.