| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Social distancing? Try a better way to work remotely on your online files. Dokkio, a new product from PBworks, can help your team find, organize, and collaborate on your Drive, Gmail, Dropbox, Box, and Slack files. Sign up for free.

View
 

Beat Bright Lamp - Final project

Page history last edited by Mauricio Caballero 7 years, 9 months ago

Beat Bright Lamp! 

Final project EE47

 

Introduction

     This is my final project for EE47. I decided to make this project because it involved more design and electronics. 

 

Point of view

 

     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.

 

 Verplank diagram

 

 

 

Paper prototype

 

 

 

State diagram

 

 

Project code 

 

  1. float factor = 0.8;
  2. unsigned int limit = 0;
  3. int sizeb = 250;
  4. int pastValues [250];
  5. int analogPin = A0; // read from multiplexer using analog input 0
  6. int strobePin = 2// strobe is attached to digital pin 2
  7. int resetPin = 3// reset is attached to digital pin 3
  8. int ledPinBass = A9;
  9. int ledPinMed = A7;
  10. int ledPinHigh = A6;
  11. int spectrumValue[7]; // to hold a2d values\
  12.  
  13.  
  14. int point = 0;
  15.  
  16.  
  17. void setup()
  18. {
  19.  
  20. //  Serial.begin(115200);
  21.  
  22.   pinMode(analogPin, INPUT);
  23.   pinMode(strobePin, OUTPUT);
  24.   pinMode(resetPin, OUTPUT); 
  25.   pinMode(ledPinBass, OUTPUT);
  26.   pinMode(ledPinMed, OUTPUT);
  27.   pinMode(ledPinHigh, OUTPUT);
  28.   analogReference(DEFAULT);
  29.  
  30.  
  31.   digitalWrite(resetPin, LOW);
  32.   digitalWrite(strobePin, HIGH);
  33.  
  34.   for (int z = 0; z<sizeb ; z++){
  35.     pastValues [z] = 300;
  36.   }
  37.  
  38. }
  39.  
  40. void loop()
  41. {
  42.   digitalWrite(resetPin, HIGH);
  43.   digitalWrite(resetPin, LOW);
  44.  
  45.   for (int i = 0; i < 7; i++)
  46.   {
  47.     digitalWrite(strobePin, LOW);
  48.     delayMicroseconds(30); // to allow the output to settle
  49.     spectrumValue[i] = analogRead(analogPin);
  50.     if (i == 0 ){
  51.  
  52.     pastValues[point++] = spectrumValue[i];
  53.     //    Serial.print(spectrumValue[i]);
  54.     //    Serial.print ("L ");
  55.     if(point >sizeb)
  56.         point=0;
  57.     promedio();
  58.  
  59.     //analogWrite(ledPin, (spectrumValue[i]/4) );
  60.     if (spectrumValue[i] >(limit)){
  61.         //      digitalWrite(ledPin, HIGH);
  62.         //      delay(25);
  63.         for (int y = 255;y>=0;y--){
  64.         analogWrite(ledPinBass,y);
  65.         delayMicroseconds(500);
  66.         }
  67.     }
  68.     else
  69.         analogWrite(ledPinBass, 0);
  70.     }
  71.    
  72.     if (i == 4){
  73.     
  74.     if (spectrumValue[1] > limit){
  75.         analogWrite(ledPinBass,255);
  76.         delay(5);
  77.     }
  78.     else{
  79.         analogWrite(ledPinBass,0);
  80.     }
  81.     
  82.     //    Serial.print( spectrumValue[2]);Serial.print( " " );
  83.     //    Serial.print( spectrumValue[3]);Serial.print( " " );
  84.     //    Serial.print( spectrumValue[4]);Serial.print( " " );
  85.     if (spectrumValue[2] > limit*factor*1.05 || spectrumValue[3]> limit*factor*1.05 ||spectrumValue[4]> limit*factor*1.05){
  86.         analogWrite(ledPinMed,255);
  87.         delay(5);
  88.     }
  89.     else{
  90.         analogWrite(ledPinMed,0);
  91.     }
  92.  
  93.  
  94.     }
  95.  
  96. if (i == 6){
  97. //          Serial.print( spectrumValue[5]);Serial.print( " " );
  98. //          Serial.print( spectrumValue[6]);Serial.println( " " );
  99.  
  100.     if (spectrumValue[5] > limit*factor|| spectrumValue[6]> limit*factor ){
  101.         analogWrite(ledPinHigh,255);
  102.         delay(5);
  103.     }
  104.     else{
  105.         analogWrite(ledPinHigh,0);
  106.     }
  107.  
  108.  
  109.     }
  110.     /*
  111.     // comment out/remove the serial stuff to go faster
  112.    // - its just here for show
  113.    if (spectrumValue[i] < 10)
  114.    {
  115.    Serial.print(" ");
  116.    Serial.print(spectrumValue[i]);
  117.    }
  118.    else if (spectrumValue[i] < 100 )
  119.    {
  120.    Serial.print(" ");
  121.    Serial.print(spectrumValue[i]);
  122.    }
  123.    else
  124.    {
  125.    Serial.print(" ");
  126.    Serial.print(spectrumValue[i]);
  127.    }
  128.    */
  129.  
  130.     digitalWrite(strobePin, HIGH);
  131.   }
  132.  
  133. }
  134.  
  135. void promedio (){
  136.   unsigned long suma = 0;
  137.   for (int z = 0; z <=sizeb;z++){
  138.     suma+=pastValues[z]; 
  139.   }
  140.   limit = suma/sizeb;
  141.   limit= limit*2.2;
  142.   //  Serial.println(limit);
  143. }
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. unsigned int limit = 0;
  152. int pastValues [1000];
  153. int analogPin = A0; // read from multiplexer using analog input 0
  154. int strobePin = 2// strobe is attached to digital pin 2
  155. int resetPin = 3// reset is attached to digital pin 3
  156. int ledPin = A9;
  157. int spectrumValue[7]; // to hold a2d values\
  158.  
  159. int point = 0;
  160.  
  161.  
  162. void setup()
  163. {
  164.  
  165.   Serial.begin(115200);
  166.  
  167.   pinMode(analogPin, INPUT);
  168.   pinMode(strobePin, OUTPUT);
  169.   pinMode(resetPin, OUTPUT); 
  170.   pinMode(ledPin, OUTPUT);
  171.   analogReference(DEFAULT);
  172.  
  173.  
  174.   digitalWrite(resetPin, LOW);
  175.   digitalWrite(strobePin, HIGH);
  176.  
  177.   for (int z = 0; z<1000 ; z++){
  178.     pastValues [z] = 300;
  179.   }
  180.  
  181. }
  182.  
  183. void loop()
  184. {
  185.   digitalWrite(resetPin, HIGH);
  186.   digitalWrite(resetPin, LOW);
  187.  
  188.   for (int i = 0; i < 7; i++)
  189.   {
  190.     digitalWrite(strobePin, LOW);
  191.     delayMicroseconds(30); // to allow the output to settle
  192.     spectrumValue[i] = analogRead(analogPin);
  193.     if (i == 0 ){
  194.  
  195.     pastValues[point++] = spectrumValue[i];
  196. //      Serial.print(spectrumValue[i]);
  197. //      Serial.print ("L ");
  198.     if(point >1000)
  199.         point=0;
  200.     promedio();
  201.  
  202.     //analogWrite(ledPin, (spectrumValue[i]/4) );
  203.     if (spectrumValue[i] >(limit)){
  204.         //      digitalWrite(ledPin, HIGH);
  205.         //      delay(25);
  206.         for (int y = 255;y>=0;y--){
  207.         analogWrite(ledPin,y);
  208.         delayMicroseconds(450);
  209.         }
  210.     }
  211.     else
  212.         analogWrite(ledPin, 0);
  213.     }
  214.  
  215.  
  216.     /*
  217.     // comment out/remove the serial stuff to go faster
  218.    // - its just here for show
  219.    if (spectrumValue[i] < 10)
  220.    {
  221.    Serial.print(" ");
  222.    Serial.print(spectrumValue[i]);
  223.    }
  224.    else if (spectrumValue[i] < 100 )
  225.    {
  226.    Serial.print(" ");
  227.    Serial.print(spectrumValue[i]);
  228.    }
  229.    else
  230.    {
  231.    Serial.print(" ");
  232.    Serial.print(spectrumValue[i]);
  233.    }
  234.    */
  235.  
  236.     digitalWrite(strobePin, HIGH);
  237.   }
  238.  
  239. }
  240.  
  241. void promedio (){
  242.   unsigned long suma = 0;
  243.   for (int z = 0; z <=1000;z++){
  244.     suma+=pastValues[z]; 
  245.   }
  246.   limit = suma/1000.0;
  247.   limit= limit*2.5;
  248.   Serial.println(limit);
  249. }
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258. unsigned int limit = 0;
  259. int pastValues [1000];
  260. int analogPin = A0; // read from multiplexer using analog input 0
  261. int strobePin = 2// strobe is attached to digital pin 2
  262. int resetPin = 3// reset is attached to digital pin 3
  263. int ledPin = A9;
  264. int spectrumValue[7]; // to hold a2d values\
  265.  
  266. int point = 0;
  267.  
  268.  
  269. void setup()
  270. {
  271.  
  272. //  Serial.begin(28800);
  273.  
  274.   pinMode(analogPin, INPUT);
  275.   pinMode(strobePin, OUTPUT);
  276.   pinMode(resetPin, OUTPUT); 
  277.   pinMode(ledPin, OUTPUT);
  278.   analogReference(DEFAULT);
  279.  
  280.  
  281.   digitalWrite(resetPin, LOW);
  282.   digitalWrite(strobePin, HIGH);
  283.  
  284.   for (int z = 0; z<1000 ; z++){
  285.     pastValues [z] = 80;
  286.   }
  287.  
  288. }
  289.  
  290. void loop()
  291. {
  292.   digitalWrite(resetPin, HIGH);
  293.   digitalWrite(resetPin, LOW);
  294.  
  295.   for (int i = 0; i < 7; i++)
  296.   {
  297.     digitalWrite(strobePin, LOW);
  298.     delayMicroseconds(30); // to allow the output to settle
  299.     spectrumValue[i] = analogRead(analogPin);
  300.     if (i == 0 ){
  301.  
  302.     pastValues[point++] = spectrumValue[i];
  303. //      Serial.print(spectrumValue[i]);
  304. //      Serial.print ("L ");
  305.     if(point >1000)
  306.         point=0;
  307.     promedio();
  308.  
  309.     //analogWrite(ledPin, (spectrumValue[i]/4) );
  310.     if (spectrumValue[i] >(limit)){
  311.         //      digitalWrite(ledPin, HIGH);
  312.         //      delay(25);
  313.         for (int y = 255;y>=0;y--){
  314.         analogWrite(ledPin,y);
  315.         delayMicroseconds(450);
  316.         }
  317.     }
  318.     else
  319.         analogWrite(ledPin, 0);
  320.     }
  321.  
  322.  
  323.     /*
  324.     // comment out/remove the serial stuff to go faster
  325.    // - its just here for show
  326.    if (spectrumValue[i] < 10)
  327.    {
  328.    Serial.print(" ");
  329.    Serial.print(spectrumValue[i]);
  330.    }
  331.    else if (spectrumValue[i] < 100 )
  332.    {
  333.    Serial.print(" ");
  334.    Serial.print(spectrumValue[i]);
  335.    }
  336.    else
  337.    {
  338.    Serial.print(" ");
  339.    Serial.print(spectrumValue[i]);
  340.    }
  341.    */
  342.  
  343.     digitalWrite(strobePin, HIGH);
  344.   }
  345.  
  346. }
  347.  
  348. void promedio (){
  349.   unsigned long suma = 0;
  350.   for (int z = 0; z <=1000;z++){
  351.     suma+=pastValues[z]; 
  352.   }
  353.   limit = suma/1000.0;
  354.   limit= limit*1.75;
  355.  // Serial.println(limit);
  356. }
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365. #include "RunningAverage.h"
  366.  
  367. RunningAverage bajos(1000);
  368. int analogPin = A0; // read from multiplexer using analog input 0
  369. int strobePin = 2// strobe is attached to digital pin 2
  370. int resetPin = 3// reset is attached to digital pin 3
  371. int ledPin = A9;
  372. int spectrumValue[7]; // to hold a2d values\
  373.  
  374.  
  375. void setup()
  376. {
  377.  
  378.   Serial.begin(9600);
  379.   bajos.clr();
  380.   pinMode(analogPin, INPUT);
  381.   pinMode(strobePin, OUTPUT);
  382.   pinMode(resetPin, OUTPUT); 
  383.   pinMode(ledPin, OUTPUT);
  384.   analogReference(DEFAULT);
  385.  
  386.  
  387.   digitalWrite(resetPin, LOW);
  388.   digitalWrite(strobePin, HIGH);
  389.  
  390. }
  391.  
  392. void loop()
  393. {
  394.   digitalWrite(resetPin, HIGH);
  395.   digitalWrite(resetPin, LOW);
  396.  
  397.   for (int i = 0; i < 7; i++)
  398.   {
  399.     digitalWrite(strobePin, LOW);
  400.     delayMicroseconds(30); // to allow the output to settle
  401.     spectrumValue[i] = analogRead(analogPin);
  402.     if (i == 0 ){
  403.     
  404.     bajos.add(spectrumValue[i] );
  405.     Serial.println(bajos.avg());
  406.     //analogWrite(ledPin, (spectrumValue[i]/4) );
  407.     if (spectrumValue[i] >(bajos.avg()*2)){
  408.         //      digitalWrite(ledPin, HIGH);
  409.         //      delay(25);
  410.         for (int y = 255;y>=0;y--){
  411.         analogWrite(ledPin,y);
  412.         delayMicroseconds(450);
  413.         }
  414.     }
  415.     else
  416.         analogWrite(ledPin, 0);
  417.     }
  418.    
  419.    
  420.     /*
  421.     // comment out/remove the serial stuff to go faster
  422.     // - its just here for show
  423.     if (spectrumValue[i] < 10)
  424.     {
  425.     Serial.print(" ");
  426.     Serial.print(spectrumValue[i]);
  427.     }
  428.     else if (spectrumValue[i] < 100 )
  429.     {
  430.     Serial.print(" ");
  431.     Serial.print(spectrumValue[i]);
  432.     }
  433.     else
  434.     {
  435.     Serial.print(" ");
  436.     Serial.print(spectrumValue[i]);
  437.     }
  438.     */
  439.  
  440.     digitalWrite(strobePin, HIGH);
  441.   }
  442.   Serial.println();
  443. }
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. int analogPin = A0; // read from multiplexer using analog input 0
  451. int strobePin = 2// strobe is attached to digital pin 2
  452. int resetPin = 3// reset is attached to digital pin 3
  453. int ledPin = A9;
  454. int spectrumValue[7]; // to hold a2d values\
  455.  
  456.  
  457. void setup()
  458. {
  459.   Serial.begin(9600);
  460.   pinMode(analogPin, INPUT);
  461.   pinMode(strobePin, OUTPUT);
  462.   pinMode(resetPin, OUTPUT); 
  463.   pinMode(ledPin, OUTPUT);
  464.   analogReference(DEFAULT);
  465.  
  466.  
  467.   digitalWrite(resetPin, LOW);
  468.   digitalWrite(strobePin, HIGH);
  469.  
  470.   Serial.println("MSGEQ7 test by J Skoba");
  471. }
  472.  
  473. void loop()
  474. {
  475.   digitalWrite(resetPin, HIGH);
  476.   digitalWrite(resetPin, LOW);
  477.  
  478.   for (int i = 0; i < 7; i++)
  479.   {
  480.     digitalWrite(strobePin, LOW);
  481.     delayMicroseconds(30); // to allow the output to settle
  482.     spectrumValue[i] = analogRead(analogPin);
  483.     if (i == 0 ){
  484.     //analogWrite(ledPin, (spectrumValue[i]/4) );
  485.     if (spectrumValue[i] >124){
  486.         //      digitalWrite(ledPin, HIGH);
  487.         //      delay(25);
  488.         for (int y = 255;y>=0;y--){
  489.         analogWrite(ledPin,y);
  490.         delayMicroseconds(500);
  491.         }
  492.     }
  493.     else
  494.         analogWrite(ledPin, 0);
  495.     }
  496.    
  497.     // comment out/remove the serial stuff to go faster
  498.     // - its just here for show
  499.     if (spectrumValue[i] < 10)
  500.     {
  501.     Serial.print(" ");
  502.     Serial.print(spectrumValue[i]);
  503.     }
  504.     else if (spectrumValue[i] < 100 )
  505.     {
  506.     Serial.print(" ");
  507.     Serial.print(spectrumValue[i]);
  508.     }
  509.     else
  510.     {
  511.     Serial.print(" ");
  512.     Serial.print(spectrumValue[i]);
  513.     }
  514.     
  515.  
  516.     digitalWrite(strobePin, HIGH);
  517.   }
  518.   Serial.println();
  519. }

Filter code based on J Skova code http://nuewire.com/info-archive/msgeq7-by-j-skoba/

 

Making the project

 


 

 

Circuit of the project

 

Video


 

 

Future work

  •      Elaborate a PCB
  •      Get rid of noise
  •      Improve code
  •      "Touch" lamp function
  •      Microphone to turn color leds on with ambient noise or music
  •      Test power usage

 

Conclusion

      This was an interesting project because it involved design and electronics. The most frustrating part was receiving the parts, because they delayed a little bit my work. Aside from that, I really liked the outcome of my project and when I showed it to my family and friends, they also liked it.

 

Thanks for all the help to the EE47 team!

 

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.