Sensors

I would like to explain the sensors i am using for my installation.

At this stage of development I didn’t plan to do many experiments with sensors with a thought to tackle this subject much deeper in my Extended major project. I decided to use just few in order to get the feel of them and how they work, and what sort of coding is needed to extract the data.  I obtained two different sensors.

Vibration sensor:

This sensor is called Mini Sense100, it is lead free horizontal vibration sensor. A low-cost cantilever-type vibration sensor loaded by a mass to offer high sensitivity at low frequencies. The pins are designed for easy installation and are solderable. Sensor has excellent linearity and dynamic range, and may be used for detecting either continuous vibration or impacts.
Reason why i picked this sensor is because it was relatively cheap and versatile. It seemed to be easy attachable to different instruments and it didn’t seem to be very complicated in coding either.

Sound/voice sensor:

Arduino series MIC voice sensor plug and play A belt of the amplifier circuit miniature MIC (microphone) voice sensor.The voice of the sensor output can be connected to any of the micro controller with AD converter, especially suitable for Arduino controller can accomplish the perception, use the interaction of the sound environment works.

I chose this sensor because it would let me to gather different source of data. Comparing to the vibration sensor which needs a physical surface to be functional, the sound sensor can be placed anywhere and is still capable to read and send data. Also having two different types of sourcing data will make the piece more diverse and extravert.

Here are some images of soldering sensors and wiring them to the arduino breadboard:

Pedro helped me to solder these sensors to small cables and then i wired them into a bread board. I followed a tutorial on the Arduino website which describes how to get data from analog sensors.

In order to read data i have to upload on my arduino board a small program written in code which allows to monitor analog readings in external monitor. Here is a code which i use for reading 3 analog sensors and send these readings to serial port. Serial port is used by Processing which picks up these reading and implements them in another code which deals with visual generation.

/* Knock Sensor

This sketch reads a piezo element to detect a knocking sound.
It reads an analog pin and compares the result to a set threshold.
If the result is greater than the threshold, it writes
“knock” to the serial port, and toggles the LED on pin 13.

The circuit:
* + connection of the piezo attached to analog in 0
* – connection of the piezo attached to ground
* 1-megohm resistor attached from analog in 0 to ground

http://www.arduino.cc/en/Tutorial/Knock

created 25 Mar 2007
by David Cuartielles <http://www.0j0.org&gt;
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.

*/

// these constants won’t change:
const int ledPin = 13; // led connected to digital pin 13
const int knockSensorred = A0;
const int knockSensorgreen = A1;
const int knockSensorblack = A2;// the piezo is connected to analog pin 0
const int threshold = 100; // threshold value to decide when the detected sound is a knock or not

const int numReadings = 3;

int readings1[numReadings];
int readings2[numReadings];
int index = 0;
int total = 0;
int total2 = 0;
int average = 0;
int average2 = 0;
// these variables will change:
int sensorReading = 0;
int sensorReading1 = 0;
int sensorReading2 = 0;
// variable to store the value read from the sensor pin
int ledState = LOW; // variable used to store the last LED status, to toggle the light

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
Serial.begin(9600); // use the serial port

for (int thisReading = 0; thisReading < numReadings; thisReading++){
readings1[thisReading] = 0;
readings2[thisReading] = 0;
}
}

void loop() {

total = total – readings1[index];
total2 = total2 – readings2[index];

// read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(knockSensorred);
readings1[index] = analogRead(sensorReading1);
//sensorReading1 = analogRead(knockSensorgreen);
readings2[index] = analogRead(sensorReading2);
//sensorReading2 = analogRead(knockSensorblack);

total = total + readings1[index];
total2 = total2 + readings2[index];
index = index +1;

if (index >= numReadings) {
index = 0;
}

average = total / numReadings;
average2 = total2 / numReadings;

//Serial.println(sensorReading);
// if the sensor reading is greater than the threshold:
//if (sensorReading > threshold) {
// toggle the status of the ledPin:
//ledState = !ledState;
// update the LED pin itself:
//digitalWrite(ledPin, ledState);
// send the string “Knock!” back to the computer, followed by newline
Serial.print(sensorReading);
Serial.print(“,”);
//Serial.print(sensorReading1);
Serial.print(average);
Serial.print(“,”);
Serial.println(average2);
//Serial.println(sensorReading2);
//Serial.print(“,”);
//}
delay(100); // delay to avoid overloading the serial port buffer
}

————

I am using 3 analog pins located on arduino board and receive raw data from analog sensors. I am using rather long cable and no resistors which is not very desirable condition. As shorter the connections as better, because with long cables the current can alter readings unexpectedly. Recently i have been facing the issue of value fluctuation, i haven’t detected the reason yet, but that might be connected with having a long cable (i could shorten it up), Power interference from laptop via usb (i could solve it by using external power supply such as battery power) or no resistor usage.
Nevertheless i have managed to even the value fluctuation by calculating the average value of 10 readings and sending only the average to Processing. The only problem with this is that sharp detections are smoothened out and it seems that sensor is very “slow” and not momentarily responsive.

In future i will spend more time learning about sensors, wiring them up properly with resistors and understanding the written schemes what is the current flow through them. In order to achieve very organic and flexible audio response into visuals i have to be very careful choosing sensors for particular instruments. Different sensors can either expose or neglect the possibilities of each instrument. The physicality and function has to match the specification of the sensor (vibration, sound, distance, temperature, pressure, etc) to achieve perfect match and smooth translation into visuals. My examples of this project are very crude and at the very beginners stage.

Here is a small video showing how vibration sensor changes some attributes of the visuals:

[vimeo vimeo.com/33082294]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s