Group #6: Gene Mereweather, Alice Fuller, Phillip Oasis and Rodrigo Menezes
Our final instrument used a whammy pedal and a slide sensor to modify the pitch and length of each buzz on our buzzer. The user would control the whammy pedal with their feet and the slide sensor with their finger on the desk. We were pretty satisfied with the overall results, especially with the functionality of the whammy pedal. If we put more effort into it, we would try to find a more natural way to change the time between buzzes.
Prototype 1: Whammy Pedal
This prototype used an empty box, a whiteboard eraser, a light sensor, a big spring and a buzzer to create a “whammy pedal”. When the box is pressed down, the light sensor recognizes that there is less light in the box. The code in the prototype uses the change in light to modify the tone and frequency of the buzzing. We used both a Piezo sensor and buzzer for sound.
Prototype 2: Light-ccordian
To continuing playing around with the light sensor, we put holes in a rectangular box down the center. The less light received by the light sensor, the smaller the pitch of each buzz emitted by the buzzer.
Prototype 3 and Final Instrument: Slide Pitch + Whammy Pedal
We added an additional touch sensor to prototype 1 and re-worked the software, so that the light sensor would control the length of each buzz and the slide potentiometer would control the pitch. It worked really well and we were able to perform with it, so we chose this to be our final instrument. We kept adapting the code until we were satisfied with the musicality. In the following video, Gene performs with our final instrument:
List of parts used
- Arduino, wires, two breadboards
- Slide potentiometer
- Buzzer + 330 Ohm resistor
- Piezo sensor
- Light sensor + 10k Ohm resistor
- Box, whiteboard erase marker, spring and duct tape (for the whammy pedal)
How to build it
We put the spring on the whiteboard erase marker using duct tape, and placed it within a small square box. The light sensor was placed with the 10k Ohm resistor in one breadboard within the box. Wires connected this to our analog reads. We put the slide potentiometer, piezo sensor and buzzer on the other bread board. The buzzer required a 330 Ohm resistor and was connected to a digital pin. The slide potentiometer was in another analog pin and the piezo sensor was connected to another digital pin.
Source code
const int lightAnalogPin = 0; // FSR is connected to analog 0 const int slideAnalogPin = 1; int slideReading; // the analog reading from the slide pot int lightReading; // the analog reading from the light resistor divider const int piezoPin = 9; const int buzzerPin = 5; int duration; // time that each note lasts const int betweenNotes = 0; // time between notes void playTone(int tone, int duration) { // adapted from Arduino tutorials for (long i = 0; i < duration * 1000L; i += tone * 2) { digitalWrite(piezoPin, HIGH); delayMicroseconds(tone); digitalWrite(piezoPin, LOW); delayMicroseconds(tone); } } void setup(void) { pinMode(piezoPin, OUTPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); } void loop(void) { lightReading = analogRead(lightAnalogPin); slideReading = analogRead(slideAnalogPin); Serial.print("Analog reading = "); Serial.println(slideReading); duration = map(lightReading, 0, 1023, 500, 10); // low light = shorter note // adapted from Arduino tutorials int buzzerValue = map(slideReading, 0, 1023, 16, 7902); // low light = low pitch tone(buzzerPin, buzzerValue, 100); int piezoValue = map(slideReading, 0, 1023, 1915, 956); // low light = low pitch playTone(piezoValue, duration); delay(duration); }