Introduction: AirMIDI - Hand Motion MIDI Controller Using Arduino

About: Software Engineer in Weekdays and a Musician in Weekends

Control any MIDI Parameter value of your DAW through Hand Motions (Eg. LFO, Cutoff, Gain)

Idea behind the project:

Hello,

I am a Software Engineer and a Musician and love to explore the area in which I can mix music with tech, While composing music through Logic Pro, I was trying to play with knobs on my plugin to change the LFO levels and it was producing a great techno effect with a 120 BPM Kick sound.

As I didn't had a MIDI Controller I thought of making one myself, Made my first controller using Potentiometer knobs, then thought that the functionality of knob is just to send values from 0-127 and that can be done by any means, that's when I thought of using Ultrasonic sensor for this purpose.

I made this project such that with just keeping hands above the sensor and moving it away/closer from the sensor behaves similar to turning Potentiometer knobs from one side to another.

You can add as many sensors and map those with your DAW to control any MIDI level. For this project I have used two sensors.

Step 1: What You'll Need!

  1. 1x Arduino Uno or any other Arduino will work, We just need four Digital I/O Pins and 5V Vcc.
  2. 2x HC-SR04 Ultrasonic sensor (You can use any number of sensors and make necessary changes in code)
  3. 8x Jumper Cables (Male to Male)
  4. 1x Breadboard
  5. Hairless MIDI Serial Bridge
  6. Any Digital Audio Workstation (Used Logic Pro for demonstration).

Step 2: Circuit Diagram

Ultrasonic sensors have a Trigger Pin and Echo pin, We send an ultrasonic pulse through Trigger pin and then Echo Pin waits for receiving it back after bouncing back through any object in front of sensor and calculates distance as per that.

You can use any Digital I/O Pins for connecting Trigger/Echo of Ultrasonic Sensor.

As per the pins used, the variable in the codes related to trigger/echo pins can be updated

(eg. int trigPin1=2; //Pin No. 2 of arduino used as trigger pin for sensor one)

Step 3: Installing Software

Install Hairless MIDI Serial Bridge (Used for sending and receiving MIDI signals to any serial device)

Mac Users:

  1. Open Audio MIDI Setup (Search "Audio MIDI Setup" in LaunchPad)
  2. Click on IAC Driver and make sure that "Device is Online" box is checked as shown in the image.
  3. Open Hairless MIDI software.
  4. Make sure in Serial Port arduino's serial port is selected and MIDI Out is set to IAC Driver Bus1.

Windows Users:

  1. Install LoopBe1 MIDI Driver (Virtual MIDI Driver).
  2. Open Hairless MIDI Software.
  3. Make sure in Serial Port arduino's serial port is selected and MIDI Out is set to LoopBe Internal MIDI.

Note: While Uploading code to Arduino make sure that in Hairless MIDI the Serial<->MIDI Bridge On is Unchecked otherwise code won't upload, after uploading code successfully enable the Serial<->MIDI Bridge On again.

Step 4: Code

The Code of the project can be accessed through the following Github Link: AirMIDIController Github Link.

Important Note:

  1. The code is developed for two sensors currently but can be extended to any number of Ultrasonic sensors as per the Digital I/O Pins availability. You can extend the project by just copy pasting the code for one sensor.
  2. While uploading code and mapping MIDI it is recommended to map one Sensor at a time as the Ultrasonic sensors will keep sending values of the object in front so it may get difficult while MIDI Controller Assignment as both sensors will send input to the MIDI Parameter to map.
  3. To tackle this, comment out code of other sensor/sensors and upload code of one sensor at a time and map it to your desired MIDI parameter(Mapping covered in next steps) and repeat this for other sensor/sensors
  4. Once You have Mapped both the sensors to your desired parameter then you can upload the full code(with all sensor code uncommented) and Control separate parameters of your Digital Audio Workstation.

Step 5: MIDI Mapping

  1. As mentioned in previous step, It is recommended to map One sensor at a time therefore while uploading comment out the code of other sensor and upload it.
  2. After uploading code open Hairless MIDI and make sure correct Serial Port and MIDI Out are selected.
  3. The Hairless MIDI should display the incoming values as per the distance at which your hand is placed above the sensor (As shown in the attached image)
  4. Once the values are visible on Hairless MIDI open your DAW (Logic Pro used for demonstration).
  5. In your DAW open any Plug In which has different Parameters and Supports MIDI (Used Alchemy for Demonstration).
  6. Tweak the parameter which you want to control by mouse.
  7. After you tweak the desired parameter it should be available to be MIDI Mapped and it should be visible in Logic Pro->Control Surfaces->Learn Assignment for....(As shown in the image)
  8. It will automatically map the incoming MIDI Signal to the desired parameter if Learn Mode is enabled and you will see Learned displayed for your desired MIDI parameter (As shown in the image)
  9. After mapping one sensor, uncomment the code of other sensor and comment the code for the sensor for which assignment is done and upload the code.
  10. Follow above mentioned steps for other sensor to map it to any other parameter of the plugin.
  11. After both sensors are mapped, Uncomment the code of both the sensors and upload the code.
  12. Now you should be able to see both the parameters being changed on your DAW as per your hand motion in front of the sensors.

Step 6: Demo Time!

Here is a quick demo of the AeroMIDI Controller in Action.

I am controlling LFO value using one sensor and Cut-Off value through another sensor.

Note: In the video three sensors are visible, had used third one to play and pause the Record session.

I have tried to cover all the things with respect to the project, but if you need any help or have any queries regarding the project, I'll be more than happy to help you out.

Reach out to me in the comments or you can contact me through instagram (@suchdeep) or email (suchdeep95@gmail.com).

STEM Contest

Participated in the
STEM Contest