Arduino Instrument
This Arduino instrument is made with an HC-SR04 Ultrasonic sensor and a Force Sensitive Resistor. You can play the music by press the force sensor, and wave your hand in front of the ultrasonic sensor at various distances to play different notes. Watch this video to see how it works!
Supplies
For this project, You will need:
- an Arduino
- a piece of breadboard
- One Force Sensitive Resistor
- One HC-SR04 Ultrasonic Sensor
- One 10k Ohm Resistor
- Ten jump wires
Wiring
Ultrasonic:
Connect ground to the Arduino ground, echo to a digital pin 11, trig to a digital pin 10, and VCC to 5V
Force Sensitive Resistor:
Connect one lead to 5V, and the other lead directly to A0. Place a resistor after the A0 wire and connect it to ground
Keyboard:
Connect D4 to GND to let the keyboard commands to work
Code
To get your instrument working, you have to insert one of the codes into the Arduino app, and insert another one to scratch.
The code used for Arduino is for sensing the distance from the ultrasonic senor, then it will press one of the keyboards, which are "C D E F G A B". The code for scratch will be used to sense a keyboard pressed and play a sound. "C=Do, D=Re, E=Mi, F=Fa, G=Sol, A=La, B=Si"
The codes are in the link below, you just have to copy and paste it into the apps.
Arduino code link: https://create.arduino.cc/editor/joshuahuang/bb12a...
Final Product
If you completed all the steps above it might look like the one in the video below, or even better!