A MIDI controller can send and receive MIDI messages to your PC, allowing direct control of your software. Not only that, but the controls can generally be mapped to anything your like. So what might be a volume fader for one person can be an effect filter for another.
This article will describe how to build and program a custom arcade button MIDI controller, while trying to keep the price below $100. It is aimed at electronics and programming novices.
Remove these ads by
Signing UpStep 1What You'll Need
Required Components
1 x DFRduino (cheaper Arduino clone) $28.80
1 x USB cable (A to B connector, like that on a printer) $3.95
1 x Plastic enclosure $15.75
12 x Sanwa 24mm arcade buttons $26.28 (USD)
4 x 10k linear potentiometer $4.88
4 x Pot knobs $3.80
2 x 10k linear sliding potentiometer $7.54
2 x Slider knobs $2.04
5 x 10mm M3 nylon threaded spacers $2.00 (I got a bag of 25 for $9.95)
4 x 16mm countersunk M3 screws $1.00
3 x 4mm M2 self tapping screws $0.75
1 x 4.7 kΩ resistor $0.10
4 x stick on rubber feet $2.00
Total $98.89
All of the above can be found at most online electronics stores (I use the excellent Little Bird Electronics ), except for the Sanwa arcade buttons which can be found at arcade replacement parts stores, or from DJ TechTools . It pays to purchase one or two spare buttons and perhaps a spare potentiometer in the event that the part is faulty or you accidentally make it faulty.
Required Tools
Soldering iron
Solder
Wire stripper
Small gauge stranded wire (22 AWG), preferably in three or more different colours
About 1m of 2.5mm heat shrink
Power drill or drill press
Drill bits (2mm, 3mm, 7mm, and 11mm)
Spade bit (24mm) $12.49
Countersinking bit
10mm hexagonal wrench or spanner
Needle-nose pliers
Small riffler files $15 for pack of 10
Regular file
Phillips-head screwdriver
| « Previous Step | Download PDFView All Steps | Next Step » |




























![Beatfly : Make an illuminating blimp and control it with your voice, Keyboard, MIDI Controller, Garageband file, iPhone, Flash, and more! [Mac OSX]](http://img.instructables.com/files/deriv/F1M/MOZ0/G56ZPYN9/F1MMOZ0G56ZPYN9.SQUARE.jpg)


















So exactly what number of buttons and pots could be used?
I also noticed they have a Teensy ++ http://www.pjrc.com/store/teensypp.html
which would just allow for more buttons and pots?
How hard or would it even be possible to put in some sort of jog wheel/ scratch wheel into this set up? Meaning is it possible to do with the teensy?
thanks for your prompt reply!
If you did go with the Teensy, you'd first have to load the sketch on to it from the Arduino software. From there all you'd need to do is plug it in and configure the MIDI mapping in your DJ software.
There are up to 12 analogue inputs and 13 digital IO for the Teensy 2.0 (you can have up to 25 digital IO, but you must use the analogue input pins). The Teensy++ 2.0 has 8 analogue inputs and 38 digital IO (or up to 46 digital IO when using the analogue pins). So it has more digital IO, but fewer analogue inputs.
Adding a jog wheel (aka a rotary encoder) to the setup would require some code changes to the sketch. I'm in the process of doing a complete rewrite of the source code, and hope to include more IO options such as jog wheels. It won't be done for a while yet though.
Thanks for the great instructable! :)
You'd need to setup larger arrays for the button states coming in from the shift registers, and some logic to determine when you are reading from the on board IO and when you are reading from the shift registers.
Adding an analogue multiplexer would require similar changes, with larger arrays and on board/multiplexer logic.
So in short it's not a total rewrite, but does require a number of software and hardware changes.
I just learned about the Arduino Mega and Mega 2560... Would it be easier to use one of them over the Teensy++? Does your code already support it?
The advantage of the Teensy is that it can act as a true USB-MIDI device, unlike the Arduino which requires software on the PC to convert its serial messages to MIDI. The other advantage is that it's a fair bit cheaper.
That said, if you just want more I/O then the Mega should be fine and won't require any code changes.
I went ahead with the teensy 2.0 and will be putting it all together here in the next couple of weeks. I would be very interested to see what you come up with the jog wheel though. If you do figure that out it would be very highly appreciated if you contacted me about it. just let me know the best way you would like to contact me.
Ill let you know how my custom case and final product turns out. Thanks again for the replies and great work you have done here!
But im a little bit newbie and i don't understand the code.
Is there any one who can explain me how to map the certain knob to a midi message.
For example if i want A0 input to control volume which is CC 0x07 and A3 to control pan on CC 0x0A?
Boye.
To send a different control for each analogue input, you'll need to add a switch statement (or a few if statements) in the code which reads and processes the analogue inputs.
For example replace the line of code (on lines 436 and 446):
controlChange(MIDI_CHANNEL, MIDI_CC + i, analogueInputs[i]);
with
switch (analogueInputMapping[i])
{
case A0:
controlChange(MIDI_CHANNEL, MIDI_CC_VOLUME, analogueInputs[i]);
break;
case A3:
controlChange(MIDI_CHANNEL, MIDI_CC_PAN, analogueInputs[i]);
break;
default:
controlChange(MIDI_CHANNEL, MIDI_CC + i, analogueInputs[i]);
break;
}
The above code segment will check what analogue input is currently being processed using the switch statement, then execute the corresponding case statement. So if analogueInputMapping[i] is equal to A0, then case A0 will run. If analogueInputMapping[i] is equal to A1, then the default case will run as no specific case has been setup for A1.
You can add more cases (before the default case) to handle other analogue inputs.
I have read all the comments on this and heard a lot about the "tweeny"
What advantages and what disadvantages would using the tweeny over the arduino have.
thanks!
James
I have built the device according to your instructions, it looks and operates identically to yours, but have run into a small cross-platform issue. While it works flawlessly in Windows I find that there is lag on several buttons in Mac OS X 10.7. Specifically buttons 5,7,8,9,10. Everything else runs well in Mac OS X. In Windows 7 every button is perfect.
Could you kindly help as I run my dj software on my macbook?
Note : I installed the latest version of the Mac FTDI 2.2.16 driver and manually checked it had loaded successfully "kextstat | grep FTDI".
Note 2: I uploaded your latest MIDI Controller sketch also.
Regards,
Superevensteven.
I'm still surprised that the device worked on Windows with just the digital inputs (internal pull up resistors) ????
I've ordered a midi to usb convertor cable so I can use the innards to translate the serial midi messages via the Tx as native midi.
Cable cost me $7 on ebay.
Here is the original article : http://shiftmore.blogspot.com/2010/01/quick-and-dirty-arduino-midi-over-usb.html
As the author puts it, it's a quick and dirty way, but it works.
Sometimes devices can still function even when a ground hasn't been wired up. It's more of a case that the signal just happens to float on the "correct" side of TTL/CMOS logic.
I've run into a similar thing at work with a project that was driving 16 relays. Everything seemed to work when driving 3 or 4 relays, but any more than that and they all suddenly shut off. After thinking I was shorting something out or drawing too much power, I realised the ground signal for the relay board wasn't connected. Doh!
How'd you go with the MIDI to USB cable?
I desoldered the two lights from the main convertor circuit board and just added some extension wiring so I could pop it through the top of the dj midi controller case. Looks sick! :D
I also modded your arduino sketch so it recognizes simultaneous button presses. I'm a Java developer with some very minor C/C++ experience and I found your code very well written. I modified a few things but it's no criticism of your coding style rather just to help me better understand it all and add in the combo button detection. Hopefully I've written it clear enough so you can modify it to suit yourself if need be.
Many thanks again as it's an absolutely wicked piece of hardware, in some respects I find it superior to my NI Kontrol X1 usb midi controller. The guys at my work absolutely shat themselves when I brought it in. I left it on my desk and it attracted so many curious people lol. My denon cdj turntable is gathering dust now.
Here's a video explaining how this all looks/works : http://youtu.be/aXHyxQLN9kk
Here's my arduino sketch with the combo buttons : http://www.mediafire.com/?7a01rbsy7c040jb
Regards,
SuperEvenSteven
for example, if you press the buttons lightly, it will produce a quieter sound than when you press it in hard
If you wanted to have control over the loudness of the sound, Force Sensitive Resistors (FSRs) would be an option. Here's a nice intro to them and how to hook them up to an Arduino: http://www.ladyada.net/learn/sensors/fsr.html
thanks!
Another way would be to compile the teensy code as normal, but then flash the hex file using an In-System Programmer directly to the chip, and not having a bootloader at all. That said, a bootloader makes things much easier, so use a bootloader if you can!
If you need even more analogue inputs, or want to expand on the Arduino Uno's 6 analogue inputs, then you'll want an external analogue to digital converter chip. This is more complex as you'll have to handle communications between the Arduino and the chip, plus you'll need to give up a few pins to connect to the chip.
This is a great source of information helping for my own project im working on. One thing im adding is a series of midi joysicks. As you know the limitations of the Arduino also limits how many knobs, sliders, and switches. If customization are the most important, and cost of parts is irrelivent (as in my case) I am designing my case to house a 10 port USB hub that supplies it own 12v to each USB device so as not to overload motherboard resources. If this can work, potentially I could expand your idea 10X over a single USB port on my tower. Having this will ultimately give me a individual controller similar to yours for each of the 8 - 1/4" TRS analog inputs on my soundcard. And the fancy would be the mini joystick at the top of each channel to use for 5.1 surround sound automation in recording software like Sony Vegas and Sonar. I have also considered to replace the Arduino with a $5 USB gamepad that may take a bit of tweeking to perfect; still I should potentially get 16 channels of midi for each USB device. 10 USB ports X 16 channels midi = 160 channels of midi recognized by the software.
Is my thinking logical or am I way off the rocker with this one????
Really good Instructable, quite informative and descriptive. I plan to go down the Arduino route but will use Hiduino so that it transmits MIDI over USB, rather than needing an external soft or hard converter. Once I've flashed Hiduino, do you think I'll be able to use your sketch still?
Also, does your sketch automatically transmit any change as a CC message, or will I need to code each output individually? Also, I plan to use a lot more buttons and pots than you have, will the sketch need to be adjusted?
Thanks,
Ashley
I'm using an Arduino Mega 2650, as a test i've connected pin 13 as the only button on the board. Before starting the Serial_Midi_Converter program all LEDs are off on the board. But after i started the program the TX LED stays on.
This means there is constantly data transferred? Does someone has an solution for this?
Thanks
This basically means that the analogue input pins don't have a reference input (ie ground or +5V). So they'll 'float', picking up any electrical noise. This doesn't happen on the digital inputs as they are internally pulled high to +5V.
There are two ways to fix the floating inputs.
1) The first way would be to 'tie' each input to ground. This means simply connecting each analogue input pin to the Arduino's ground (a breadboard makes this easy).
2) The second way would be to modify the sketch so no analogue inputs are read. There are a couple of #defines which specify how many analogue inputs there are, and what analogue input pins are used. If you look at line 120 of the sketch, you'll see a #define NUM_AI 16. Change this to #define NUM_AI 0. Then on line 181 change #define ANALOGUE_PIN_ORDER A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15 to #define ANALOGUE_PIN_ORDER (note there are no pins here).
Hope this helps!
The one thing which does affect the voltage divider is whether the pot is linear or logarithmic. You'll want to use a linear pot.
Thanks