Sunday, 30 March 2014

Capacitive Sensor +Arduino



Arduino code:


#include <CapacitiveSensor.h>

/*
 * CapitiveSense Library Demo Sketch
 * Paul Badger 2008
 * Uses a high value resistor e.g. 10M between send pin and receive pin
 * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
 * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
 */


CapacitiveSensor   cs_2_4 = CapacitiveSensor(2,4);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired


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

void loop()                   
{

    long start = millis();
    long total1 =  cs_2_4.capacitiveSensor(30);


    Serial.print(millis() - start);        // check on performance in milliseconds
    Serial.print("\t");                    // tab character for debug windown spacing

    Serial.println(total1);
 

    delay(1000);                             // arbitrary delay to limit data to serial port
}


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REFLECTION ON PROJECT

For my GMIS project, I chose to use a capacitive sensor in order to try to design a musical instrument that would work with "finger touch". The initial plan is that the user will interact with the musical instrument by touching the sensors, although the capacitive sensor doesn't have a range of values but rather works as a switch.
Having that on mind, I decided to change a sensor, moving towards a ribbon sensor - potentiometer.



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -






No comments:

Post a Comment