Concept
Mini Piano
Given that we had to make a musical instrument, we were inspired by a project we found in YouTube of what seemed like a piano. From this, we aimed to make a smaller scale of this project following the requirements for the assignment. The circuit consists of one piezo speaker, a potentiometer as an analog sensor, and a three buttons as digital sensors.
Schematic
Circuit Diagram
Figure 2 ( Circuit design with code and simulation on “Magnificent Jaiks” by Abdelrahman
Final Results
VIDEO
Arduino code
One aspect of this project we were proud of is the octave multiplier implementation. Instead of having fixed notes, Abdelrahman used the potentiometer to create a continuous pitch control that multiplies the base frequencies by a factor between 0.5x and 2.0x.
float octaveMultiplier = map(potValue, 0, 1023, 50, 200) / 100.0;
This line of code transforms a basic three-note instrument into something much more expressive and fun to play with. Users can play the same melody in different registers, which makes the instrument feel more like a real musical tool rather than just a tech demo.
else if (digitalRead(button2) == LOW) {
int freq = notes[1] * octaveMultiplier;
tone(buzzerPin, freq);
Serial.print("Playing ");
Serial.print(noteNames[1]);
Serial.print(" at ");
Serial.print(freq);
Serial.println(" Hz");
}
else if (digitalRead(button3) == LOW) {
int freq = notes[2] * octaveMultiplier;
tone(buzzerPin, freq);
Serial.print("Playing ");
Serial.print(noteNames[2]);
Serial.print(" at ");
Serial.print(freq);
Serial.println(" Hz");
}
I also thought this snippet was interesting since it captures how the notes are played and how the frequencies adjust when the buttons are played and the potentiometer is twisted.
Github
https://github.com/imh9299-sudo/Intro-to-IM.git
Challenges and Further Improvements
Despite the complexity of the circuit, Abdelrahman successfully managed to produce a design in Magnificent Jaiks which I managed to follow without any issues. After arranging the jumper wires and all the other pieces, the final result was as we aimed for. One of the biggest challenges we faced was finding a way to divide the work as a result of the distance. Nevertheless, we managed to make a plan after meeting on zoom, and finished our circuit on time. For future projects, one thing I would like to improve on is developing an instrument of this kind with more buttons in order to have a larger version of the mini piano done for this assignment.

