Tandoori Drums – Musical Instrument Project

Building off off my project last week, I decided to use the pressure sensors to craft a musical instrument. As the tradition african drums are a symbolic instrument where I am from(Senegal), I inspired myself from their design to build a series of drums out of coffee cups and pressure sensors.

African Drum

 

Final Results

The pressure sensors placed on top of each cups are connected to a breadboard underneath the white Tandoori pizza box (hence the name) as well as the speakers that you can see in the middle. Each cup generates a note on the minor or major music scale depending on how hard you press on the sensor. For instance, the first cup on the left of the image plays a high-pitched “Do” (minor) when it is touched lightly and a low-pitched “Do” (major) when you press it a little harder.

Because I could only plug in 6 pressure sensors, the third cup contains both the “Mi” and “Fa” notes.

1st cup – Do and Do#

2nd cup – Re and Re#

3rd cup – Mi and Fa

4th cup – Sol and Sol#

5th cup – La and La#

6th cup – Si and Si#

The concept is that anyone can play any songs that they want. I really enjoyed making this project. The most challenging part was to include 2 notes in the pressure sensor without creating a moment where you’d hear both notes at the same time. To solve the problem, I introduced an “empty space” or “empty note” in between intervals of sensor readings (when the sensor reading is between 550 and 600)to prevent the mix of sounds – Therefore, when the sensor reading is between 10 and 550, one note plays, when it is between 550 and 660, no notes play and when it is between 600 and above, another note plays. To achieve this, I had to measure where a “light touch” would fall in the spectrum, which happened to be within 10 and 550 and where a heavy touch would fall, which was above 600.

I have included my code below.

#include "pitches.h"
const int threshold=10;
const int threshold1 = 550; // minimum reading of the sensors that generates a note
const int threshold2=600;

const int cell0 = A0;
const int cell1 = A1;
const int cell2 = A2;
const int cell3 = A3;
const int cell4 = A4;
const int cell5 = A5;

// notes to play, corresponding to the 3 sensors:
int minor[] = {
 NOTE_C4, NOTE_D4, NOTE_E4,NOTE_G4, NOTE_A4,NOTE_B4
};
int major[]={
 NOTE_CS4, NOTE_DS4,NOTE_F4, NOTE_GS4, NOTE_AS4, NOTE_B4
};
int empty[]={
 0,0,0,0,0,0
};

void setup() {
 Serial.begin(9600);
 delay(1);
}

void loop() {
 int cellvalue0 = analogRead(cell0);
 Serial.println(cellvalue0);

 for (int thisSensor = 0; thisSensor < 6; thisSensor++) {
 // get a sensor reading:
 int sensorReading = analogRead(thisSensor);

 // if the sensor is pressed hard enough:
 if (sensorReading>threshold ) {
    if(sensorReading<threshold1){
 // play the note corresponding to this sensor:
       tone(8, minor[thisSensor], 300);
    }
 }
 delay(5);
 if (sensorReading>threshold1 ) {
     if(sensorReading<threshold2){
 // play the note corresponding to this sensor:
       tone(8, empty[thisSensor], 300);
     }
 }
 delay(5);
 
 if (sensorReading> threshold2){
 // play the note corresponding to this sensor:
    tone(8, major[thisSensor], 300);
 }
 delay(5);
 }
}