Introduction: Lune - MIDI Controller With Arduino (for DJ or Musician)
Introduction
Lune is my first Arduino project (which is a well-known microcontroller). I wanted to learn Arduino by creating a useful and enjoyable project, so I decided to make a MIDI DJ controller, as I needed one and it involves various types of interactions or sensors.
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 😉