In this project, we will make an eight key DIY piano using capacitive touch. The sound will be generated using a piezo buzzer which is in-built (in evive). We will generate 8 basic tones (Sargam)- Sa, Re, Ga, Ma, Pa, Dha, Ni, San in Hindi. You will need the frequency of each note to make a DIY Piano.
evive capacitive input, monitors the capacitance level and notifies the user if the capacitance is above threshold (touched) or below threshold (not touched). You can connect any of these things to make your piano: fruits, vegetable or aluminum foil.
|Image||Component||Quantity||Available in Kit|
|USB A-B Cable||1|
|Male to Male Jumper Cable 20cm||8|
Step 1: Circuit Diagram
Attach your objects to evive touch input channel 1 to 8.
Step 2: A brief about Scratch
Scratch is a graphical programming language which let you interface and control your evive with laptop. If you have not installed Scratch visit here to get full instruction on installing Scratch.
To learn about the Scratch interface, visit here.
We have developed these Scratch extensions containing special blocks through which you can control your evive in Scratch:
- Arduino: These blocks control the basic input, output and communication of evive like digital and analog input/output, serial communication, PWM output, etc.
- evive Inbuilt Functions: Using this block you can control the basic functionalities of evive like tactile-switches, slide-switches, potentiometer,motors, 5-way navigation key, touch inputs and Real Time Clock.
- evive TFT Screen: Using this block you can control the TFT display of evive.
- evive App: Using this block you can communicate with the Mobile App.
- evive Tinkering: These block are used to interface various sensors and actuators.
In Scratch, there are two modes in which you can work:
- Arduino Mode: Under Arduino mode, the instruction blocks will be tranfer to Arduino C++ into Arduino IDe, and user could modify code in Arduino IDe, and then upload the code into Robot. In that case, the Robot is running offline and it can not interact with Scratch’s stage.
- Scratch Mode: Under Scratch mode which is defualt mode when mBlock start, mBlock could program robot through USB serial port, the robot is running a program could communicate with mBlock, and robot could intercate with Stage and create more insteresting projects and animations.
In this project we are not using any scratch feature and want to run evive independent of your computer, hence we have to work in Arduino mode.
Step 3: Piezo Buzzer
Piezo buzzers are electrically actuated buzzers, which generate a tone or a sound of a certain frequency. In evive, there is an inbuilt piezo buzzer connected to digital pin 46. In Scratch, you have an Arduino block which plays tone. Using this block you can play notes of different beats and frequencies, using the buzzer on the selected pin.
Let us now make a small part of our piano, where you will play the ‘Sa’ note (frequency 261 Hz) whenever evive tactile switch 1 is pressed for 0.1s.
Since this requires only one switch, you do not need any extra circuit. Just connect evive to your computer using the USB cable and connect Arduino to an appropriate port. It is a very straightforward and easy script. You can check if you hear the tone when the switch is pressed.
Step 4: Piano Script
We are going to make script in Arduino mode and upload it to evive directly. Hence we will start with evive program.
As we want to check which touch input is touched continuously, we will use forever block from Control palette.
Now we just have to check if the touch channel is touched and play tone. The full Script is given.
Upload the Arduino code in evive and play with your piano.
Connect 8 conductive objects to evive.