Team Sense – Sound Snitch

Team Sense:
Gustav, Zihan, Sophie and Antya
What the ideal finished version of this product would be like/who’s it for:
Our ideal version of the product would have a different microphone; it would need to be more powerful to be able to catch when you are loud more precisely. Our light output could also be more potent so you could be able to see it from across the room or have the materials expand the light. It would also be important for the user to have access to change the threshold range so that they could select what they considered as unacceptable noise.
Regarding the materials, it would need to be made out of some plastic, maybe ABS or a similar one and it should have an opaque part and a transparent one so that the light can shine through. Ideally, it would be integrated with the speakers or even to your phone.
It would be focus towards young people who live in apartments or live in proximity to their neighbors, or teenagers even as they tend to be the loudest.

The technical steps you took to achieve your prototype:

We first came up with the idea to make a product which helped let someone know when they are playing music too loud.

The first step was to figure out the coding and try to understand the mic and coding for the mic. Once we got the mic to work with coding found from Becky’s recommendation, we decided to use a pixel stick as it would be bright enough to send off a visual sort of alarm to the person playing music too loud.

We played around with the coding for many hours and finally were able to figure out the right “if statements” and the right threshold for the volume of sound we wanted the sensor to react to.

We decided we wanted the design of the product to look somewhat like a fire alarm, where it would be white and mounted on the wall. We built our prototype for this out of wood and painted it white and made it so that the breadboard and circuit could fit nicely inside of the box with a transparent plastic on top for the light to shine through. Below are some of our process photos:

SoundSnitch2 from Antya Waegemann on Vimeo.

 

What did you learn from building this project?

Even though the whole mechanism is quite simple, there are still details needed to be work on very well in order for it to work properly. For example, we needed to transfer the measurement volume of the sound from the numbers in the Arduino code to the decibel in real life. This was something what we did not fully expect. How we completed that was to using a sound measuring app to measure the volume of some music we thought to be on a level exceeded which would be annoying. So even to make a very simple ideas into application, many unexpected details will need to taken care off.

What you would do next/differently if given more time on this project:

If we had had more time, then we would have incorporated an app remote into our project.

This would have allowed for the user to adjust the threshold. Thereby, the user would be able to customize the product to their need and linking.

Furthermore, it would be interesting to explore the input sensor our product and utilizing the output possibilities build within the smartphone.

Maybe, we could make the phone vibrate, when the threshold was reached?

Code:

 // NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include 
#ifdef __AVR__
#include <avr/power.h>
#endif

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define LED_PIN1            (5,6)
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      16
// Defining the mic
#define SAMPLE_WINDOW 33 // Sample window width in mS (33 mS = ~30 Hz)
#define MIC_PIN       A1 // ANALOG pin # where microphone "OUT" is connected
#define THRESHOLD     625

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, LED_PIN1, NEO_GRBW + NEO_KHZ800);

  int delayval = 200; // delay 


  void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  #if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif
  // End of trinket special code
  // Start mic setup
  pinMode(LED_PIN1, OUTPUT);
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // make the pushbutton's pin an input:
  pinMode(MIC_PIN, INPUT);

  pixels.begin(); // This initializes the NeoPixel library.
}

  void loop() {
int inputaudio = analogRead(MIC_PIN);
Serial.println(inputaudio);
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
if (inputaudio > THRESHOLD){
  Serial.println("Threshold has been exceeded");
  for(int i=0;i<pixels.numPixels();i++){

  // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(255,0,0)); // Moderately bright green color.

  //pixels.show(); // This sends the updated pixel color to the hardware.
  
  //delay(delayval); // Delay for a period of time (in milliseconds).
  //   
  //pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
  //pixels.setPixelColor(i, pixels.Color(0,0,0)); // Moderately bright green color.
  
  //pixels.show(); // This sends the updated pixel color to the hardware.

  //delay(delayval); // Delay for a period of time (in milliseconds).

  }
  pixels.show(); // This sends the updated pixe
  delay(delayval); // Delay for a period of time (in milliseconds).
  for(int i=0;i<pixels.numPixels();i++){

   // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
   pixels.setPixelColor(i, pixels.Color(0,0,0)); // Moderately bright green color.
    
}
  pixels.show(); // This sends the updated pixe
  delay(delayval); // Delay 
}

//  // Listen to mic for short interval, recording min & max signal
//  unsigned int signalMin = 1023, signalMax = 0;
//  unsigned long startTime = millis();
//  while((millis() - startTime) < SAMPLE_WINDOW) {
//    int sample = analogRead(MIC_PIN);
//    if(sample < signalMin) signalMin = sample; //    if(sample > signalMax) signalMax = sample; 
//    { 
//    int peakToPeak = signalMax - signalMin; // Max - min = peak-peak amplitude
//  int n = (peakToPeak -1) / 4;          // Remove low-level noise, lower gain
//  if(n > 50)    n = 50;                 // Limit to valid PWM range
//  else if(n < 0) n = 0;
//  analogWrite(LED_PIN1, n);   // And send to LEDs as PWM level
//  // read the input pin:
//  int buttonState = digitalRead(MIC_PIN);
//  // print out the state of the button:
//  Serial.println(buttonState);
//  delay(1);        // delay in between reads for stability 
//  }
//  }
  }

Leave a comment

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