Introduction: Capacitive Instrument (using the Principle of the Distance Sensor)

This is a tutorial on how to create a simple instrument by using Arduino and electric paint. Fingers of the user are detected by an implemented DISTANCE SENSOR.

This project was carried out for the course TfCD at TU Delft by:

Magdalena Paulina Ludwiczak (4628268)

Fermin Espin Franco (4549562)

Step 1: Prepare Required Materials

What you need are:

  • Arduino Uno
  • Breadboard
  • Male wires
  • Resistors above 1MOm (6.8 MOm were used in the project)
  • A speaker
  • Electric paint
  • A wooden board
  • A cable to connect Arduino with PC

Step 2: Write an Algorithm for Arduino

Read about Capacitive Sensing Library for Arduino here: http://playground.arduino.cc/Main/CapacitiveSensor...

Write an algorithm using this library. The program should be able to detect the presence of the human body being close to one of the loose wires by using the principle of a distance sensor. If the human is detected, the applicable signal should be then sent to the speaker - each loose wire holds a different sound, which is then generated through the speaker.

Example code:

#include
#include "pitch.h"

#define speaker 11

CapacitiveSensor c1=CapacitiveSensor(2,3);

CapacitiveSensor c2=CapacitiveSensor(2,4);

CapacitiveSensor c3=CapacitiveSensor(2,5);

CapacitiveSensor c4=CapacitiveSensor(2,6);

CapacitiveSensor c5=CapacitiveSensor(2,7);

CapacitiveSensor c6=CapacitiveSensor(2,8);

void setup(){

c1.set_CS_AutocaL_Millis(0xFFFFFFFF);

c2.set_CS_AutocaL_Millis(0xFFFFFFFF);

c3.set_CS_AutocaL_Millis(0xFFFFFFFF);

c4.set_CS_AutocaL_Millis(0xFFFFFFFF);

c5.set_CS_AutocaL_Millis(0xFFFFFFFF);

c6.set_CS_AutocaL_Millis(0xFFFFFFFF);

Serial.begin(9600);

Serial.setTimeout(50); }

void loop() {

long start = millis();

long total1 = c1.capacitiveSensor(30);

long total2 = c2.capacitiveSensor(30);

long total3 = c3.capacitiveSensor(30);

long total4 = c4.capacitiveSensor(30);

long total5 = c5.capacitiveSensor(30);

long total6 = c6.capacitiveSensor(30);

Serial.print(millis());

Serial.print("\t");

Serial.print(total1);

Serial.print("\t");

Serial.print(total2);

Serial.print("\t");

Serial.print(total3);

Serial.print("\t");

Serial.print(total4);

Serial.print("\t");

Serial.print(total5);

Serial.print("\t");

Serial.print(total6);

Serial.print("\n");

if (total1 > 60) { tone(13,NOTE_C4);}

if (total2 > 60) { tone(13,NOTE_D4);}

if (total3 > 60) { tone(13,NOTE_E4);}

if (total4 > 60) { tone(13,NOTE_F4);}

if (total5 > 60) { tone(13,NOTE_G4);}

if (total6 > 60) { tone(13,NOTE_A4);}

if (total1<60 & total2<60& total3<60& total4<60& total5<60& total6<60)

{ noTone(13); }

delay(10); }

Step 3: Connect With Arduino

Place all the components on the breadboard and connect them in a correct way with Arduino as shown on the picture. The circles presented on the drawing will be described in the following steps.

Step 4: Prolong the Lose Wires Using the Electric Paint

Draw circles on the wooden board and connect them with the loose wires by using the electric paint.

Step 5: Play !

Play simple melodies using your conductive instrument.