Introduction: Lune - MIDI Controller With Arduino (for DJ or Musician)
Introduction
This my first Arduino (microcontroller) project name Lune. I wanted to learn Arduino with a usefull and large project so I decided to make a MIDI DJ controller.
MIDI is a informatic language understand by electronical music instruments (as synth) or Digital audio workstation (D.A.W) to control parameters (as the "amount of bass" or "lenght of note"). So you can use this controller to do many things.
Every kind of sensor (potentiometer, push button,etc.) can be learn independantly. I think the best way is to learn "how it works" and "how it is connected" for each sensor one by one.
Everything work like this :
- Sensor connected to the Arduino detect a change
- The Arduino send this change to the computer
- A software on the computer converts the serial (Arduino) informations in MIDI that you can use in ableton for example
In details, some sensors send information even when they don't detect a change. They send their actual value, every period of an amount of time (ex: every 2sec).
My controller has :
- 9 axial potentiometers :
- 6 for EQ
- 3 for effects
- 1 encoder for Scratch
- 4 linear potentiometers for Volume
- 4 push buttons :
- 2 for Play
- 2 for Cue
- 2 Ultrasonic sensors (SR04) for effects with the distance of my hands
- 2 "4 buttons RGB led pad"
Step 1: Standalone or Software
First of all, I researched the different tutorials of MIDI controller with Arduino and find out two ways to do it.
Software (easier)
You can do a MIDI controller with a software which translate what you do in MIDI (what I have done).
You will need :
- Software for sending/receiving midi data http://projectgus.github.io/hairless-midiserial/Dont forget to set the baud rate in "preferences" in accordance with the one in your Arduino code (for me 9600 because "Serial.begin(9600);")
- A virtual midi device http://nerds.de/en/loopbe1.html
Example to go further:
https://www.instructables.com/id/Easy-3-Pot-Potentiometer-Arduino-Uno-Effects-Midi-/
Standalone (plug and play MIDI)
You can do a "real" MIDI controller which without a software running on your computer to translate what you do on the controller in MIDI is sending MIDI to the computer.
For the moment with an Arduino Uno or Mega you need to flash the Arduino room or something like that to directly send midi. From what I have understand, if you did this you need to be sure of the code you send on the Arduino because when the Arduino is flashed you can't send anymore code (you need to reflash again ?). I have done many test with my code, so this would have been a nightmare for me.
Example to go further:
https://create.arduino.cc/projecthub/etiennedesportes/ableton-live-midi-controller-9182b3
MAJ 28/02/2018 :
https://www.arduino.cc/en/Reference/MIDIUSB
Arduino official midi reference. The simpliest and cleaner way, if you have microcontroller with native USB capabilities (atmega32u4 based boards or ARM boards). Unfortunately, this is not the case for Arduino UNO.
Step 2: Wood and Case
Wood case design
I used a case generator http://www.makercase.com/, deleted the top and the slot for the top. To determine the height I look for the height of my heightest button and add 2cm.
For the top, I used two boards :
- One MDF wood board
- One Plywood Poplar 3mm which is the one engraved.
Laser cut the wood boards with the plans.
Cut/drilled a hole for the USB cable.
Graphics on my design : montage of Fornaseti artworks and personal drawings.
I have joined my plans.
Warning :
On my plans the two RGB 4 buttons pads are too near each others (like 0,5mm too near).
This rgb part of my design is too loose, it would need more support to endure the force from my hand when I press a RGB button. Could be achieved by distancing the rgb pads or put extra support inside the box.
Assembling
For the sides and bottom, I glued and assembled the different sides wood boards.
After, I screw 4 angles : Each angle as one part screw to a side panel and one side facing the top.
On each of the angle's side facing the top, I glue a nut in the hole of the angle.
This way I can after screw the top wood boards to those 4 angle (without needed access to the nut inside the box).
For the top, I drilled 4 holes (diameter = diameter of my screw + 1mm) through the 2 top wood boards to access the glued nuts.
Then, I screw the 2 top wood boards through the holes and angles.
It's surprisingly solid, but there is surely a better way than glued nuts.
Polish
I used "Vernis bois brillant 125 ml Avel Louis XIII" (french polish) that is working very well.
It was a bit long because I laid several layers and wait 24h between each.
https://www.instructables.com/id/A-Framework-For-Making-Affordable-Stylish-Modula/
Step 3: Electronic
Electronic design
I have put all my electronic design on a Fritzing file.
I recommend when you wanted to do your final montage, to do it before on fritzing because it is hard to see when there is a ton of cables.
For each type of sensor, you need to learn how it is working and what he "communicates" to the Arduino.
To do this, you could watch tutorials on Instructables (ex: "potentiometer arduino").
As a reminder, these are the different types of sensor I used :
- Potentiometer
- RGB pad (Sparkfun https://www.sparkfun.com/products/7835)
- Ultrasound HC-SR04 (distance detector)
- Encoder
- Push button (arcade button)
Order
After knowing all what I want or at least the bigger part I ordered my components. This way you have less shipping costs.
For my part, I order the most on Conrad or RS (I am in France) and more specifical pieces like RGB pad on robotshop.
Attachments
Step 4: Arduino Code
There is my code for arduino. You need to send it (after your changes if you do a different controller) with Arduino IDE to your microcontroller by USB (Youtube has tutorials).
In attachments:
- My final code
- One version, working only with the 2 RGB Pads with 6 colours possible (RGB +cyan+rose+yellow).
- Old parts of code I wrote to learn the different sensors
Some parts are taken, some written by me.
You need to install Arduino libraries (look the error and the "include") like Keypad.h for the RGB pad.
The different classes are at the end of the files.
One classes is here to send the serial information.
"void MIDImessage(byte command, byte data1, byte data2) // --------- NECESSARY, pass values out through standard Midi Command
{ Serial.write(command); Serial.write(data1); Serial.write(data2); }"
Step 5: To Improve
Everything is working, but it is a prototype. There is room for progression.
Energy
In my final design, the pads of the RGB pads shines very little. That is not the case if I use them independently. The 5v power supply from USB could be too few for my project.
Code
I didn't find how to properly program an encoder sensor to match a vinyl controller in a DJ software like Traktor.
Some of my codes for buttons are not optimized for a music application, where we need the fastest responsiveness.
Thanks for reading 😉

Participated in the
First Time Author Contest
16 Comments
3 years ago
Hello, I came across your project. I also make myself midi, such a question: how did you make the LEDs not shine brightly in the mode when they are not involved? I would really appreciate a hint, I just want to make the LEDs light up a bit and when you press the button they light up completely 100 percent. thanks
Reply 2 years ago
Hey sorry for the delay.
For your question, if it doesnt work with my pièces of code. I think you can find it in the officials tutorials for those pads (Sparkfun) or on youtube.
Dont remember exactly but, in the code, it could be to set one value dedicated to intensity or to set 3 value (R, G,B) (ex r=10,g=10,b=10, for very low White) to manage intensity.
Good luck !
2 years ago
Love you buddy.
thank you so much for help.
Did you checked out the Midi controller libray https://github.com/tttapa/MIDI_controller&ved=2ahUKEwjJqby2yPbuAhWXf30KHfaTDNAQFjAAegQIBBAD&usg=AOvVaw2rZQakhFZm-qH_QrVAbRnT
Reply 2 years ago
Thanks, glad it can help. The tutorial is bit messy and maybe there is surely more up to date tutorial to do a midi controler.
Can't open your link (404 error).
6 years ago
Yup, you can make the UNO into a native USB midi controller and it's actually pretty easy. I've found though that the Arcore library with Pro Micro chips is awesome and super easy to use. You can even be running info through the serial port and sending midi notes at the same time which is awesome for debugging. I've just built a drumkit with it and it was so simple to use that I've just bought two more pro micros for other midi ideas.
Reply 5 years ago
I will check out if I have time, it is in https://www.instructables.com/id/Arduino-Midi-Class-Hardware-Codes-and-Shortcuts-Ex/ ?
Reply 5 years ago
http://morecatlab.akiba.coocan.jp/morecat_lab/MocoLUFA.html
This is the way to make an UNO native midi. It's a bit hard to figure out, but once the UNO is converted, it's easy to use. you just connect two header pins to make it an UNO again for coding. Upload, unplug, disconnect the headers, wait 5 seconds and plug it back in. It's pretty easy.
I prefer the Arcore library with a pro micro. You have to use an older version of arduino software, but it's just a library to install. You just plug in the pro micro, upload your sketch with arcore pro micro and boom, it's a native usb device. It's also nice because you can just switch between coding and midi without doing anything. Just write, upload, test your midi, edit code, upload, test again. No pin headers, no unplugging. It's real easy.
http://www.musiconerd.com/single-post/2016/07/20/Arduino-Pro-Micro-as-a-USBMIDI-Device
Reply 5 years ago
Actually, don't use that first link. You want dual moco lufa for uno.
http://morecatlab.akiba.coocan.jp/lab/index.php/aruino/midi-firmware-for-arduino-uno-moco/?lang=en
If you use the first link it's a real hassle switching between coding and using.
5 years ago
Can we use each program for example Virtual DJ?
Reply 5 years ago
Yes like any midi controller you can buy on the market. However it takes time and for the moment I didn't suceed to make a functionnal encoder (to simulate turntables) which is the main part for virtual dj.
6 years ago
neat project!
you should consider using the vs1053 codec chip. it has a MIDI player built into it (and can play most any audio file- MP3, AAC, Ogg Vorbis, WMA, MIDI, FLAC, WAV. it can also record). Just send serial data to it, and it outputs stereo audio.
Adafruit has several breakouts, some with headphone output, some with speaker amps. https://www.adafruit.com/?q=vs1053&
Reply 5 years ago
thanks, looks cool
6 years ago
That is a really slick front panel!
Reply 5 years ago
Thanks, thats part worth time ;)
6 years ago
Cool!
Reply 6 years ago
Thanks ! :)