Concept
Instrument: piano.
Team members: Fady John (fje3683) and Victor Alves Gomes Nadu (va2269).
For our instrument project, we have decided to create a piano that plays different tones of the musical scale depending on the measured distance that someone is from the sensor. To build the instrument on the breadboard, we utilized an ultrasonic sensor, LEDs, resistors, and jumper wires, creating an interactive and dynamic musical experience. The analog ultrasonic sensor was responsible for measuring the distance, allowing for an intuitive interaction with the piano. As the user moves closer or farther away, the musical output changes, providing a unique take on the instrument. As for the LEDs, they add a visual element to the project besides also offering an understanding of the distance-based musical scale since they light up corresponding to the played notes.
Code
In the code, we defined the specific pins used for each LED and provided the notes in the musical scale in the form of an array.
// notes in the musicalScale: int musicalScale[] = { 262, 294, 330, 349, 392, 440, 493, 523 }; int ledPins[] = { 9, 12, 11, 10, 9, 12, 11, 10 }; void setup() { Serial.begin(9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); }
Schematic
Reflections and improvements
Initially, we planned to create drums, but we ended up settling on a piano since that was a more feasible and practical instrument. As for improvements, currently, the distance sensor is not that accurate, which is something that could be worked on. Other than that, we have managed to create something fun and so we are proud of our work.