Project tutorial
Haptolin

Haptolin © CC BY

My microtonal Arduino MIDI instrument!

  • 1,744 views
  • 0 comments
  • 4 respects

Components and supplies

Ard nano
Arduino Nano R3
×1
Mini breadboard
×1
Sen0235 45%e5%ba%a6900x600 450x300
DFRobot EC11 Rotary Encoder Module
×1
generic, cyllindrical power bank (~21mm in diameter)
×1
09939 01
Rotary potentiometer (generic)
×2
11026 02
Jumper wires (generic)
×420
4415447 jg5sklyzsj
Resistor 220 ohm
×3
09264 1
RGB Diffused Common Cathode
×1
4 pin female header (optional, for the LED)
×1
female midi socket
×1
52t8137 40
Audio / Video Cable Assembly, MIDI
×1
Adafruit industries ada260 image 90px
USB-A to Mini-USB Cable
×1
braided elastic bands (braided ones last way longer)
×1
53m8781 40
Machine Screw, M3
×1
Elastic strap (30mm wide)
×1

Necessary tools and machines

3drag
3D Printer (generic)

Apps and online services

About this project

Haptolin is my Arduino-based, microtonal instrument/MIDI controller. The project is mainly inspired by:

  • Theremin
  • Modulin
  • Haptx Glove
  • Power Glove

Haptolin produces a theremin-like sound while providing an analog haptic feedback allowing for a precise pitch control. Whereas Haptx glove relies on complex, actuator-based feedback system, haptolin uses simple braided elastic bands. The higher the pitch the stronger the response. The left key controls the pitch, the right one controls the dynamics.

Unlike most of the microtonal MIDI instruments, Haptolin uses native MIDI and implements the microtonality through pitch shifts in between the notes. Thanks to this solution Haptolin is compatible with most of the MIDI synthesizers without any drivers needed.

You can check my haptolin cover of Wintergatan's "All Was Well" here:

You need a 3D printer to make the elements. The haptolin was photogrametrically fitted to my hand, so your experience may vary depending on the palm size.

During assembly, you should slide the potentiometers in the holes and use a nut to fix them in place. The elastic bands are hooked on one side to the keys attachements, and on the other side to m3 bolts that hold the 2 pieces of the case together (it's visible on one of the close-up pictures).The belt is a 30mm-wide elastic strap. On one side (next to the power bank) you glue it to the case, on the other side it is held with an m3 nut, which makes it sort of adjustable. (you only need to ajdust it once - you can just slide your palm in when the strap is mounted properly).

The project is also available on Thingiverse:

https://www.thingiverse.com/thing:4190495

Code

haptolin_code.inoArduino
haptolin code
// haptolin is a native-midi arduino-based microcontroller compatible "plug'n'play" with most of the synthesizers
// use a genuine arduino nano or a compatible board
// haptolin code by bzqp
// check the full project on Youtube, Arduino project hub and Thingiverse!
// 2019-2020

void setup() {
Serial.begin(31250);
//Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);

attachInterrupt(0, enkoder2, CHANGE);
attachInterrupt(1, enkoder3, CHANGE);
}
int enk = 0;
int pot1;
int pot2;
int transpozycja = 0;

double dbl;
double inter;
int nuta;
int nutastara;
int bend;
int bendstary;
int dynamika;
int dynamikastara;
int aftertouch;
int aftertouchstary;

void loop() {

if(enk==2){
  delay(150);
  analogWrite(11, 0);
  analogWrite(9, 0);
  enk = 0;
  attachInterrupt(0, enkoder2, CHANGE);
  attachInterrupt(1, enkoder3, CHANGE);
}



nutastara=nuta;
dynamikastara=dynamika;
bendstary=bend;
aftertouchstary=aftertouch;

pot1=map(analogRead(A7),0,1023,1023,0);
pot2=map(analogRead(A6),0,1023,1023,0);

if(pot2<=64){
  dynamika=0;
  aftertouch=0;
}
else if ((pot2>=65)&&(pot2<=500)) {
 dynamika=double((-cos(double((double(map(pot2,65,500,0,436))/double(436)*double(PI))))/double(2)+double(0.5))*double(127));
 aftertouch=0;
}
else {
  dynamika=127;
  aftertouch=map(pot2,501,750,0,127);
}
  
bend=64+(pot1%32);
dbl=(double)pot1/(double)32;
inter=floor(dbl);
nuta=(35+inter+transpozycja);

if(!(aftertouch==aftertouchstary)){
  //176 Control Change
   Serial.write(176);
   Serial.write(15);
   Serial.write(aftertouch);
   //delay(100);
}

if(!(dynamika==dynamikastara)){
  //176 Control Change
   Serial.write(176);
   Serial.write(14);
   Serial.write(dynamika);
   //delay(100);
}



if(!(nuta==nutastara))
{
   //144 Note On
   Serial.write(144);  //144+channel
   Serial.write(nuta);  //pitch
   Serial.write(127);
   //delay(100);


   //128 Note Off
   Serial.write(128);  //128+channel
   Serial.write(nutastara);  //pitch
   Serial.write(127); //velocity
//delay(100);
}


if(!(bend==bendstary)){
  //224 Pitch Bend
   Serial.write(224);  //224+channel
   Serial.write(0);  //LSB
   Serial.write(int(bend));  //MSB
   //delay(100);
}


delay(30);

//LED RGB
double moc = double(pot2)/1023;
analogWrite(9, (pot1/4*0.65)*double(moc));            //RED
analogWrite(10, ((255-pot1/4)*0.8+51)*double(moc));   //GREEN
analogWrite(11, 0);                                   //BLUE



}

void enkoder2(){
if (!digitalRead(2)==digitalRead(3)){
  detachInterrupt(digitalPinToInterrupt(3));
  detachInterrupt(digitalPinToInterrupt(2));
  enk = 2;
  transpozycja++;
  analogWrite(11, 255);
}

}
void enkoder3(){

if (!digitalRead(2)==digitalRead(3)){
  detachInterrupt(digitalPinToInterrupt(2));
  detachInterrupt(digitalPinToInterrupt(3));
  enk = 2;
  transpozycja--;
  analogWrite(9, 255);
}


}

Custom parts and enclosures

haptolin_v4_keys
The longer key is for the dynamics control (ring finger)
The shorter one is for the pitch (index finger)
haptolin_v4_lowerhalf
haptolin_v4_lowerhalf
haptolin_v4_upperhalf
haptolin_v4_upperhalf

Schematics

Haptolin - wiring
The wiring of the haptolin
Haptolin v4 wiring 3gok6b1li4

Comments

Similar projects you might like

Kravox! Wireless, Motion and Touch-Sensing Instrument

Project tutorial by Tim Krahmer

  • 9,095 views
  • 19 comments
  • 35 respects

Pedometer (Arduino 101)

Project tutorial by Bruno Gabriel

  • 12,295 views
  • 5 comments
  • 23 respects

Portable Range Detection Device

Project tutorial by Viktor S

  • 9,389 views
  • 6 comments
  • 22 respects

Guitar Speed Pick and Stomp Pedal!

Project tutorial by Marc Uberstein

  • 6,736 views
  • 9 comments
  • 34 respects

Otto DIY+ Arduino Bluetooth robot easy to 3D Print

Project tutorial by Team Otto builders

  • 78,899 views
  • 136 comments
  • 222 respects

Stereo NeoPixel Ring VU Meter

Project showcase by ericBcreator

  • 64,120 views
  • 351 comments
  • 145 respects
Add projectSign up / Login