Pages: [1]   Go Down
Author Topic: Bliptronics spectrum analyzer shield with WS2801 FastSPI_LED  (Read 931 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

I recently bought a spectrum analyzer shield from Bliptronics, a couple of WS2801 RGB led strands. All the sample code from Bliptronics seems to be broken and none of the libs seems to work with the latest IDE.
Has anyone got it to work with the FastSPI_led libs? The test code for FastSPI_led works fine. Unfortunately there is no support from Bliptronics.

I´m trying to build a 5x5 pixel spectrum analyzer. I just started coding with the arduino but I cant figure this one out. Any help is appreciated.

Thanks, 
Logged

US
Offline Offline
Newbie
*
Karma: 2
Posts: 35
Hi! I wrote and maintain the FastSPI_LED library. Working on trying to keep it up to date.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup - in fact I used it to create the sound reactive functionality in Liquid Eye (see ).

Here is a rough version of the class that I use to interact with the MSGEQ7's - note this is based on Sparkfun's version of the board (https://www.sparkfun.com/products/10306) - but the bliptronics version should be similar, I suspect you'll need to change the pin definitions in CEQ().  Hope this is helpful!  (A future expansion to FastSPI_LED2 will include a variety of utility classes like this that i've made use of.


class CEQ {
  // Reset pin
  int m_nReset;
  // Left data pin
  int m_nLeft;
  // Right data pin
  int m_nRight;
  // Strobe pin
  int m_nStrobe;

  // Most recently read level values for left and right channels
  int m_nLeftVals[7];
  int m_nRightVals[7];

  // Lowest values received per channel yet, attempt to establish a noise floor
  int m_nMin[7];

  // Strobe the MSGEQ lines
  void strobe() {
    digitalWrite(m_nStrobe, HIGH);
    digitalWrite(m_nStrobe, LOW);
  }
 
  // Trigger a reset in the MSGEQ chip.  Also reset low/hi values
  void reset() {
    for(int i = 0; i < 7; i++) {
      // m_nMax = 0;
      m_nMin = 1023;
      m_nLeftVals = 0;
      m_nRightVals = 0;
    }
    digitalWrite(m_nReset, HIGH);
    strobe();
    digitalWrite(m_nReset, LOW);
  }
 
  void init() {
    pinMode(m_nStrobe, OUTPUT);
    pinMode(m_nReset, OUTPUT);
    digitalWrite(m_nStrobe, LOW);
    reset();
  }
 
 
  int readChannel(int pin) { return (analogRead(pin) + analogRead(pin)) >> 1; }
 
public:
  CEQ() {
    m_nStrobe = 4;
    m_nReset = 5;
    m_nLeft = 0;
    m_nRight = 1;
   
    init();
  }
 
  // Call this method to re-read data from the MSGEQ7 chip
  void refreshLevels() {
    for(byte band = 0; band < 7; band++) {
      m_nLeftVals[band] = readChannel(m_nLeft);
      m_nRightVals[band] = readChannel(m_nRight);
     
      if(m_nMin[band] > m_nLeftVals[band]) {
        m_nMin[band] = m_nLeftVals[band];
      }
      if(m_nMin[band] > m_nRightVals[band]) {
        m_nMin[band] = m_nRightVals[band];
      }
         
      strobe();
    }
  }
 
  // Get the left channel level for band n normalized to be between 0 and maxv
  int getLeftLevel(int n, int maxv) { return map(m_nLeftVals[n], m_nMin[n], 1023, 0, maxv); }
  // Get the right channel level for band n normalized to be between 0 and maxv
  int getRightLevel(int n, int maxv) { return map(m_nRightVals[n], m_nMin[n], 1023, 0, maxv); }
  // Get the highest level for band n on left vs right channels, normalized to be between 0 and maxv
  int getLevel(int n, int maxv) { return max(getLeftLevel(n, maxv), getRightLevel(n, maxv)); }
};

Logged

--

FastLED (formerly FastSPI_LED) -- new home http://fastled.io

Europe / Germany
Offline Offline
Sr. Member
****
Karma: 11
Posts: 342
keep it simple
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Daniel,

ist the liqid eye code without sound reactive functionality available somewhere?

Thanx

What? Karma 0? No way! +1 for making the world colorful.  smiley-wink
« Last Edit: March 05, 2013, 04:43:16 am by Helmuth » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks dgarcia42, I´ll give it a try as soon as my programming skills catch up smiley
Logged

Pages: [1]   Go Up
Jump to: