Introduction: Arduino MIDI Foot Pedal Keyboard

Picture of Arduino MIDI Foot Pedal Keyboard

The Origin

My dad is a musician. He can play a multitude of instruments. However, he only has two arms, BUT he also has legs! That's when we decided that we would reuse the foot pedals from an old organ and convert them into an arduino powered MIDI keyboard. Now he can easily play electric guitar and fill the empty sound with excellent bass notes produced from his QS8 Quadrasynth.

An Introduction to MIDI

MIDI stands for Musical Instrument Digital Interface. As you can guess, it conducts all operations digitally. MIDI doesn't send sound frequencies as instruments do. MIDI works generally with two parts: a controller and a synthesizer. The controller is what is manipulated by the musician and sends serial data to the synthesizer.

The MIDI controller does not make any sound on its own. It REQUIRES some form of a synthesizer. The synthesizer decodes the serial data and produces sound based on the given data.

MIDI data is commonly sent in three parts: the MIDI channel (up to 16 channels can be used at once), the note, and the velocity (basically the volume of the note or how loud you want it to be).

Step 1: Materials

Picture of Materials

Materials

-Organ (to salvage foot pedals from)
-Two ATmega328 ICs with arduino boot loader
-Seats to place the ICs in once soldered.
-Two 16 MHz crystals
-Four 22pF ceramic capacitors
-Perf board
-Power supply and adapter for ATmega ICs
-220 Ohm resistor
-Pull down resistors for the Pedals
-MIDI cable or Female MIDI connector
-Arduino and USB cable (for programming the IC.  A separate programmer can be used in its place)
-Computer for programming
-Solder and Soldering Iron
-Wire Strippers and cutters
-Potentiometer (Potentially the volume pedal salvaged from organ [see what I did there?])
-At least twenty six pin connector (salvaged from organ)
-Wire

I ordered my arduino parts, crystals, powersupply, and capacitors from http://cutedigi.com.  Use a common 12V power adapter to power the powersupply.  I can't imagine this project drawing much current, so I'm sure a 500mA power adapter will suffice.

Step 2: Obtaining the Foot Pedals

Picture of Obtaining the Foot Pedals

What a steal!

The organ used in this instructable is a Wurlitzer organ.  My dad found it on craigslist and picked it up for $25!!  Everything worked, but he didn't care for the tone.  The pedals, however, were perfect.  There are twenty five keys and the switches are built into the pedals instead of mounted inside the organ with the pedals hitting the switches.  Also note how the switches use magnets to connect the switch.  These switches will be almost impossible to wear out!  Consider taking the volume pedal as well.  It controls a potentiometer, which is pertinent to our interests!

This organ has an interesting version of a Leslie speaker.  That might be used for another project on another day.

Step 3: Making a Dual Stand-Alone Arduino

Picture of Making a Dual Stand-Alone Arduino
The foot pedals chosen in this project has twenty-five notes.  The ATmega 328 (the one I use) has at MOST 20 digital inputs (including using the analog inputs as digital inputs.)   One is used for sending the MIDI data.  This leaves 19 digital inputs for the pedals.  Instead of using an AVR that has more inputs, I found it easier to buy two ATmega 328s and run them together.  The inputs were split 13 in one and 12 in another.

The 16 MHZ crystal is connected to pins 9 and 10 of the IC.  One capacitor is also connected to pin 9 and then to ground, while the other to pin 10 and then to ground.

Solder the IC seats, powersupply, crystals, capacitors, and connector down to the perf board.  Print out the picture of the ATmega Arduino pinout.  Write whatever you used to label the pedal wires down on each.  My dad simply labeled them like the notes: C, C+, D, D+, E, etc. (+ meaning #) This will help with the programming step.    Send a +5V wire to one side of all the pedal switches.  The returning wires from the pedals are wired to the digital inputs of the IC.  Be sure to include pull down resistors on the inputs for the pedals.

When the MIDI cable is being wired to the board, only three pins are used of the five: +5V, GND, and a serial transmit on digital pin 1 (pin 3 on the IC).  A 220 Ohm resistor needs to be wired between the +5V and MIDI output to prevent damage to the synthesizer or MIDI sequencer.

Analog pin 5 on both ATmegas are wired to the middle pin of a potentiometer. In my case, the potentiometer was in the volume pedal of the organ.  The other two pins of the potentiometer are wired to +5V and GND.

The following list depicts the schematic. Please excuse the redundancy of re-listing the parts.

----------------------------------------------------------------------------------------------------------------------------------------
C1 	Ceramic Disk Capacitor 	package THT; rated voltage 200V; capacitance 22pF; capacitor type Ceramic
C2 	Ceramic Disk Capacitor 	package THT; rated voltage 200V; capacitance 22pF; capacitor type Ceramic
C3 	Ceramic Disk Capacitor 	package THT; rated voltage 200V; capacitance 22pF; capacitor type Ceramic
C4 	Ceramic Disk Capacitor 	package THT; rated voltage 200V; capacitance 22pF; capacitor type Ceramic
DIN1 	DIN-5 jack (MIDI) 	package THT; form jack (female); pins 5
J1 	Generic double row male header - 28 pins 	package THT; hole size 1.0mm,0.508mm; row double; form ♂ (male); pins 28; pin spacing 0.1in (2.54mm)
R1 	220 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 220Ω; pin spacing 400 mil
R3 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R4 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R5 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R6 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R7 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R8 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R9 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R10 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R11 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R12 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R13 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R14 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R15 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R16 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R17 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R18 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R19 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R20 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R21 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R22 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R23 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R24 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R25 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R26 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
R27 	390 Ω Resistor 	package THT; tolerance ±5%; bands 4; resistance 390Ω; pin spacing 400 mil
U1 	atmega328 	package DIP28 (Dual Inline) [THT]; version Atmega328-20PU; type ATMEGA328
U2 	atmega328 	package DIP28 (Dual Inline) [THT]; version Atmega328-20PU; type ATMEGA328
XTAL1 	Crystal 	package THT; frequency 16 Mhz; type crystal; pin spacing 5.08mm
XTAL2 	Crystal 	package THT; frequency 16 Mhz; type crystal; pin spacing 5.08mm

Step 4: Writing the Code

Picture of Writing the Code

First, I researched all over the internet about MIDI communication and commands.  Luckily, I had experience from my previous project: my Arduino MIDI drum set.  I used the same set of code for the bass drum pedal that is used on all the organ foot pedals.

When a pedal is pressed, the command is sent to turn on the note at a certain velocity.  The potentiometer (volume pedal) is used to determine that.  It gives values from 0-1023.  The map function is used to proportionally map that number to another number between 0-127.  To turn a note off when the pedal is not pressed, the same command for that note is sent, except the velocity is 0.

Having the arduinos send that command when a pedal is pushed using an "if" statement in the loop would work except it would send that command every time the loop repeats when the pedal is down.  If the "else" statement is also used to send the command to stop the note (velocity 0), then the arduinos would send that command for every pedal that's not pressed every time the loop repeats.  The arduinos and synthesizer couldn't handle sending or receiving all that data.

To fix this, the arduinos must send the command to play a note ONCE after the pedal is pressed.  They must also do the same for when the pedal is released.  In order to do this, the arduinos must "remember" the last state (pressed or not-pressed) the pedals were in the last time the loop repeated.

To add that feature, I made a "last state" variable.  The first thing the arduinos do after sensing when a pedal has been pressed is compare the last state they were in to the state they are now.  This makes it possible for the arduinos to send the command for a note ONCE when it has been pressed and ONCE when it has been released.

Because there are two Arduinos, there are two programs that are written.  It's simply copying the first one and pasting it into a new project and changing all the notes.  Remember that one program will use one more note than another!

BOTH Arduinos need to send commands on the SAME MIDI channel.  I used MIDI channel 1.

To get the arduinos to send MIDI data read over this guide: http://arduino.cc/en/Tutorial/Midi.  I don't send the notes or velocity in hexadecimal.  Decimal works perfectly because the Serial.write(); command sends it as a byte.

There are two programs attached in the zip file; one for one ATmega, another for the other.

Step 5: Programming the ATmegas

Picture of Programming the ATmegas

Insert one of the ATmega ICs into the Arduino to program it.  Try not to press it into the seat all the way or else it will be hard to remove.  After it's programmed, use a small screwdriver to pry it loose slowly, starting on one end, then the other, back to the other end, etc. until it is removed.  Place it onto the newly made circuit board.  Be sure you put the IC that is programmed for 13 notes in it's place and not in the 12 note place IC seat.  After both ICs are programmed and placed on the board, it should be ready to connect to the foot pedals!

Step 6: Hook It Up! Try It Out!

Picture of Hook It Up!  Try It Out!

Wire the other end of the connector to the pedals and plug it into the circuit board and the foot pedals together.  Also, plug the MIDI wire into the synthesizer and the power adapter into the power supply on the circuit board.  Power up the synthesizer and start playing!

Step 7: Enclose and Finalize the Project

Picture of Enclose and Finalize the Project

You may use whatever you desire to enclose the exposed electrical parts.  We used some scrap wood that remained from the organ.  Also, we used the power switch and power indicator light from the organ.  Using the volume pedal from the organ was a thought that occurred after realizing how much of a pain it is to turn a potentiometer with your feet.  It's recommended that the volume pedal is used.

Step 8: Video Demonstration

Here is a video demonstrating the Arduino MIDI Foot Pedal Keyboard's functionality.  Don't mind me trying to get the potentiometer to budge! The bare potentiometer was later replaced with a volume pedal.

Thanks for reading! Happy Building!

 

 

Comments

GeorgeLuther (author)2015-06-03

Awesome! Does anyone know what to do to make this but with polyphonic velocity and position/aftertouch?

webweave (author)GeorgeLuther2015-10-25

Hi GeorgeLuther, did you find any projects with poly/aftertouch?

jamosdelnorte (author)2015-03-12

Cool. You mean synthesizer, though, not sequencer: a sequencer generates MIDI data, it doesn't make sound.

roycetaft (author)jamosdelnorte2015-03-12

You're right! Thanks for the correction.

dwebber4 (author)2014-05-27

This is a really cool project. I've been playing with a modded 13 note version of. Is there any way to add a program change (up/down) to the code?

roycetaft (author)dwebber42014-05-28

Here is a link describing General MIDI messages:

http://www.midi.org/techspecs/midimessages.php

Notice that the command to send to request a program change is

1100nnnn.
nnnn is the MIDI channel, which in our case is 0. Using the calculator
built into Windows set in programmer mode, you can enter 11000000 in
binary and convert it to hex. It is 0xC0. Then the program number is
sent. I suggest sending it in decimal because it's easier to keep track
of. The program number goes between 0 - 127. Here is a chart of these numbers and corresponding programs:

http://en.wikipedia.org/wiki/General_MIDI#Program_...

In
order to add this to the code, you would have to write a new function.
Name it something like ProgChange. It would be identical to the noteOn
function in my code, except it would only send two bytes instead of
three.

It could look something like this:

void ProgChange(byte cmd, byte data)

{

Serial.write(cmd);

Serial.write(data);

delay(10);

}

You
would have to write some code that allows you to scroll up and down
through these programs, making sure to de-bounce the switches so it
doesn't jump past programs. This summer I'm planning on either adding
to or rebuilding the microcontroller portion altogether. I'd like to
add a little display with some buttons for transposing the pedals up and
down. Thanks for the feedback!

Rudz (author)2013-04-08

Nice work! Check out open source software called Fritzing to do your schematic.

roycetaft (author)Rudz2013-04-21

Thank you again for introducing me to Fritzing. It's very helpful! I have now included a schematic of the circuit!

roycetaft (author)Rudz2013-04-08

Thanks! I'll check it out!

wgill1 (author)2013-04-08

It's a pity you had to scavenge a classic *working* organ, but hey, it's a great project nonetheless!
Please post the code! I'd like to see it :-)

roycetaft (author)wgill12013-04-21

I finally got around to uploading the code!

roycetaft (author)wgill12013-04-08

I will do! Thanks for the feedback!

caitlinsdad (author)2013-04-08

Nice. Is this polyphonic, or does it mess up the arduino scanning when you hit a whole bunch of notes at the same time?

roycetaft (author)caitlinsdad2013-04-08

It seems to read all the notes just fine when multiple are pressed at once. As I mentioned in the programming step, I haven't uploaded the code yet. It simply checks whether the inputs are HIGH or not and compares that with the state they were in the last time the loop ran its cycle. Is it possible that it could mess up the Arduino scanning? I'm not experienced with Arduino programming, so it could be very possible and I just haven't seen it happen yet.

caitlinsdad (author)roycetaft2013-04-08

thanks, it's just me knowing a bit about early keyboard synths that had high or low note priority when they were limited to monophonic voice production. I think microprocessors are fast enough and the MIDI protocol robust to alleviate those problems. There is the MIDI "panic" or all off signal to use when things get locked up. Everyone wants a set of Moog Taurus pedals, they are so dang expensive.

gmoon (author)2013-04-08

Ahh! I've been planning to build this exact thing--I've got three footpedal boards from scavenged organs (mostly after the output and power transformers), and was looking at an Arduino / MIDI shield combo...darn it...

Very nice job, BTW.

roycetaft (author)gmoon2013-04-08

Thanks for the feedback! I think you should try to build one and share your experiences!

About This Instructable

39,109views

48favorites

License:

Bio: I'm an Electrical Engineer working out of Northern California with a never ending interest in repairing and creating.
More by roycetaft:Homemade GameCube Mod-ChipArduino MIDI Foot Pedal KeyboardArduino MIDI Rockband Drumset
Add instructable to: