Kaylee Griffin and Alaina Ruggery
Published

COM 250 Critical Making Project

Communicating sound using LED Lights.

BeginnerShowcase (no instructions)2,193
COM 250 Critical Making Project

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SparkFun Audio-Sound Breakout - WTV020SD
SparkFun Audio-Sound Breakout - WTV020SD
×1

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Video of Sound Sensor Connected

This is a video of our initial sound sensor successfully connected to the Sparkfun Arduino. You can see that it is working from the red lights glowing on the sound sensor itself. Also the LED light is flashing.

Final Project Laser Cut Encasing

This a video of our completed project communicating the sound of music using LEDs.

Trial run with 6 LEDs

As we became more comfortable with the code we added more LEDs to it. This is an example of our trial run with 6 LEDs.

Trial Run With 3 LEDs

Our first trial run with the new Adafruit sensor when we used only three LEDs.

Final Project Documentation

This video shows the finished product. It shows the laser cut encasing of our arduino which includes an opening for the microphone of the sound sensor, as well as another opening for the USB cord on the side. At the end of the video the internal hardware is also shown.

Code

Code for 8 LED Sound Detecting Lights

Arduino
This is our completed and working code we have written for the final project. This code allows for 8 LED's. We have tinkered with the sound thresholds to find the perfect range to dictate when each light can turn on.
const int input = A0;
const int p1 = 7;
const int p2 = 8;
const int p3 = 9;
const int p4 = 10;
const int p5 = 11;
const int p6 = 12;
const int p7 = 13;
const int p8 =6;
int sense2 = 0;
int sense = 0;

void setup() {
pinMode(p1, OUTPUT);
pinMode(p2, OUTPUT);
pinMode(p3, OUTPUT);
pinMode(p4, OUTPUT);
pinMode(p5, OUTPUT);
pinMode(p6, OUTPUT);
pinMode(p7, OUTPUT);
pinMode(p8, OUTPUT); 
}

void loop() {
sense2 = analogRead(input);
sense = map(sense2, 0, 1023, 0, 255);
if (sense < 90) {
digitalWrite(p1, LOW);
digitalWrite(p2, LOW);
digitalWrite(p3, LOW);
digitalWrite(p4, LOW);
digitalWrite(p5, LOW);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 90) && (sense < 93)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, LOW);
digitalWrite(p3, LOW);
digitalWrite(p4, LOW);
digitalWrite(p5, LOW);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 93) && (sense < 97)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, LOW);
digitalWrite(p4, LOW);
digitalWrite(p5, LOW);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 97) && (sense < 101)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, LOW);
digitalWrite(p5, LOW);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 101) && (sense < 106)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, HIGH);
digitalWrite(p5, LOW);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 106) && (sense < 110)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, HIGH);
digitalWrite(p5, HIGH);
digitalWrite(p6, LOW);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 110) && (sense < 113)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, HIGH);
digitalWrite(p5, HIGH);
digitalWrite(p6, HIGH);
digitalWrite(p7, LOW);
digitalWrite(p8, LOW);
} else if ((sense >= 113) && (sense < 116)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, HIGH);
digitalWrite(p5, HIGH);
digitalWrite(p6, HIGH);
digitalWrite(p7, HIGH);
digitalWrite(p8, LOW);
} else if ((sense >= 116)) {
digitalWrite(p1, HIGH);
digitalWrite(p2, HIGH);
digitalWrite(p3, HIGH);
digitalWrite(p4, HIGH);
digitalWrite(p5, HIGH);
digitalWrite(p6, HIGH);
digitalWrite(p7, HIGH);
digitalWrite(p8, HIGH);
}
}

Initial Working Code

Arduino
Attached is the first working code we have written for the sound sensor. This code turns LED's on based on the volume of sound. Each LED is assigned a volume threshold that will turn and keep on the light as long as that volume is reached.
const int input = A0;
const int p1 = 7;
const int p2 = 8;
const int p3 = 9;
int sense2 = 0;
int sense = 0;

void setup() {
  pinMode(p1, OUTPUT);
  pinMode(p2, OUTPUT);
  pinMode(p3, OUTPUT);
}

void loop() {
  sense2 = analogRead(input);
  sense = map(sense2, 0, 1023, 0, 255);
  if (sense < 83) {
    digitalWrite(p1, LOW);
    digitalWrite(p2, LOW);
    digitalWrite(p3, LOW);
  } else if ((sense >= 83) && (sense < 92)) {
    digitalWrite(p1, HIGH);
    digitalWrite(p2, LOW);
    digitalWrite(p3, LOW);
  } else if ((sense >= 92) && (sense < 105)) {
    digitalWrite(p1, HIGH);
    digitalWrite(p2, HIGH);
    digitalWrite(p3, LOW);
  } else if (sense >= 105) {
    digitalWrite(p1, HIGH);
    digitalWrite(p2, HIGH);
    digitalWrite(p3, HIGH);
  }
}

Credits

Kaylee Griffin and Alaina Ruggery
1 project • 0 followers
Final Critical Making Project for COM 250

Comments