John George
Huai-Ning Chang
Michael Woon
Goals:
The objectives for this lab include testing new Hall-Effect sensor with virtual spring and virtual damper, use Op Amp as differentiators, and building a haptic musical instrument with MIDI interface.
Accomplishments:
Comparing the performance of new Hall-Effect sensor to the old one, it was found out that new Hall-Effect sensor was more powerful than the old one. Unfortunately, our new Hall-Effect sensor blew out by accidentally shorting the pins, so basically we completed our lab with the old Hall-Effect sensor, amplified through the Op Amp.
The implementation of the Op Amp increased the analog signal range to the Arduino controller, improved resolution, and reduced chattering. Unfortunately, as we were about to use the Op Amp as a differentiator, our old Hall Effect sensor started acting erratically (see below). But the Op Amp circuit we designed and tried to implement is shown as the modeled system in Matlab. There was a final step that we did not actually do, and that was to put a gain on the output by ~1000.
To build a haptic musical instrument from analog input, we first made a file for Pd to read MIDI signals from Arduino. Different notes come by writing serial data from 30 to 90, with the appropriate nibbles (ex. 0x90). The Arduino programming code is as follows:
const int LEDpin = 13;
const int Sensor1Pin = 1;
const int den = 8;
// Variables: byte note = 0;
// The MIDI note value to be played
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
pinMode(LEDpin, OUTPUT);
}
void loop() {
// play notes from F#-0 (30) to F#-5 (90):
note = analogRead(Sensor1Pin)/den;
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, note, 0x45);
digitalWrite(LEDpin, HIGH);
delay(10);
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
noteOn(0x90, note, 0x00);
digitalWrite(LEDpin, LOW); delay(10);
}
// plays a MIDI note. Doesn't check to see that
// cmd is greater than 127, or that data values are less than 127:
void noteOn(byte cmd, byte data1, byte data2) {
Serial.print(cmd, BYTE);
Serial.print(data1, BYTE);
Serial.print(data2, BYTE);
}
Unfortunately, after the new Hall-Effect sensor got shorted, our old Hall-Effect sensor started acting erratically, sometimes getting stuck at max output voltage. We could power down and power up the sensor and it would work, but eventually it started producing a constant 2.4V output. With no other sensor hooked up to our motor, we had to improvise and come up with another input sensor for the human (which unfortunately did not provide active force-feedback). Our instrument schematic is shown below.
By connected to MIDI and with the circuit, we can play different notes by applying different force to the sensor. Following is a video of the concert:
Just a note about using the force pad: Earlier we used to force pad to modulate volume in the Theremin Lab, and we found that it worked very well. It had great response and could easily be learned. In this lab, we used the force pad to modulate pitch, and we found that did not work as well as, say, a sliding potentiometer or some sort of position-based input. The force required to sustain higher notes was uncomfortable, the resolution was too high so it was easy to miss notes, and you always have to "ramp up" to the note you want.
No comments:
Post a Comment