This is my final project for EE47. I decided to make this project because it involved more design and electronics.
Music has an important role in human's life. It let us express our feelings, dance to it or motivate us. A world without sound would be very boring. We can hear music, we can even feel music, but how can we see music?
That´s why I wanted to design a way to see music, to see its rhythm and its beat. At the same time, I wanted another function, so I decided to make it also a lamp. I wanted to use the latest technology, so I decided to use bright color LED's for the musical function, as well as high power LEDs for the lamp.
The material which I decided to use is acrylic, which is laser-cuttable, as well as a light and clear material. I wanted it to be transparent, but at the same time that the interior could not be seen, so I sandblasted the acrylic to make it a frosty effect.
-
float factor = 0.8;
-
unsigned int limit = 0;
-
int sizeb = 250;
-
int pastValues [250];
-
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 ledPinBass = A9;
-
int ledPinMed = A7;
-
int ledPinHigh = A6;
-
int spectrumValue[7]; // to hold a2d values\
-
-
-
int point = 0;
-
-
-
void setup()
-
{
-
- // Serial.begin(115200);
-
-
pinMode(analogPin, INPUT);
-
pinMode(strobePin, OUTPUT);
-
pinMode(resetPin, OUTPUT);
-
pinMode(ledPinBass, OUTPUT);
-
pinMode(ledPinMed, OUTPUT);
-
pinMode(ledPinHigh, OUTPUT);
-
analogReference(DEFAULT);
-
-
-
digitalWrite(resetPin, LOW);
-
digitalWrite(strobePin, HIGH);
-
-
for (int z = 0; z<sizeb ; z++){
-
pastValues [z] = 300;
-
}
-
-
}
-
-
void loop()
-
{
-
digitalWrite(resetPin, HIGH);
-
digitalWrite(resetPin, LOW);
-
-
for (int i = 0; i < 7; i++)
-
{
-
digitalWrite(strobePin, LOW);
-
delayMicroseconds(30); // to allow the output to settle
-
spectrumValue[i] = analogRead(analogPin);
-
if (i == 0 ){
-
-
pastValues[point++] = spectrumValue[i];
-
// Serial.print(spectrumValue[i]);
-
// Serial.print ("L ");
-
if(point >sizeb)
-
point=0;
-
promedio();
-
-
//analogWrite(ledPin, (spectrumValue[i]/4) );
-
if (spectrumValue[i] >(limit)){
-
// digitalWrite(ledPin, HIGH);
-
// delay(25);
-
for (int y = 255;y>=0;y--){
-
analogWrite(ledPinBass,y);
-
delayMicroseconds(500);
-
}
-
}
-
else
-
analogWrite(ledPinBass, 0);
-
}
-
-
if (i == 4){
-
-
if (spectrumValue[1] > limit){
-
analogWrite(ledPinBass,255);
-
delay(5);
-
}
-
else{
-
analogWrite(ledPinBass,0);
-
}
-
-
// Serial.print( spectrumValue[2]);Serial.print( " " );
-
// Serial.print( spectrumValue[3]);Serial.print( " " );
-
// Serial.print( spectrumValue[4]);Serial.print( " " );
-
if (spectrumValue[2] > limit*factor*1.05 || spectrumValue[3]> limit*factor*1.05 ||spectrumValue[4]> limit*factor*1.05){
-
analogWrite(ledPinMed,255);
-
delay(5);
-
}
-
else{
-
analogWrite(ledPinMed,0);
-
}
-
-
-
}
-
-
if (i == 6){
- // Serial.print( spectrumValue[5]);Serial.print( " " );
- // Serial.print( spectrumValue[6]);Serial.println( " " );
-
-
if (spectrumValue[5] > limit*factor|| spectrumValue[6]> limit*factor ){
-
analogWrite(ledPinHigh,255);
-
delay(5);
-
}
-
else{
-
analogWrite(ledPinHigh,0);
-
}
-
-
-
}
-
/*
- // comment out/remove the serial stuff to go faster
- // - its just here for show
- if (spectrumValue[i] < 10)
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else if (spectrumValue[i] < 100 )
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- */
-
-
digitalWrite(strobePin, HIGH);
-
}
-
-
}
-
-
void promedio (){
-
unsigned long suma = 0;
-
for (int z = 0; z <=sizeb;z++){
-
suma+=pastValues[z];
-
}
-
limit = suma/sizeb;
-
limit= limit*2.2;
-
// Serial.println(limit);
-
}
-
-
-
-
-
-
-
-
unsigned int limit = 0;
-
int pastValues [1000];
-
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 ledPin = A9;
-
int spectrumValue[7]; // to hold a2d values\
-
-
int point = 0;
-
-
-
void setup()
-
{
-
-
Serial.begin(115200);
-
-
pinMode(analogPin, INPUT);
-
pinMode(strobePin, OUTPUT);
-
pinMode(resetPin, OUTPUT);
-
pinMode(ledPin, OUTPUT);
-
analogReference(DEFAULT);
-
-
-
digitalWrite(resetPin, LOW);
-
digitalWrite(strobePin, HIGH);
-
-
for (int z = 0; z<1000 ; z++){
-
pastValues [z] = 300;
-
}
-
-
}
-
-
void loop()
-
{
-
digitalWrite(resetPin, HIGH);
-
digitalWrite(resetPin, LOW);
-
-
for (int i = 0; i < 7; i++)
-
{
-
digitalWrite(strobePin, LOW);
-
delayMicroseconds(30); // to allow the output to settle
-
spectrumValue[i] = analogRead(analogPin);
-
if (i == 0 ){
-
-
pastValues[point++] = spectrumValue[i];
- // Serial.print(spectrumValue[i]);
- // Serial.print ("L ");
-
if(point >1000)
-
point=0;
-
promedio();
-
-
//analogWrite(ledPin, (spectrumValue[i]/4) );
-
if (spectrumValue[i] >(limit)){
-
// digitalWrite(ledPin, HIGH);
-
// delay(25);
-
for (int y = 255;y>=0;y--){
-
analogWrite(ledPin,y);
-
delayMicroseconds(450);
-
}
-
}
-
else
-
analogWrite(ledPin, 0);
-
}
-
-
-
/*
- // comment out/remove the serial stuff to go faster
- // - its just here for show
- if (spectrumValue[i] < 10)
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else if (spectrumValue[i] < 100 )
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- */
-
-
digitalWrite(strobePin, HIGH);
-
}
-
-
}
-
-
void promedio (){
-
unsigned long suma = 0;
-
for (int z = 0; z <=1000;z++){
-
suma+=pastValues[z];
-
}
-
limit = suma/1000.0;
-
limit= limit*2.5;
-
Serial.println(limit);
-
}
-
-
-
-
-
-
-
-
-
unsigned int limit = 0;
-
int pastValues [1000];
-
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 ledPin = A9;
-
int spectrumValue[7]; // to hold a2d values\
-
-
int point = 0;
-
-
-
void setup()
-
{
-
- // Serial.begin(28800);
-
-
pinMode(analogPin, INPUT);
-
pinMode(strobePin, OUTPUT);
-
pinMode(resetPin, OUTPUT);
-
pinMode(ledPin, OUTPUT);
-
analogReference(DEFAULT);
-
-
-
digitalWrite(resetPin, LOW);
-
digitalWrite(strobePin, HIGH);
-
-
for (int z = 0; z<1000 ; z++){
-
pastValues [z] = 80;
-
}
-
-
}
-
-
void loop()
-
{
-
digitalWrite(resetPin, HIGH);
-
digitalWrite(resetPin, LOW);
-
-
for (int i = 0; i < 7; i++)
-
{
-
digitalWrite(strobePin, LOW);
-
delayMicroseconds(30); // to allow the output to settle
-
spectrumValue[i] = analogRead(analogPin);
-
if (i == 0 ){
-
-
pastValues[point++] = spectrumValue[i];
- // Serial.print(spectrumValue[i]);
- // Serial.print ("L ");
-
if(point >1000)
-
point=0;
-
promedio();
-
-
//analogWrite(ledPin, (spectrumValue[i]/4) );
-
if (spectrumValue[i] >(limit)){
-
// digitalWrite(ledPin, HIGH);
-
// delay(25);
-
for (int y = 255;y>=0;y--){
-
analogWrite(ledPin,y);
-
delayMicroseconds(450);
-
}
-
}
-
else
-
analogWrite(ledPin, 0);
-
}
-
-
-
/*
- // comment out/remove the serial stuff to go faster
- // - its just here for show
- if (spectrumValue[i] < 10)
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else if (spectrumValue[i] < 100 )
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- */
-
-
digitalWrite(strobePin, HIGH);
-
}
-
-
}
-
-
void promedio (){
-
unsigned long suma = 0;
-
for (int z = 0; z <=1000;z++){
-
suma+=pastValues[z];
-
}
-
limit = suma/1000.0;
-
limit= limit*1.75;
-
// Serial.println(limit);
-
}
-
-
-
-
-
-
-
-
- #include "RunningAverage.h"
-
-
RunningAverage bajos(1000);
-
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 ledPin = A9;
-
int spectrumValue[7]; // to hold a2d values\
-
-
-
void setup()
-
{
-
-
Serial.begin(9600);
-
bajos.clr();
-
pinMode(analogPin, INPUT);
-
pinMode(strobePin, OUTPUT);
-
pinMode(resetPin, OUTPUT);
-
pinMode(ledPin, OUTPUT);
-
analogReference(DEFAULT);
-
-
-
digitalWrite(resetPin, LOW);
-
digitalWrite(strobePin, HIGH);
-
-
}
-
-
void loop()
-
{
-
digitalWrite(resetPin, HIGH);
-
digitalWrite(resetPin, LOW);
-
-
for (int i = 0; i < 7; i++)
-
{
-
digitalWrite(strobePin, LOW);
-
delayMicroseconds(30); // to allow the output to settle
-
spectrumValue[i] = analogRead(analogPin);
-
if (i == 0 ){
-
-
bajos.add(spectrumValue[i] );
-
Serial.println(bajos.avg());
-
//analogWrite(ledPin, (spectrumValue[i]/4) );
-
if (spectrumValue[i] >(bajos.avg()*2)){
-
// digitalWrite(ledPin, HIGH);
-
// delay(25);
-
for (int y = 255;y>=0;y--){
-
analogWrite(ledPin,y);
-
delayMicroseconds(450);
-
}
-
}
-
else
-
analogWrite(ledPin, 0);
-
}
-
-
-
/*
- // comment out/remove the serial stuff to go faster
- // - its just here for show
- if (spectrumValue[i] < 10)
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else if (spectrumValue[i] < 100 )
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- else
- {
- Serial.print(" ");
- Serial.print(spectrumValue[i]);
- }
- */
-
-
digitalWrite(strobePin, HIGH);
-
}
-
Serial.println();
-
}
-
-
-
-
-
-
-
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 ledPin = A9;
-
int spectrumValue[7]; // to hold a2d values\
-
-
-
void setup()
-
{
-
Serial.begin(9600);
-
pinMode(analogPin, INPUT);
-
pinMode(strobePin, OUTPUT);
-
pinMode(resetPin, OUTPUT);
-
pinMode(ledPin, OUTPUT);
-
analogReference(DEFAULT);
-
-
-
digitalWrite(resetPin, LOW);
-
digitalWrite(strobePin, HIGH);
-
-
Serial.println("MSGEQ7 test by J Skoba");
-
}
-
-
void loop()
-
{
-
digitalWrite(resetPin, HIGH);
-
digitalWrite(resetPin, LOW);
-
-
for (int i = 0; i < 7; i++)
-
{
-
digitalWrite(strobePin, LOW);
-
delayMicroseconds(30); // to allow the output to settle
-
spectrumValue[i] = analogRead(analogPin);
-
if (i == 0 ){
-
//analogWrite(ledPin, (spectrumValue[i]/4) );
-
if (spectrumValue[i] >124){
-
// digitalWrite(ledPin, HIGH);
-
// delay(25);
-
for (int y = 255;y>=0;y--){
-
analogWrite(ledPin,y);
-
delayMicroseconds(500);
-
}
-
}
-
else
-
analogWrite(ledPin, 0);
-
}
-
-
// comment out/remove the serial stuff to go faster
-
// - its just here for show
-
if (spectrumValue[i] < 10)
-
{
-
Serial.print(" ");
-
Serial.print(spectrumValue[i]);
-
}
-
else if (spectrumValue[i] < 100 )
-
{
-
Serial.print(" ");
-
Serial.print(spectrumValue[i]);
-
}
-
else
-
{
-
Serial.print(" ");
-
Serial.print(spectrumValue[i]);
-
}
-
-
-
digitalWrite(strobePin, HIGH);
-
}
-
Serial.println();
-
}
-
Comments (1)
yusi chen said
at 2:41 pm on Aug 22, 2012
Hi Mauricio,
Wonderful job!
We appreciate that you include scenarios, figures of brainstorm process, paper prototype and state diagram to clarify your design process. Your idea of visualize the rhyme and beat of music is great. Also, you include more function in your product, which is awesome. Multi-use of one product is really helpful for daily use!
We know that time is limited for summer quarter final project. We do hope you have more time to fix the problem of noise for white LED lamb. Also, we do wish you can add more detail design sketches to show us your design logic chain. Besides, we do hope you can transfer your product from the breadboard to a perf board, which will be more reliable! What's more, we hope you can add more details to illustrate how you design your product, like the rotation switch, and the problems you have met with.
If you have more time to redo the project, we do wish you can add more features and make some small corrections of your current configuration. For example, may be you can add a disco ball to shine images on wall according your visible beat and rhyme, which will be more fantastic.
Awesome project!
Best,
David, Yusi, Kai and Ben
You don't have permission to comment on this page.