Final Project: MIDI Controller Glove

I changed my idea to a drum sample glove to a general MIDI controller glove which you can use with any software synthesizer (DAW).

Parts

IMG_6512

I also bought felt, sewing supplies, and a soldering iron.

The Process

I tested the piezo elements with my Arduino Uno using this simple program, and they all work correctly.

Screen Shot 2016-05-11 at 8.00.33 PM

I tried putting the piezos inside the glove, to hide the wires, but it made the glove too impractical and uncomfortable to wear.

Sewing the piezos onto the glove:

IMG_6515

After soldering and using heat shrink tubing to add the 1M-ohm resistor to the piezo wires, I found that none of the circuits worked (they kept reading 0 in the Serial Monitor). I assumed this was because of my poor soldering skills, but it turns out the resistors were the problem – once I removed them, the analog values registered. So I started all over again and stripped the wires, soldering them directly to the FLORA.

Finally, once everything was connected, I tested the FLORA with Arduino software. This was where the real technical problems began (see Challenges). Once I managed to get Arduino to recognize the FLORA library, I tested the glove with a program that associates the knocks from the piezos to keyboard letters.

I imported the Teensyduino add-on for Arduino, which converts analog input to MIDI signal for the Adafruit FLORA. It worked perfectly. I then sewed the FLORA to the glove, and tested the new MIDI device with Garageband!

Code:

Challenges

Configuring the Arduino application to the FLORA was by far the most challenging task. Upon adding the third-party FLORA board to my Arduino boards library, I kept getting this compile error:

…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp: In function ‘bool CDC_Setup(USBSetup&)’:
…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp:104:29: error: ‘MAGIC_KEY_POS’ was not declared in this scope
uint16_t magic_key_pos = MAGIC_KEY_POS;
^
…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp:129:34: error: ‘MAGIC_KEY’ was not declared in this scope
*(uint16_t *)magic_key_pos = MAGIC_KEY;
^
Error compiling.

Screen Shot 2016-05-11 at 1.31.48 AM

It took several downloads of previous versions of Arduino, along with multiple installations of different versions of the FLORA board library, and a lot of desperate Internet searching until it finally worked.

Then, Arduino wouldn’t recognize the Serial USB port connected to the Flora, which I discovered was because of Mac 10.9 Yosemite not having the correct FDTI drivers. This required additional installation of drivers and even more Googling.

Demo

coming soon

Final Project: Week 1

For my final project, I decided to make a MIDI drum glove which hooks up to FL Studio (inspired by this). The target audience is anyone interested in music development or MIDI devices, or anyone who likes playing with drums. The glove solves an existing need in the sense that it functions as a set of drum samples, essentially replicating a drum set. This can also be viewed as enhancing an existing interaction or human behavior (i.e., either tapping your fingers or playing the actual drums). Besides some additional soldering and the glove, the other parts required are either a FLORA or GEMMA Arduino wearable electronics platform (~$25) that connects to the Arduino, and sensors for the glove fingertips. I haven’t decided yet if I am going to use FSR’s (i.e., to control volume of the sound based on pressure), piezo buzzers, or flex sensors to detect the fingertip movement that triggers the drum sample. I am working solo, so the division of labor is all me.

Data Visualization Labs

Experiment #1: Visualizing a single series of data

Screen Shot 2016-04-25 at 12.07.59 AM

The visualization technique I chose to model a single set of data was a bar graph. I used data from CNN Money to display the total annual tuition cost per year (as of 2015) of the top 10 most expensive colleges in America. A bar graph was suited for this data because it allows easy identification of the maximum and minimum data values. A line graph would have also functioned in the same way. One can visualize this data as a physical object or machine by accruing the amount in dollars (perhaps in values of $100 bills) for each college and comparing the differences between the stacks.

Processing Code:

Experiment #2: Visualizing the comparison of multiple sets of data

Screen Shot 2016-04-25 at 11.31.37 PM

For visualizing multiple sets of data, I modeled the components of Data Science using a Venn diagram (taken from Drew Conway’s Data Science Venn Diagram). This visualization technique is appropriate because data science is a field which encapsulates several broader data analysis fields (i.e. statistics, mathematics, computer science). Thus, a Venn diagram facilitates summarization of the different components which make up data science, as each individual field that comprises data science has overlap with the other fields.

Processing Code:

 Experiment #3: Animated Visualization

For the animated visualization, I made a type of weather widget that displays the weather in New York, Montreal, Denver, and Los Angeles. I used a site called Temboo to configure the XML readings from Yahoo Weather. If you press any button, the location and the background changes according to the forecast.

Processing Code:

Midterm Project – Breathalyzer

For my midterm project I decided to make a “breathalyzer”, called the Drunkometer. The first few days of planning I considered ideas for my project and after some researching, a breathalyzer called out to me as the most sensible and entertaining concept to create in such a short time frame.

I ordered an MQ-3 sensor from Sparkfun on Tuesday, March 22, but after several days of waiting for it to arrive I went to Tinkersphere and bought an MQ2 Gas Sensor, which detects propane, methane, butane, and smoke as well as alcohol levels. The scope of the MQ-2 in detecting alcohol concentration is 100-2000 ppm (0.01-0.2%).

After getting the alcohol sensor, I began to set up my breadboard. It consists of 10 simple LEDs which light up according to the analog input obtained from the MQ2, which the user breathes into (see progress documentation for detailed circuit). I didn’t have any problems with this as the circuit is pretty simple, and the MQ2 I bought was built for the Arduino/Raspberry Pi so I did not have to do any additional wiring/soldering.

I originally wanted to make it into a game, in which two people blew into two different breathalyzers and competed for the higher score, but realized this was impossible without two Arduinos. So, I scratched that idea and decided to make it a competition in which you try to get to the 10/10 LED spot (the highest possible value). If you get to the 10th spot, a congratulations message appears.

After making the box, I realized that it was difficult to see the LEDs as you blow into the mouth tube, as the height of the box was too tall. Thus, I decided to implement Processing to visualize the input data on my computer screen for the user. This took some time to implement, both design and programming-wise as I’m unfamiliar with Processing. However, I am pleased with the final product!

The idea for this was obtained from Daniel Andrade.

Arduino Code:

Processing Code:

Progress Documentation:

Demonstration:

Processing Labs

Oscillating Circle with Processing

Questions:

  1. Processing is based on the Java language.
  2. A global variable is declared outside of a function and can be accessible anywhere in a program, whilst a local variable is declared inside a function and can only be accessed inside that function.
  3. When called, the draw() function does not return a data type, as its return type is void.
  4. The code below the “//keep the circle in bounds” comment acts to make sure the ball does not move outside the bounds of the Processing window. It does so by checking the position of the ball, and if it is larger than the size of the window or lower than zero, the program reverses the direction of the ball.

Sending Serial Data from Arduino Circuit to a Processing Application

Etch-A-Sketch

Since I didn’t have an extra potentiometer, I used a force-sensitive resistor instead, which was a lot more sensitive to a light touch and thus proved more difficult in controlling the vertical direction.

The Circuit:

IMG_6310.jpg

My Code:

Interactive Toy

The interactive toy I made was a music box which plays a song and lights up when you open the lid. My initial idea was to have a servo motor which turned a small toy as well, but I realized that you cannot implement both the tone() and PWM functions onto one Arduino. The intended user is any child over the age of 1 with basic motor skills to open a box. Since this is a pretty simple and intuitive action, the design of my toy took the limitations and capabilities of an infant into account.

I tested the toy on my little sister, who is 1.5 years old. My other little sister, who is 6 years old, helped me decorate the box. As you can see in the video, she was interested at first, but after playing with it a little while she kept trying to press the LEDs and remove the top of the box to reveal the inner workings underneath, which poses a problem for young children as there are many small choking hazards.


My code:

Servo Motor Labs

Servo Motor Controlled by Pulse Width Modulation from an Arduino

 Questions:
  1. We add a delay after rotating the servo because the servo motor cannot operate at the speed the Arduino does, thus we add a 45ms delay for real-time visualization of the servo motor rotation.
  2. Since a 90° rotation (neutral position) corresponds to pulses of 1.5 milliseconds and the pulses range from 1 to 2 ms, the pulse width that corresponds with a 45 rotation would be 1.25 milliseconds.
  3. Why doesn’t the Arduino reliably turn a servo motor at the same time as it plays a sound from a piezo speaker using the tone() function? Both the servo motor and piezo speaker function via pulse width modulation. The Arduino only has the capability for one oscillator, thus it cannot control both parts simultaneously.

Servo Motor Controlled by Potentiometer with Arduino

Servo Motor Controlled by a Pushbutton Momentary Switch

Screen Shot 2016-03-02 at 3.41.50 PM

Transistor Labs

Force-Sensitive Resistor & LED with Arduino


Questions:

  1. Applications of the FSR for improving accessibility to handicapped people: accelerating/decelerating a wheelchair for paraplegics, or a pressure gauge to open doors/cabinets.

Temperature Sensor & LED Circuit with Arduino


Questions:

  1. We do not need to use a voltage divider circuit with this temperature sensor because it acts as a voltage divider by changing output voltage in proportion to changes in temperature, rather than using variable resistance like potentiometers.
  2. Unlike pressure sensed by force-sensitive resistors, or rotation sensed by potentiometers, ambient temperature sensed by temperature sensors almost always changes very gradually and slowly. How does this affect the design of interactions based on this sensor? The interaction between the user and temperature sensor would not be an immediate reaction but instead a gradual, delayed response. Thus temperature sensors are not practical for prompt visualization of data.
  3. Applications of the temperature sensor: as a cooking thermometer to see the gradual change as a food cools down/heats up compared to ambient temperature, detecting the change in temperature under the hood of a car to prevent overheating.

Transistor as Switch


Questions:

  1. The LED turned on by the switch is dimmer than the LED turned on by the transistor because the LED connected to the switch has higher resistance of 10kΩ, as opposed to 560Ω resistance in the other LED.
  2. Ohm’s Law: Iswitch leg = V/R = 5V/10kΩ = 0.5mA.
    Itransistor leg = V/R = 5V/560Ω = 8.9mA.

Transistor as Amplifier


Questions:

  1. How does turning the potentiometer to maximum resistance affect the sensitivity of the circuit to the photo-resistor’s signal, as compared to turning the potentiometer all the way to minimum resistance? Turning the potentiometer to maximum resistance lowers the sensitivity of the photo-resistor as less voltage flows through the circuit, whilst minimum resistance increases the sensitivity of the photo-resistor.

Transistor Controlled by Arduino


Musical Instrument

Screen Shot 2016-02-21 at 10.11.45 PM

  • The musical instrument I created plays two different notes (A & D) depending on which pushbutton you press, or middle C if you do not press any button. I created a small box for my instrument to hide (most) implementation of wires, circuits, etc.
  • Crawford’s model of interaction defines interactivity as “a cyclic process in which two actors alternately listen, think, and speak”. The musical instrument I designed follows this model because both parties in the interaction (the person and the instrument) listen, think, and speak – that is, they input, process, and output information. I input information to the instrument by pressing the switchbutton (or not pressing it), the machine code interprets and processes the data, which then outputs a specific tone.
  • I could have improved the interactivity and expressiveness of my musical instrument in several ways. Perhaps I could have included a potentiometer in my design that controlled the volume output of the speaker. This would have increased the amount of interaction between the user and the instrument, as the user would not only control the notes being played but also the intensity of sound. I could also have implemented an LED light system that lit up according to which note was pressed, thus both increasing the expressiveness of the instrument and the interaction on the instrument’s part.