Spectrum Analyzer with Adafruit LED backpack

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
justinm3
 
Posts: 1
Joined: Fri Mar 14, 2014 3:38 pm

Spectrum Analyzer with Adafruit LED backpack

Post by justinm3 »

Hello,

A couple of friends and I are working on a project where we're using an Arduino Due to power an Adafruit 8x8 red LED backpack to implement a spectrum analyzer. We're using a microphone as our input and had to build some bandpass filters to split the signal and we're taking the output of each of those bandpass filters and inputting them into 8 different analog pins on the Arduino. The hardware all works; we're almost done. The thing that we're having trouble with is how to display all eight columns on the LED Matrix because the bitmap that is used in the example code for the LED backpack cannot be altered as it is a read only bitmap.

Is there a way to alter the bitmap? I would like to declare it as a double array, but I would also like the code to be able to alter it so that as I read the amplitude of each of the 8 frequencies, I can update the LED Matrix in real time.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Spectrum Analyzer with Adafruit LED backpack

Post by tdicola »

It might be easier if you set the pixels on the display explicitly instead of updating a bitmap and drawing it. Internally the matrix driver code actually keeps a buffer/bitmap of the pixels in memory and you can call the drawPixel function to turn a specific pixel on or off. The matrix8x8 example in the library has a small demo of lighting just one pixel at position 0, 0:

Code: Select all

matrix.clear();      // clear display
matrix.drawPixel(0, 0, LED_ON);  
matrix.writeDisplay();  // write the changes we just made to the display
delay(500);
The drawPixel function takes in as parameters the x and y position, which are numbers between 0 and 7 and represent the appropriate row or column of pixels, and the 'color', either LED_ON or LED_OFF. So for your spectrum analyzer you probably want to take the 8 band intensities and map them to a value 0 to 7, then plot each with a drawPixel call. Once you've drawn all the pixels make sure to call writeDisplay to update the actual LEDs. Does that help clarify the usage?

Sounds like a cool project by the way, good luck!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”