Library used to interface to the 7-band Graphic Equalizer Chip MSGEQ7, made by company Mixed Signal Integration

Dependents:   MSGEQ7_Hello_World LCD_Spectrum_Analyzer 4180_Lab4 MSGEQ7_Hello_World ... more

Notebook page detailing chip interfacing and library usage

The MSGEQ7 Library API

The MSGEQ7 library is very simple to use. In the class called 'MSGEQ7' there are 3 public functions and 2 arrays.

Descriptions of functions: MSGEQ7(PinName reset, PinName strobe, PinName analog) - Creates a MSGEQ7, taking 3 pin arguments specifying which Mbed pins are connected to the chip's reset, strobe, and analog out lines.

void readByte() - Interfaces with the MSGEQ7 chip and reads out all 7 frequency data values and stores the values in the byte array (in the form of an array of unsigned chars) called freqDataByte, of length 7. Each value stored ranges from 0 to 255, with 255 representing the maximum sound magnitude the MSGEQ7 chip can detect at that frequency.

void readInt(int max) - Interfaces with the MSGEQ7 chip and reads out all 7 frequency data values and stores the values in the integer array called freqDataInt, of length 7. Each reading will be scaled so that the stored data ranges from 0 to value 'max' specified by the user. This 'max' variable allows the user to scale the output of the chip to a useful range.

The user chooses between readByte() and readInt(int max) based on what form they want the data returned to them in. The user needs only to call one of those functions, not both.

Once the function readByte() or readInt(int max) has been executed, the frequency data from the MSGEQ7 chip is stored in a certain array, depending on which function was called.

readByte() stores data in freqDataByte[7], and readInt(int max) stores data in freqDataInt[7]. Both arrays are available as public data arrays in the MSGEQ7 class. For both arrays, the data at index = 0 is the value at frequency = 63Hz, and the data at the last position, index = 6 is the value at frequency = 16kHz.

See example program MSGEQ7_Hello_World for an example of basic API usage.


Example Programs

Import programMSGEQ7_Hello_World

Demonstration of MSGEQ7 library interfacing with MSGEQ7 7-band Graphic Equalizer Chip made by Mixed Signal Integration.

Import programLCD_Spectrum_Analyzer

This program gets 7-band frequency data from the MSGEQ7 library and displays a 7-band, 2-row bar graph on an LCD display using custom characters.

MSGEQ7.h

Committer:
chrisisthefish
Date:
2013-10-16
Revision:
0:974a4855a7f8

File content as of revision 0:974a4855a7f8:

/*
MSGEQ7 Library for interfacing to the MSGEQ7 Seven Band Grapic Equalizer chip made by Mixed Signal Integration

Chris Wilson
twilson8@gatech.edu
10/16/2013
*/

#ifndef MBED_MSGEQ7_H
#define MBED_MSGEQ7_H
 
#include "mbed.h"
 
class MSGEQ7 {
public:
    MSGEQ7(PinName reset, PinName strobe, PinName analog);
    void readByte();
    void readInt(int max);
    unsigned char freqDataByte[7]; //Byte array to store frequency data
    int freqDataInt[7]; //Int array for storing frequency data
  
private:  
    DigitalOut _reset; //Reset line
    DigitalOut _strobe; //Strobe line
    AnalogIn _analog; //Analog input from chip
    
    float read();
};
 
#endif