PIR and SD Card Shield

PIR datasheet
SD Card Shield
TMRpcm library

Project:

Format: Installation
Media: Sound
Dimensions 4m2 (32 square feet)


Abstract:
Shh, listen… is a sound installation that seeks to stimulate listening awareness of sounds that we take for granted.

Introduction and Background:
 I want to explore the sounds that belong to a “soundscape” that humans can hear but which that they tend not to pay attention to. My intention is to bring these sounds into the “worth paying attention” realm, thus making them “visible” again.
Namely, this piece explores ways of “making visible the invisible”, a main focus of interest in my practice.

Description:
Shh, listen… consists on a furnished room with hidden microphones, amplifiers and speakers. A sound of “voices whispering” is heard in the room when nobody is present and becomes silent when someone enters. Then, as a person enters the space, she will hear the sound of his/her movements amplified.


Schematics:
Circuit and "box":



Demo:



Code:
#include 
#define SD_ChipSelectPin 10
#include 
#include 
TMRpcm player;

boolean personPresent = false;
int pirVal = 0;
long unsigned int arrivalTime;
long unsigned int pauseTime = 5000;
int pirPin = 2;
int ledPin = 13;
int calibrationTime = 30;  
int stopTime = 10;

void setup(){
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
  player.speakerPin = 9;
  calibrate();
  checkSD();
  player.play("Shh1.wav");
}

void loop(){
  lookForPeople();
  if(personPresent) stopTune();
}
void lookForPeople(){  
  Serial.println("looking");
  pirVal = digitalRead(pirPin); 
  Serial.println(pirVal, DEC);
  if(pirVal == HIGH){
    personPresent = true;
    Serial.println("person is present");
    arrivalTime = millis();
  }
  else{
     if(millis() > arrivalTime + pauseTime){
         personPresent = false;
     }
     else player.play("Shh1.wav");
  }
}

void playTune(){
  player.play("Shh1.wav");
}

void stopTune(){
  player.stopPlayback();
  for(int i = 0; i < stopTime; i++){
      Serial.print(".");
      delay(1000);
      }
    player.play("Shh1.wav");
}
void checkSD(){
  if(!SD.begin(SD_ChipSelectPin)){
    Serial.println("SD fail");  
    return;  
  }
}
void calibrate(){
    Serial.print("calibrating sensor ");
    for(int i = 0; i < calibrationTime; i++){
      Serial.print(".");
      delay(1000);
      }
    Serial.println(" done");
    Serial.println("SENSOR ACTIVE");
    delay(50);
}