🌟 Inspiration:
Music possesses a remarkable capacity to bridge cultural and linguistic divides and unite individuals from diverse backgrounds. Motivated by the notion of promoting interactive experiences and democratizing music creation, we set out to build a one-of-a-kind musical instrument out of buttons and Arduino. Our intention was to enable people to use sound as a creative medium for self-expression, irrespective of their experience with music. We chose the piano as our main inspiration because we could recreate the chords using buttons.
💡 Process:
Using Arduino Uno we wired up buttons to serve as interactive triggers for different musical notes. Each button was assigned a specific pitch or sound, allowing users to create melodies by pressing combinations of buttons. We leveraged our programming skills to code the logic behind the instrument, ensuring seamless functionality and an intuitive user interface.
🚀 Difficulties:
Although our journey was exciting and innovative, there were certain difficulties. A major challenge we encountered was guaranteeing the reliability and consistency of button pushes. We have to use precise calibration and filtering techniques to get beyond problems like noise interference and debounce.
There were additional difficulties in creating an intuitive user interface. To ensure that users could simply grasp how to interact with the instrument while still having the freedom to explore and experiment with various musical compositions, we had to find a balance between simplicity and utility.
const int speakerPin = 9; // Speaker connected to pin 9 int buttonPins[] = {2, 3, 4, 5}; // Button pins for C, D, E, F int notes[] = {262, 294, 330, 349}; // Frequencies for C4, D4, E4, F4 void setup() { // Set up each button pin as an input with pull-up resistors for (int i = 0; i < 4; i++) { pinMode(buttonPins[i], INPUT_PULLUP); } // Set the speaker pin as an output pinMode(speakerPin, OUTPUT); } void loop() { // Check each button and play the corresponding note for (int i = 0; i < 4; i++) { if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed tone(speakerPin, notes[i]); // Play the corresponding note delay(200); // A short delay to help debounce the button while (digitalRead(buttonPins[i]) == LOW); // Wait for the button to be released noTone(speakerPin); // Stop playing the note } } }