This audio spectrum analyzer is a project for the TI Launchpad (Value Line) w/ CircuitCo's Educational BoosterPack. It is microphone based and require minimal external components. Efforts were made to maximize the use of device / features from the Educational BoosterPack.
ADC10, TimerA interrupt LPM wakeup, TimerA PWM like output, button use, integer arithmetic are used and demonstrated.
TI LaunchPad + Educational BoosterPack
Below shows IO pins used
Physical hookup (jumpers) is required for the pre-amp circuit only
The LCD and buzzer are connected via the Educational BoosterPack
| | |
| P1.5|--> IO (Booster lcd clock)
| P1.7|--> IO (Booster lcd data)
| P2.3|--> IO (Booster lcd data/command select)
| P1.4|<-- ADC4 (from microphone pre-amp)
| P1.3|<-- Launchpad Button
| P1.6|--> TA0.1 (Launchpad green LED, test signal)
| P2.6|--> TA0.1 (Booster Buzzer, audio test signal)
The op-amp microphone amplifier can be constructed on breadboard or pref board
LM358 Dual Op-Amp, GBW @0.7Mhz, each stage @x100 gain, bandwidth is 7Khz
___ 10uF |
+ | --------------- |
o-1|----. Vcc|8 |
|. | ^ .---|7--o-------|-----o (A)
100k| | | / \ ^ | |. |.
|_| | /__+\ / \ | | |100k | |1k
0.1u | | | | /__+\ | |_| |_|
(B) o--||--[ 1k ]--o-2|---+ | | | | | |
(C) o-------------o---3|-----+ +-|--|6--o-------o
| 4|Gnd +--|5----o
| --------------- |
Points A, B and C + power need to be connected to the Launchpad and Booster
(A) to P1.4 EduBoost Mic jumper middle pin
(B) to Condenser Mic, EduBoost Mic Jumper top pin
(C) to Potentiometer, EduBooster Potentiometer Jumper top pin
(+) connect Gnd + Vcc to Launchpad
CircuitCo Educational BoosterPack
I had used both mspgcc and ccs compiler to build the firmware but had only tested the gcc version. The compile / link command is as such, it is important to note that we need to do a "-lm" to link to the math library
msp430-gcc -Os -Wall -ffunction-sections -fdata-sections -fno-inline-small-functions -Wl,-Map=gcc/lp_8bitfft.map,--cref -Wl,--relax -Wl,--gc-sections -mmcu=msp430g2553 -c fix_fft.c -o gcc/fix_fft.o
msp430-gcc -Os -Wall -ffunction-sections -fdata-sections -fno-inline-small-functions -Wl,-Map=gcc/lp_8bitfft.map,--cref -Wl,--relax -Wl,--gc-sections -mmcu=msp430g2553 -c lp_8bitfft.c -o gcc/lp_8bitfft.o
msp430-gcc -Os -Wall -ffunction-sections -fdata-sections -fno-inline-small-functions -Wl,-Map=gcc/lp_8bitfft.map,--cref -Wl,--relax -Wl,--gc-sections -mmcu=msp430g2553 -o gcc/lp_8bitfft.elf gcc/fix_fft.o gcc/lp_8bitfft.o -lm
To simplify testing / trouble-shooting, this project includes a square wave signal generator. Pressing the launchpad tactile button at P1.3 will cycle through 3 modes of operation state. Mode 0 is off, Mode 1 is P1.6 output, Mode 2 is P2.6 output (to buzzer).
If you are to test the Spectrum Display before finishing the op-amp circuit, you can select Mode 1 and jumper short P1.6 (feed it from the launchpad green LED header) to P1.4 (point A from the schematic). The firmware will generate a linear set of frequencies to be observed / processed by the FFT logic. Mode 2 is the same as Mode 1 except the output pin is a pin to the buzzer driver, which produce audible sound instead of a pin-out signal. In both Mode 1 and Mode 2, the frequency band and the amplitude are switched to show 'linear'.
For Mode 2 frequency out, you need to have the op-amp circuit finished and attached for testing. What you will observe will be far from ideal, as I found out the buzzer only behave well at 2Khz, most other bands are very distorted and higher frequency does not response well.
For the op-amp circuit, it is a very simple and standard inverting amplifier setup on both stages. You can just follow the ascii-art schematic and / or the photo to have it built. There are 3 points in the op-map circuit that need to be connected, point B is connecting to the condenser mic as the op-amp input, point A is the amplified output that needs to go back to P1.4 / ADC channel 4 input of the MCU. Point C is connecting to the Educational BoosterPack's on board potentiometer, we use it to bias our op-amp input.
The gains of both stages had been set to about 100 and they can be altered by changing the 100k and 1k resistors as it is approximately 100k/1k. You can also replace the LM358 op-amp with others, just make sure the gain bandwidth of your op-amp can work nicely at the maximum frequency that you want to capture (along w/ the gain you want).