Step 5: Wiring

With all of the components securely fitted inside the enclosure, it's time to work out what needs to be wired where.

The ATMega328 chip used on the Arduino contains internal pull-up resistors, so we won't need to wire individual resistors for each of the arcade buttons. This greatly simplifies the controller wiring. So all that needs to be done to wire the arcade buttons is to solder one leg to ground, and connect the other leg to one of the digital inputs on the Arduino board.

That said, pin 13 can not be used as a digital input with the internal pull-up resistor. See the pullup resistors section in the Digital Pins article on the Arduino website for the reasons why. For this pin we'll be using an external pull-down resistor. If you're unsure what a pull-up/pull-down resistor does, check out this great tutorial on ladyada.net .

Wiring the potentiometers requires a ground wire, a wire to the one of the Arduino analogue inputs, and a third +5V wire. As the potentiometer is rotated or adjusted, the resistance of the potentiometer changes between the ground and +5V wire. According to Ohm's law, voltage = current*resistance, so with a constant input current and a variable input resistance, the output voltage will be variable. It's this variable voltage that the Arduino reads on the analogue pins.

The attached wiring diagram (created with the great Fritzing software) shows how to wire up each of the components to the Arduino board. The black wire represents ground, the red wire represents +5V, the purple and orange wires are digital inputs to the Arduino, and the blue and green wires are analogue inputs to the Arduino. Note that the ground wires and +5V wires have been bridged between the buttons and potentiometers.

Before proceeding to the next step you may find it helpful to print out a copy of the wiring diagram to refer to whilst you solder.
<p>Hello! i made it but i use reason and i can't make it work as i want on the kong pad. i can't assign buttons on pads. i'm really sad about this. i hope you can help me</p>
<p>//BUTTONS x16</p><p>int buttons[16]= {</p><p>1, 5, 10, 14,</p><p>2, 7, 11, 15,</p><p>3, 8, 12, 16,</p><p>4, 9, 13, 17</p><p>};</p><p>// FORMAT &lt;----&gt; //&quot;BTN#&quot; &quot;NOTE&quot;\\ </p><p>//----------------------------------------------------------</p><p>// BANK 1 BANK 2 BANK 3 BANK 4</p><p>// *C-1* *C#-1* *D-1* *D#-1*</p><p>//----------------------------------------------------------</p><p>// 1 - C3 | 1 - E4 | 1 - G#5 | 1 - C7 </p><p>// 2 - G#2 | 2 - C4 | 2 - E5 | 2 - G#6</p><p>// 3 - E2 | 3 - G#3 | 3 - C5 | 3 - E6 </p><p>// 4 - C2 | 4 - E3 | 4 - G#4 | 4 - C6 </p><p>// 5 - C#3 | 5 - F4 | 5 - A5 | 5 - C#7</p><p>// 6 - A2 | 6 - C#4 | 6 - F5 | 6 - A6</p><p>// 7 - F2 | 7 - A3 | 7 - C#5 | 7 - F6 </p><p>// 8 - C#2 | 8 - F3 | 8 - A4 | 8 - C#6 </p><p>// 9 - D3 | 9 - F#4 | 9 - A#5 | 9 - D7</p><p>//10 - A#2 | 10 - D4 | 10 - F#5 | 10 - A#6 </p><p>//11 - F#2 | 11 - A#3 | 11 - D5 | 11 - F#6</p><p>//12 - D2 | 12 - F#3 | 12 - A#4 | 12 - D6</p><p>//13 - D#3 | 13 - G4 | 13 - B5 | 13 - D#7 </p><p>//14 - B2 | 14 - D#4 | 14 - G5 | 14 - B6</p><p>//15 - G2 | 15 - B3 | 15 - D#5 | 15 - G6 </p><p>//16 - D#2 | 16 - G3 | 16 - B4 | 16 - D#6 </p><p>//TOPBANKS x4</p><p>int topbanks[4]= {</p><p> 18, 19, 20, 21</p><p>};</p>
<p>Please help me, How can i do to have 4 banks in ableton?</p>
<p>Hello, how could I do to know the status of each pushbutton using leds, for example if in traktor is configured a pushbutton like hold, toggle or direct, I am using an arduino UNO, 11 digital and 5 analog like digital to be able to use 16 pushbuttons like The midi fighter, I just lack the subject of the leds, I do not understand, can someone help me please?</p>
<p>You would need more digital outputs, and in this case you are using all of them, so there's no way out of the box to do that. Like he said in the tutorial, you would need shift registers, or multiplexers, to do that. This way you'll have many more inputs/outputs in your Arduino. Other way out is using another Arduino or Teensy board with more in/outs built in, like the Arduino Mega, or the other Teensys. The code is optmized for that.</p>
<p>Hi thanks for replying, I have the MEGA arduino, how can I modify the code so that the LEDs work that way?</p>
<p>do you speak Spanish?</p>
<p>I think this was the first tutorial that I've seen when I first tried to make my own controller, back in 2013. Now, I even have my website and teach people how to make this stuff. Thanks for that! </p>
<p>Hello, how could I do to know the status of each pushbutton using leds, for example if in traktor is configured a pushbutton like hold, toggle or direct, I am using an arduino UNO, 11 digital and 5 analog like digital to be able to use 16 pushbuttons like The midi fighter, I just lack the subject of the leds, I do not understand, can someone help me please?</p>
<p>If anyone had a problem where if you had two potentiometers in analog inputs A1 and A2 set to control two different parameters (say Gain and HI EQ) twisting eiter potetiometer would control both parameters! in fact any potentiometer in any port would cross over and and effect any assigned value. </p><p>for my Card (Mega 2560 clone) i had to change the analog pinmode from </p><p>INPUT</p><p> to </p><p>INPUT_PULLUP<br></p><p>(in the code under where it says :</p><p>// Set the pin direction to input.)</p><p>hope it helps anyone</p>
<p>Awesome tutorial!</p><p>I have one question. If the arcade buttons have three legs instead of two, is it the same soldering process???</p>
my slider value keeps shaking small movements. and my slider moves up only from half of the slider. i have identified that my connections are correct. please help
<p>It does not work with hiduino , as I can fix that ?</p>
<p>change serial to Serial.begin(31250);</p>
<p>Very cool tutorial. Thanks! I used Hairless Midi to convert Serial to Midi, very useful to debug the midi messages and check that everything is working.<br><br>Maybe you should have explained how to test a slider potentiometer and determine where the wiper is, as the provided wiring won't work with any model.<br><br>The case I used is a biscuits box that I stripped, sanded and clear coated. On the back of the lid, I have a thin layer of wood so the buttons have enough material thickness to properly clip (the potentiometer second holes are also drill in the wood only).</p>
<p>can someone give me the program code for 4x4 controller</p><p>Stuck for almost a month...</p>
looks great, I am going to give this a shot...but my only confusion is with how you mounted the board. the teensy has no holes
Hi, <br> <br>I really like your project and i wanna build that! I'm just planning to build it with 4x4 buttons. Could you help me with the schematic? <br> <br>thank you
Here's an updated schematic for a 16 button controller. Note that pin 13 is not used here, so you don't need the pull-up resistor. Instead the button is connected to pin A0, and the extra 4 buttons connected to pins A1 to A4. <br> <br>The sketch will also need to be modified to match the 16 button layout. Let me know if you need any help with making the changes.
<p>if using this scheme , how about the program ? changed or remained the same ?</p><p>tngks :)</p>
<p>I'd absolutely adore it if you made a tutorial for how to accomplish LED feedback (LEDs lighting up) by pressing the triggers.</p>
<p>nice project! I need to build an only 4 button midi controller for Qlab,<br> would it be necessary to change something from the Arduino code?(I'll be using an old Duemilanove) thanks.</p>
<p>hey brother can you help me code a 2 channel mixer for traktor ,i am pretty much trying to mock the pioneer djm s9 ,specially the hotcue pads and the loop section ,</p>
<p>So, I couldn't find an enclosure so I decided to improvise. </p>
<p>Couldn't get any potentiometer neither, I had to change the code to work with just the digital inputs. Great project.</p>
<p>Help needed here. I'm a noob when it comes to programming. I downloaded the required TimerOne lib and get the following error after compiling the sketch:<br></p><p>MIDI_Controller.pde: In function 'void controlChange(int, int, int)':</p><p>MIDI_Controller.pde:335:29: error: 'BYTE' was not declared in this scope</p><p>Error compiling.</p><p>The sketch i used was &quot;MIDI_Controller_2011-02-22.zip (4 KB)&quot; </p><p>Thanks in advance! XD</p>
very great project! I made a old arcade pad with your sketch and it will be so cool! fo real Hid support, i have uploaded Hiduino to the bootloader and change the serial baud rate of your sketch to 31200 and it's function perfecly! i want to put some led on backlighting of the arcade button but I have independently digitalpin output for each and I dont know how I can map it in your sketch for when I push a button the led bring on it. if you can help me, I can post a photo of the finished project ^^. thanks a lot
<p>Or a joystick for XY effect</p>
<p>How hard would it be to make a larger scale version of this? Could you chain a second Arduino to it? Would the program have to be modified? Would also love LED lights.</p>
Hey nice project! I would like to know if it is possible to use this to control for example game volume, skype volume and web browser volume separately on windows? How do I do that? Is it possibble?
<p>what midi maping software do you use?</p>
<p>Can i use a volume pedal (behringer fcv100 with 50k lin. ) instead of the potentiometers?</p>
<p>Hey, great project. helped my big time. How about multiplexing? i would like to use uno or leonardo board but i want 16 buttons. So could someone say some advice about the multiplexing or just use the mega or tensy ++?</p>
<p>HEY GREAT PROJECT; just what I was looking for. Has anyone tried to use it with MAC?</p>
<p>Hi, I'm thinking of switching the Arduino board for the Teensy 2.0. Would I have to desolder the pull-down resistor on pin13 or could I potentially just leave it there?</p><p><br>Also, would I need to skip pins D2 (RX) &amp; D3 (TX) if the teensy isn't using serial communication? I was planning to wire it like this:</p>
<p>Hi thanks for your instructable! Everything is going well but I was just wondering if it was possible to setup the pushbuttons to be used as a piano keyboard? Like with a DAW or something?</p>
<p>By default, it is set up to do exactly that. The first button plays C, the second plays C#, the third plays D, and so on. :)</p>
<p>Omg got it, thanks! Is there anyway to remap the buttons so it starts on C3, followed by C#3, D3...? Also, I know the layout of the buttons follow the Midi Fighter's bottom to top order but is there a way to change it so it goes from top to bottom? Thanks so much for your help! I really appreciate it (:<br>I'm loving the controller!</p>
<p>Don't worry I found it! For anyone who wants to know, I replaced lines 159 to 178 with this:<br><br>#else</p><p> #define MIDI_CHANNEL 1</p><p> // First note, starting from upper left button</p><p> #define NOTE NOTE_C2</p><p> // This pin order corresponds to the top left button being zero, increasing by one as we move from left to right, top to bottom</p><p> // 0 1 2 3</p><p> // 4 5 6 7</p><p> // 8 9 10 11</p><p> // This array size must match NUM_DI above.</p><p> #if defined(ARDUINO_MEGA)</p><p> #define DIGITAL_PIN_ORDER 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53</p><p> #elif defined(TEENSY_PLUS_PLUS)</p><p> #define DIGITAL_PIN_ORDER 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37</p><p> #elif defined(TEENSY_2)</p><p> #define DIGITAL_PIN_ORDER 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</p><p> #elif defined(TEENSY_PLUS_PLUS_2)</p><p> #define DIGITAL_PIN_ORDER 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37</p><p> #else</p><p> #define DIGITAL_PIN_ORDER 10, 11, 12, 13, 6, 7, 8, 9, 2, 3, 4, 5 </p><p>#endif<br><br><br></p>
<p>Great project you have here, it's just perfect</p><p>I made my own with just 8 pots instead of all the sliders and buttons; they all work fine except one, which gives a &quot;MIDI feedback shortcut&quot; error, and says not to connect the in and out to the same port. Oddly this only seems to happen with the one port. Any ideas?</p>
<p>Actually it sometimes works, but I have to use LoopBe30 and route it through 2 different ports with HairlessMIDI (instead of MIDI Yoke since Windows 8)</p><p>IDK what's up with that</p>
Do the push buttons need to be momentary or lock? <br>
<p>somebody help me please... i have arduino micro, can i use it as Midi controller??? i'm new on this community... please help me...</p><p>the circuit diagram also...</p>
<p>Hello such , I am Argentine and I'm doing the midi controller . USE sorry for translators .<br>My problem is this , I can not load the program to Arduino entiedo Not For Long . I hope your help. thousand thanks</p>
<p>I want to use only 16 buttons, as I do?</p>
<p>for arduino nano is necessary to modify the code ? that's ok?:</p><p>#if defined(__AVR_ATmega328__) || defined(__AVR_ATmega328__)</p><p>#define ARDUINO_NANO</p><p>#elif defined(__AVR_ATmega328P__)</p><p>#if defined(ARDUINO_NANO)</p><p> // Number of digital inputs. Can be anywhere from 0 to 68.</p><p> #define NUM_DI 13</p><p> // Number of analogue inputs. Can be anywhere from 0 to 16.</p><p> #define NUM_AI 8</p>
<p>Help me ! when i run the code i get this error <br>'PIN_D6' was not declared in this scope</p>
<p>It's been a few months since this was asked so I doubt you still need help. For others like me who might also run into this issue, I was able fix this by making some changes to the code(just a heads up, very minimal programming experience). Basically, seems like the code was detecting my leonardo as a teensy or something so I commented out the teensy #defines at the top:</p><p>#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)</p><p>#define ARDUINO_MEGA</p><p>//#elif defined(__AVR_AT90USB646__)</p><p>//#define TEENSY_PLUS_PLUS</p><p>//#elif defined(__AVR_ATmega32U4__)</p><p>//#define TEENSY_2</p><p>//#elif defined(__AVR_AT90USB1286__)</p><p>//#define TEENSY_PLUS_PLUS_2</p><p>#else</p><p>#define ARDUINO</p><p>#endif</p>
if i wanted to change the code so that the digital buttons sent a simple on/off signal instead of playing a note how could i do that
<p>yes, how do I do this? Apparently it is not possible through Ableton so it probably needs to be programmed in. </p>

About This Instructable




More by fraganator:Arcade Button MIDI Controller 
Add instructable to: