
Once again, playing the guitar and controlling the sound through Peavey ReValver and other Amplitube, I thought about purchasing a MIDI controller. Branded devices, like Guitar Rig Kontrol 3, cost about 13,000 rubles, and have only outdoor performance. That is, to quickly change the position of several regulators is very problematic.
Various DJ controllers looked more interesting due to the abundance of faders and encoders. It was decided to combine business with pleasure and make the MIDI controller itself.
Initial requirements: 2-7 faders, as many rotary potentiometers / encoders, about 10 buttons, USB connection.
')
Then I began to choose components. Arduino chose because of availability, in principle, you can use the same ATmega32u4, STM, or another controller. Faders and buttons found in the local radio store. Encoder and potentiometers have already been purchased. Toggle switches found in the garage. Case decided to make a top cover of the DVD player.
Accessories:
- Arduino UNO R3 1 pc.
- Fader sp3-25a 5 pcs.
- Mouth. potentiometers 3 pcs.
- Encoder 1 pc.
- Buttons pbs-26b 16 pcs.
- DVD cover 1 pc.
- Toggle switches 2pcs.
At first I bent the casing and sawed through it a hole in the fader holes:

Then he drilled holes for toggle switches and a mouth. potentiometers, marked the position of the buttons. Since I did not have any drills at 19 (and I didn’t have the corresponding chuck for the drill), I drilled holes for the buttons at 13 and then increased the sweep.

The base is ready, now you can think how to connect all this stuff to the Arduino. While studying this issue I came across a wonderful project
HIDUINO . This is the firmware for the ATmega16u2 on board the Arduino, thanks to which the device is defined as a USB-HID MIDI device. All we have to do is send MIDI data over the UART at 31,250 baud. In order not to clutter up the sources with defines with MIDI event codes, I used
this library .
Since I used Arduino, I decided to make a shield to which all the peripherals will already be connected.
Schild scheme:

As can be seen from the scheme of the button connected in a matrix scheme. The built-in pull-up resistors are ATmega328, so the logic is inverse.
Button Initializationfor(byte i = 0; i < COLS; i++){
Reading values for(byte i = 0; i < COLS; i++)
I forgot to place diodes on the seal, I had to solder to the buttons.Potentiometers are connected through the multiplexer 4052b to the inputs of the ADC.
Potentiometer reading for(byte chn = 0; chn < 4; chn++)
Encoder hung on hardware interrupt.
He made a printed circuit board in the Sprint layout, then made
it with the good old
LUTs using self-adhesive film and ferric chloride. The quality of soldering suffers from terrible solder.
Ready Shield:


To fill the firmware in ATmega32u4, I briefly closed 2 ICSP pins, then used
Flip . Later connected to these pins button.

The firmware works, it remains to fasten the walls and the front panel. As I marked everything in place, it took more time to draw the panel than on everything else. It looked like this:
- 1. Graph paper was set as a background image.
- 2. Marked holes
- 3. Received output
- 4. Cut all holes
- 5. Unscrew and remove all elements.
- 6. Install the panel, put all the buttons / potentiometers in place
- 7. There were inconsistencies between the template and the case.
- 8. Go to step 2 until all holes match.
The panel is made of millimeter PET, covered with film with a print and lamination, the holes were cut with a laser on the cdr file. Irkutsk advertisers cost me only 240 rubles.

The side walls cut out of plywood.
View of the device at the moment:

Cost of components:
- Arduino UNO R3 320 p.
- Fader sp3-25a 5h9 = 45 p.
- Mouth. potentiometers + knobs 85 p.
- Encoder 15 p.
- Buttons pbs-26b 1619 = 304 p.
- Panel 240 p.
- Multiplexer 16 r.
- Plywood, PCB, toggle switch, DVD case - in my case for free.
Total: 1025 rubles.
The controller copes with the tasks assigned to it and steers the sound in almost any audio processing program.
Plans to cover plywood with stain and cut the bottom cover from plexiglass. Also add an expansion port for connecting a floor controller.
Code for Arduino and signet on github:
https://github.com/vlr-baik/MyMidiMaterials on the topic