Thursday, February 5, 2009

Interactive Harmonics Display Prototype

Overview of Project

This prototype illustrates the relationship between materials' natural frequencies and harmonics. The device is conceived of as occupying one space within a children's activity center/museum and is intended for children of 8-12 years.

As a child enters the space, a motion sensor turns on t he color wheel, attracting the child's
attention. As the child approaches, a proximity sensor sets the vibratory plate to harmonic frequency and a pattern forms on the plate. The harmonics are adjusted by the child moving to different sides of the box and by moving closer or farther away to control the fidelity. The harmonic patterns are captured and projected onto the room's walls. In addition, the color of the light emanating from above changes with the frequency – higher frequencies equating with shorter wavelength colors. This design teaches about the interrelationship between form,
material, sound, light and harmonics.

A further development of this idea is to produce frequency harmonics in the form of melody
tunes (in response to stimulus from the passive IR sensors) which can further stimulate the curiosity of the child.

-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
Images & Video



































































-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
Hardware
1 servomotor
Passive infrared sensor
3 infrared sensors
Speaker(with amplifier) and independent power source
2 LED’s
2 Arduino Boards

----------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------
Code for the pass
ive IR sensor and speaker
int calibrationTime = 30;
long unsigned int lowIn;
long unsigned int pause = 5000;
boolean lockLow = true;
boolean takeLowTime;
int pirPin = 3;
int speakerPin = 9;
int length = 15; // the number of notes
char notes[] = "ccggaagffee
ddc ";
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 300;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char n
ote, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
for (int i = 0; i < 8; i++) {
if (names[i] == note)
playTone(tones[i], duration);
}
}
}
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(speakerPin, OUTPUT);

digitalWrite(pirPin, LOW);
Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
}
void loop(){
if(digitalRead(pirPin) == HIGH){
digitalWrite(speakerPin, HIGH);
for (int i = 0; i < length; i++) {
if (notes[i] == ' ') {
delay(beats[i] * tempo); // rest
} else {
playNote(notes[i], beats[i] * tempo);
}
delay(tempo / 2);
}
if(lockLow){
lockLow = fal
se;
Serial.println("---");
Serial.print("motion detected at ");
Serial.print(millis()/1000);
Serial.println(" sec");
delay(50);
}
takeLowTime = true;
}
if(digitalRead(pirPin) == LOW){
digitalWrite(speakerPin, LOW);
if(takeLowTime){
lowIn = millis();
takeLowTime = false;
}
if(!lockLow && millis
() - lowIn > pause){
lockLow = true;
Serial.print("motion ended at "); //output
Serial.print((millis() - pause)/1000);
Serial.println(" sec")
delay(50);
}
}
}

-------------------------------------------------
---------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------
Code for the servo and IR sensor
int calibrationTime = 30;
long unsigned int lowIn;
long unsigned int pause = 5000;
boolean lockLow = true;

boolean takeLowTime;
int pirPin = 3;
int servoPin = 9;
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(servoPin, OUTPUT);
digitalWrite(pirPin, LOW);
Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR AC
TIVE");
delay(50);
}

void loop(){

if(digitalRead(pirPin) == HIGH){
digitalWrite(servoPin, HIGH);
int temp;
for (temp = 0; temp <= 100; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1500); // 1.5ms
digitalWrite(servoPin,LOW);
delay(20); // 20 ms

}
for (temp = 0; temp <= 30; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1600); // 1.6ms
digitalWrite(servoPin,LOW);
delay(20); // 20ms
}
for (temp = 0; temp <= 31; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1400); // 1.4ms
digitalWrite(servoPin,LOW);
delay(20); // 20ms
}

if(lockLow){
lockLow = false;
Serial.println("---");
Serial.print("motion detected at ");
Serial.print(millis()/1000);
Serial.println(" sec");
delay(50);
}
takeLowTime = true;
}


if(digitalRead(pirPin) == LOW){
digitalWrite(servoPin, LOW);
if(takeLowTime){
lowIn = millis();
takeLowTime = false;
}
if(!lockLow && millis() - lowIn > pause){
lockLow = true;
Serial.print("motion ended at "); //output
Serial.print((millis() - pause)/1000);

Serial.println(" sec");
delay(50)
}
}
}


No comments:

Post a Comment