Tag Archives: Fabiola Einhorn

Air Quality Headphones Update

Our team met this week to prototype the air-sensor to audio interaction. In this example we are using an optical dust sensor to sense the amount of particulate matter in the air. We are mapping these values to an audio output.

Due to complications with GPS and data logging we have decided to limit the scope of our initial prototype to the interaction between dust, sound, and the wearer of the headphones. For our next steps we plan to miniaturize the prototype, and work on the manipulation of the sound. We will also begin designing the headphones themselves.

Demo

Code

//Dust Sensor

int dustPin=0;

int dustVal=0;

int ledPower=2;

int delayTime=280;

int delayTime2=40;

float offTime=9680;

//Piezo

const int buzzerPin = 8;

//Setup

void setup(){

Serial.begin(9600);

pinMode(ledPower,OUTPUT);

pinMode(4, OUTPUT);

pinMode(buzzerPin, OUTPUT);

}

void loop(){

// ledPower is any digital pin on the arduino connected to Pin 3 on the sensor

digitalWrite(ledPower,LOW); // power on the LED

delayMicroseconds(delayTime);

dustVal=analogRead(dustPin); // read the dust value via pin 5 on the sensor

delayMicroseconds(delayTime2);

digitalWrite(ledPower,HIGH); // turn the LED off

delayMicroseconds(offTime);

Serial.println(dustVal);

dustVal = map(dustVal, 100, 1000, 31, 3000);

tone(buzzerPin, dustVal);

Serial.println(dustVal);

delay(1000/16);

noTone(buzzerPin);

}