2

I bought around 2 years ago the Spectrum Analyzer Shield from Sparkfun, but I never had the time to do something with it. Recently I found the time to start a project to build a graphical equalizer. For that I use the Spectrum Analyzer Shield to split the left and right audio channel into 7 different bands. After I finished to build my first LED-Matrix panel and tested it out with the Spectrum Analyzer Shield I thought that everything works as it should. I made than the second LED-Matrix panel and tested everything again. Well, the result was odd. I noticed that the order of the bands inside of my arrays are switching around between every restart of my Arduino. Here are two example outputs. I played a 64 Hertz tone and expected to see an increase for the right and left channel for the first band.

Band0 R:70 ,L: 76 | Band1 R:92 ,L: 81 | Band2 R:548 ,L: 83 | Band3 R:108 ,L: 575 | Band4 R:76 ,L: 108 | Band5 R:64 ,L: 82 | Band6 R:63 ,L: 83 | 
Band0 R:67 ,L: 78 | Band1 R:87 ,L: 83 | Band2 R:552 ,L: 82 | Band3 R:108 ,L: 575 | Band4 R:80 ,L: 109 | Band5 R:68 ,L: 83 | Band6 R:63 ,L: 78 | 
Band0 R:77 ,L: 75 | Band1 R:88 ,L: 78 | Band2 R:546 ,L: 83 | Band3 R:105 ,L: 575 | Band4 R:79 ,L: 109 | Band5 R:61 ,L: 79 | Band6 R:59 ,L: 77 | 
Band0 R:73 ,L: 74 | Band1 R:92 ,L: 85 | Band2 R:546 ,L: 84 | Band3 R:113 ,L: 572 | Band4 R:78 ,L: 105 | Band5 R:58 ,L: 74 | Band6 R:65 ,L: 78 | 
Band0 R:71 ,L: 77 | Band1 R:92 ,L: 82 | Band2 R:550 ,L: 84 | Band3 R:107 ,L: 573 | Band4 R:76 ,L: 107 | Band5 R:59 ,L: 76 | Band6 R:59 ,L: 79 |

After restart of the arduino (pressed 5 sec the reset button)

Band0 R:71 ,L: 576 | Band1 R:86 ,L: 106 | Band2 R:545 ,L: 87 | Band3 R:107 ,L: 82 | Band4 R:76 ,L: 78 | Band5 R:55 ,L: 80 | Band6 R:61 ,L: 79 | 
Band0 R:71 ,L: 575 | Band1 R:83 ,L: 105 | Band2 R:549 ,L: 80 | Band3 R:109 ,L: 87 | Band4 R:75 ,L: 79 | Band5 R:55 ,L: 84 | Band6 R:64 ,L: 78 | 
Band0 R:69 ,L: 575 | Band1 R:88 ,L: 103 | Band2 R:546 ,L: 79 | Band3 R:109 ,L: 82 | Band4 R:73 ,L: 79 | Band5 R:63 ,L: 78 | Band6 R:62 ,L: 84 | 
Band0 R:70 ,L: 575 | Band1 R:87 ,L: 103 | Band2 R:547 ,L: 84 | Band3 R:106 ,L: 82 | Band4 R:76 ,L: 78 | Band5 R:61 ,L: 80 | Band6 R:61 ,L: 90 | 
Band0 R:71 ,L: 574 | Band1 R:83 ,L: 106 | Band2 R:550 ,L: 79 | Band3 R:109 ,L: 84 | Band4 R:77 ,L: 77 | Band5 R:57 ,L: 85 | Band6 R:60 ,L: 81 | 
Band0 R:64 ,L: 576 | Band1 R:92 ,L: 109 | Band2 R:549 ,L: 80 | Band3 R:105 ,L: 80 | Band4 R:75 ,L: 72 | Band5 R:56 ,L: 76 | Band6 R:60 ,L: 80 |

I experienced the same issue with the source code from Sparkfun: https://github.com/sparkfun/Spectrum_Shield/blob/HW_1.6_FW_1.1/Firmware/SparkFun_Spectrum_Demo/SparkFun_Spectrum_Demo.ino

I modified this code only slightly to log everything.

void Read_Frequencies(){
  //Read frequencies for each band
  for (freq_amp = 0; freq_amp<7; freq_amp++)
  {
    Frequencies_One[freq_amp] = analogRead(DC_One);
    Frequencies_Two[freq_amp] = analogRead(DC_Two); 
    digitalWrite(STROBE, HIGH);
    digitalWrite(STROBE, LOW);

    Serial.print("Band");
    Serial.print(freq_amp);
    Serial.print(" R:");
    Serial.print(Frequencies_One[freq_amp]);
    Serial.print(" ,L: ");
    Serial.print(Frequencies_Two[freq_amp]);
    Serial.print(" | ");
  }
  Serial.println("");
}

Hopefully I'm doing something fundamental wrong, if not that would mean I have to buy a new Shield :/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.