Touch Based Piano

About
Make an eight key DIY piano using capacitive touch inputs. The sound is generated using a piezo buzzer which is in-built (in evive).
Info
Programming Platform:
Scratch
Difficulty:
Beginner
Estimated Time (hrs):
2

Introduction

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.

Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1
Male to Male Jumper Cable 20cm 8

Story

Step 1:

Circuit Diagram

Attach your objects to evive touch input channel 1 to 8.

evive Capacitive Touch Pins

Channel 1 is the top left pin, channel 2 is the bottom left pin, channel 3 is next to channel 1 on the right side, and so on.
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:

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.

set tone

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.

Playing tone using touch inputs of evive in Arduino mode.

Upload the Arduino code in evive and play with your piano.

 

Circuit Diagram

Connect 8 conductive objects to evive. Channel 1 is the top left pin, channel 2 is the bottom left pin, channel 3 is next to channel 1 on the right side, and so on.

Code

Piano
Download