Skip to content

Spectrum analyser displayed on a LED matrix board connected to a STM32 device

License

Notifications You must be signed in to change notification settings

jc-SpaceXp/Spekky-Matrix

Repository files navigation

Spekky Matrix

A FreeRTOS based project were a spectrum analyser is displayed on a LED matrix board run from a STM32 device

Detailed Description

A MAX7219 based 8x8 led matrix displays the fast fourier transform (FFT) of an incoming audio signal picked up by a microphone. The incoming audio is a double buffered DMA signal. The led matrix is driven via the STM32’s SPI interface. All while internal hardware timers and FreeRTOS are responsible for accurate timing e.g. refresh rate of led matrix and data acquisition.

Tools

The following tools are needed to build this project

Progress / Milestones

  • [X] Create LED matrix driver for MAX7219 devices
  • [X] Drive LED matrix from STM32 using FreeRTOS
  • [X] Run FFT off target
  • [X] Verify FFT on target (using off target results as a guide)
  • [X] Verify that LED matrix can be driven alongside FFT code (manually verified, no delays etc.)
  • [X] Capture data from mic
  • [X] Verify output of mic from raw logic analyser data (using SigPlotI2S)
  • [X] Capture data from mic via DMA
  • [X] Perform FFT on this raw logic analyser data with a sine wave test tone (off-target)
  • [X] Animate FFT graphs to get a rough estimate of how the LED matrix will display it (off-target)
  • [X] Perform FFT on mic data sampled by STM32 with a sine wave test tone (off-target)
  • [X] Verify that LED matrix can be driven along with data capture and processing
  • [X] Perform FFT on captured mic data to drive LED matrix

I2S Mic FFT Data Visualised

Logic Analyser Data (Sine 1kHz Test Tone)

FFT size = 64, start offset = 0, next offset = 32, FPS = 4

media/python_fft_logic_analyser_sine_1k.gif

Spekky Matrix Calculations

FFT size = 64, bin resolution = (1/60E-6)/64 –> ~260Hz

Note: I measured one Ws period as 60us on PulseView hence the 1/60E-6 above

8x32 LED Matrix (Sine 2kHz Test Tone)

Peak expected at the 7th/8th bin (2000 / 260 = ~7.69)

media/blackman_harris_sine_2k.gif

8x32 LED Matrix (Sine 4kHz Test Tone)

Peak expected at the 15th/16th bin (4000 / 260 = ~15.36)

media/blackman_harris_sine_4k.gif

8x32 LED Matrix (Sine Sweep Test)

Since the I2S Ws period is 60us, this gives us a sampling frequency of 16.66 kHz. Giving us a visual representation of 0-8.88 kHz with Spekky Matrix

Sine sweep source (youtube link)

Note: Gif is played at 2.5x speed, see mp4 for realtime playback and audio of sweep test

media/blackman_harris_sine_sweep.gif

Schematic

schematic_v03.pdf

Execution Timeline

Rough timing of how long each task/sub-task takes to complete

Actual times are a mean of the traces from the timing branch execution_timeline.jpg

Submodules

CMSIS will also produce linker warnings due to newlib e.g. “_write is not implemented and will always fail”. There is quite a bit of a size overhead when pulling in all the CMSIS modules. An average project would be around ~100Mb. This increases with FreeRTOS too.

About

Spectrum analyser displayed on a LED matrix board connected to a STM32 device

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published