Ryan Curtis
EE 47 - Summer 2015
Final Project Documentation
Point of View
My design point of view for the project is a way to enjoy music visually both as calming lights to study to and flashing to set the mood for a party or just hanging out with friends. The design of a cube would appear simplistic and meant to sit on a table. By using the frequencies in the music to be translated into a color it allows for increased enjoyment of the art in another form as well for pure entertainment of watching the LED's beat to the music. Because the best results using the LED visualization is with pop and rock music rather than slower music, it is targeted towards teenagers and students like myself.
Verplank Diagram
State Diagram
Paper Prototype
Breadboard Prototype
Perf Board Prototype
Parts List
1 Arduino Micro
1 MSGEQ7 Graphic Equilizer Chip
1 Speaker
4 Red LEDs
4 Yellow LEDs
4 Green LEDs
4 Blue LEDs
8 470 Ohm Resistors
4 1000 Ohm Resistors
4 TIP 120 transistors
1 Audio jack
4 .22 uF capacitors
1 33 pF
1 .1 uF
1 Button
1 180 ohm resistor
1 Superbright LED
1 10k Ohm Resistor
1 8-pin socket
Project Code
int analogPin = A0; // read from multiplexer using analog input 0
int strobePin = 2; // strobe is attached to digital pin 2
int resetPin = 3; // reset is attached to digital pin 3
int spectrumValue[7]; // to hold a2d values
int highSounds = 6; // corresponds with the high range of the audio file
int midSounds = 7; // corresponds with the medium range of the audio file
int lowSounds = 5; // corresponds with the low range of the audio file
int bassSounds = 4; // corresponds with the bass range of the audio file
const int buttonPin = 12; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0;
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
pinMode(analogPin, INPUT);
pinMode(strobePin, OUTPUT);
pinMode(resetPin, OUTPUT);
pinMode(highSounds, OUTPUT);
pinMode(midSounds, OUTPUT);
pinMode(lowSounds, OUTPUT);
pinMode(bassSounds, OUTPUT);
analogReference(DEFAULT);
digitalWrite(resetPin, LOW);
digitalWrite(strobePin, HIGH);
Serial.println("MSGEQ7 test by J Skoba");
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
digitalWrite(bassSounds, LOW);
digitalWrite(lowSounds, LOW);
digitalWrite(midSounds, LOW);
digitalWrite(highSounds, LOW);
} else {
digitalWrite(ledPin, LOW);
digitalWrite(resetPin, HIGH);
digitalWrite(resetPin, LOW);
for (int i = 0; i < 7; i++)
{
digitalWrite(strobePin, LOW);
//delay(30); // to allow the output to settle
spectrumValue[i] = analogRead(analogPin);
/* determines what the value of the bass is, and how to
display it to the led for bass by using a map and then
analogWrite function.
*/
if (i == 0) {
//int bassValue = map(spectrumValue[i], 200, 900, 0, 255);
int bassValue = map(spectrumValue[i], 0, 1023, 100, 255);
analogWrite(bassSounds, bassValue);
//Serial.print(bassValue +" ");
}
/* determines what the value of the mid range is, and how to
display it to the led for bass by using a map and then
analogWrite function.
*/
else if (i == 2) {
//int lowValue = map(spectrumValue[i], 200, 900, 0, 255);
int lowValue = map(spectrumValue[i], 0, 1023, 0, 255);
analogWrite(lowSounds, lowValue);
//Serial.print(lowValue +" ");
}
/* determines what the value of the high range is, and how to
display it to the led for bass by using a map and then
analogWrite function.
*/
else if (i == 4) {
//int midValue = map(spectrumValue[i], 200, 1000, 0, 255);
int midValue = map(spectrumValue[i], 0, 1023, 0, 255);
analogWrite(midSounds, midValue);
//Serial.print(midValue +" ");
}
else if (i == 6) {
//int highValue = map(spectrumValue[i], 200, 950, 0, 255);
int highValue = map(spectrumValue[i], 0, 1023, 0, 255);
analogWrite(highSounds, highValue);
Serial.print(highValue +" ");
}
if (spectrumValue[i] < 10)
{
Serial.print(" ");
Serial.print(spectrumValue[i]);
//delay(10);
}
else if (spectrumValue[i] < 100 )
{
Serial.print(" ");
Serial.print(spectrumValue[i]);
//delay(10);
}
else
{
Serial.print(" ");
Serial.print(spectrumValue[i]);
//delay(10);
}
digitalWrite(strobePin, HIGH);
}
Serial.println();
}
}
Video Demo:
Challenges:
During the process the biggest challenge was making a secure connection on the perf board with the MSGEQ7 chip because of the short leads. This issue was solved by incorporating a socket for a more secure connection.
Extensions:
If I had more time to work on the project, I would add an audio amplifier with volume control buttons. I also want to replace the power cord with a battery and an on-off switch.
References:
http://pressplay.pbworks.com/w/page/68312750/CameronSteinfeld_FinalProject
https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf