Air Piano Using IR Proximity Sensor, Speaker and Arduino Uno (Upgraded/part-2)

by mrfrozenpeak in Circuits > Sensors

1670 Views, 6 Favorites, 0 Comments

Air Piano Using IR Proximity Sensor, Speaker and Arduino Uno (Upgraded/part-2)

IMG20200714134438.jpg
IMG20200711192513.jpg
F7FHZIAKCHNUI3I.LARGE.jpg
IMG20200714133729.jpg
FKCHT87KCHNUHPV.LARGE.jpg
IMG20200714135048.jpg
IMG20200714133908.jpg
FKTRM1HKCHNUGK3.LARGE.jpg
F7QHO3TKCHNUGLI.LARGE.jpg
FCBTSWJKCHNUGI7.LARGE.jpg
F0O0OYTKCHNUI0K.LARGE.jpg
July 14, 2020
This is an upgraded version of the previous project of air piano 🎹. Here I am using a JBL speaker as a output. I have also included a touch sensitive button to change modes according to requirements. For example- Hard Bass mode, Normal mode, High frequency tunes mode. I will show you how to the connected speaker to Arduino. Normally Pianos be it electric or mechanical work on the simple mechanism of pushing button. But here is a twist, we could just eliminate the need of keys in a piano by using some sensors. And Infra-red Proximity sensors best fit the cause because they are easy to use and they also occupy just one digital pin of microcontroller board. And also these sensors are one of the cheapest sensors available out there.

Supplies

1) 10 pcs Ir proximity sensor

2) Arduino uno/ mega

3) Speaker with audio jack

4) button( In my case touch sensitive button)

5) Base to mount it sensors(acrylic sheet)

6) Black cardsheet/ Black cello tape

7) screws/Glue

8) Wires

Mounting Ir Sensors

F4XGYJ2KCHNUILM.LARGE.jpg
FV56ROKKCHNUIMN.LARGE.jpg

Ir sensor modules are equipped with a mounting hole at the center. You could use the hole to fit sensor with a tight screw or you can just use glue to stick it. I have used an acrylic sheet as base and drilled holes in acrylic with proper markings where each hole was 2 cm apart. Do not arrange the sensors too close to each other as it may ruin your piano user experience.

Adjusting Range of Ir Sensor and Covering With Black Carsheet Rolls

F8WQ1IGKCHNUHQU.LARGE.jpg
IMG20200711192432.jpg
Use the potentiometer on it sensor module to adjust the suitable range for your piano keys. Now mount the black cardsheet rolls on it sensor module led and photo-diode as shown in picture. This is done to prevent detection of unwanted obstacle in other direction. We want to detect fingers only in the front. And we use black cardsheet because black absorbs all wavelengths and even infra reds.

Connecting Speaker to Arduino

images.png
IMG20200714133908.jpg
IMG20200714134125.jpg
Connect one end of audio jack to speaker , the other end usually contains 3 parts. The upper two parts are for left and right inputs and the lower most part is ground. So connect ground of audio jack to ground of Arduino/microcontroller and connect any of right/left part of audio jack to the digital pin of microcontroller. Refer the above image to get a good idea. Turn on your speaker and your audio output is ready.

Wiring Ir Sensor Module and Touch Sensor Switch

1594701268909_schematic 2_bb.png
IMG20200714134823.jpg
I am using a touch sensor switch to change the modes of the piano 🎹. You can use a simple push button switch instead. Connect positive terminal of sensor switch to Arduino +5V and negative to ground. Connect output of touch sensor to input of the analog pin of Arduino.
Connect all the positive terminals of ir sensors using a wire and solder(optional). Also connect all the ground pins of all the sensors. Now finally, you need to connect output pins from Ir sensor to Digital pins of the microcontroller board. In my case, it is Arduino uno. Remember that , when an obstacle is detected Output from the sensor is low.

Code Microcontroller Using Arduino Ide

In this code, we first need to define pins for ir sensor input, touch sensor button input and Speaker output. After that we create a nested array of different frequcies of different modes.
We use tone(); function of Arduino ide to send our output to the speaker. We use noTone(); function to stop the sound. I have only used conditional statement in the loop, so it will be easy to understand and works just fine.

Video of Project Working

July 14, 2020