Home > News & Updates > Electronics News Updates > Arduino 3D Spectrum Analyser

Arduino 3D Spectrum Analyser

Summary of Arduino 3D Spectrum Analyser


This article details the software development for a 3D Spectrum Analyser (3DSA) designed by the author's friend. The project visualizes audio signals on a 3D LED matrix using an 80MHz PIC32 microprocessor. Instead of the standard Discrete Fourier Transform, the team utilized the Constant Q Transform (CQT) to better match human logarithmic hearing perception. The algorithm samples audio input, calculates amplitudes across 16 frequency bands, and drives a 16x16x5 LED grid accordingly.

Parts used in the 3D Spectrum Analyser:

  • Audio signal input
  • 80MHz Olimex PIC32 microprocessor
  • PIC32-PINGUINO-OTG development board
  • Custom-built PCB
  • 16x16x5 LED matrix
  • C programming environment

More than a year ago, a friend of mine asked me to write the software for his 3D Spectrum Analyser (3DSA): a device that takes as input an audio signal, and outputs its visualisation on a 3D matrix of leds. If the above description doesn’t quite ring a bell, simply watch the end result in action:

3D Spectrum Analyser
For the hardware fans amongst you, my friend documented the construction process meticulously:

It’s definitely worth watching, e.g. the guy literally built his own fracking PCB from scratch!

I, however, am more a software kinda guy :) In this log, I’ll describe the basic building blocks we needed to get a sound spectrum analyzing algorithm going.

Intro

First things first though, the microprocessor to be programmed was an 80MHz Olimex PIC32, soldered to the PIC32-PINGUINO-OTG development board. (For those who ever tinkered with Arduino boards: it’s the same, only with a faster chip and fewer builtin libraries :| ) The Algorithm had to sample the input signal at regular time intervals, convert this signal to the frequency domain, and visualize the detected frequencies on a 16x16x5 LED matrix.

Mathematics

Of course, before writing any code, we had to figure out how to convert input samples to a frequency distribution. This thing is done all the time in signal processing by applying the Discrete Fourier Transform (DFT) to the input signal. Given a signal sampled at a constant frequency, a DFT outputs a set of amplitudes of frequency bands residing in the signal. For example, when your signal mainly consists of the middle C (or Do) tone, a DFT will assign a relatively high amplitude to the frequency band encompassing the corresponding 262 Hz frequency.

However, the human ear perceives sound logarithmically, meaning that a doubling of the frequency of a sound signal is perceived only as a linearly higher tone. In order to compensate for this, we used the Constant Q transform (CQT) instead of the DFT. In short, where a DFT returns amplitudes for frequency bands f-2f-3f-4f-etc., a CQT works with frequency bands f-2f-4f-8f-etc.

So from a theoretical perspective, the algorithm needed for the 3DSA was quite simple: sample the input signal at regular time intervals, apply a CQT calculating amplitudes for 16 frequency bands, and make each of the 16 led columns blink appropriately. Given that the Pinguino development board supported C, we assumed implementing this algorithm wouldn’t be that hard. However, some challenges always pop up

 

For more detail:  Arduino 3D Spectrum Analyser

 

Quick Solutions to Questions related to 3D Spectrum Analyser:

  • What is the primary function of the 3DSA device?
    The device takes an audio signal as input and outputs its visualization on a 3D matrix of LEDs.
  • Which microprocessor was used in this project?
    An 80MHz Olimex PIC32 soldered to the PIC32-PINGUINO-OTG development board was used.
  • Why was the Constant Q transform chosen over the DFT?
    The CQT was selected because the human ear perceives sound logarithmically, which the CQT compensates for better than the DFT.
  • How many frequency bands does the algorithm calculate?
    The algorithm calculates amplitudes for 16 frequency bands.
  • What are the dimensions of the LED matrix used?
    The visualization appears on a 16x16x5 LED matrix.
  • Does the Pinguino development board support C language?
    Yes, the Pinguino development board supported C, allowing the algorithm to be implemented easily.
  • How does the algorithm process the input signal?
    The algorithm samples the input signal at regular time intervals and converts it to the frequency domain.
  • What happens if the signal mainly consists of the middle C tone?
    A transform would assign a relatively high amplitude to the frequency band encompassing the corresponding 262 Hz frequency.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top