Big Spectrum Analyzer with Arduino

By on February 7, 2013
Pin It



Let’s put together a pixel strip with an HL1606, an Arduino UNO and the Spectrum Shield to build a seven bands “large” Spectrum Analyzer of simple construction.


The components


The Strip used uses the HL1606 controller to allow direct management of each of the LEDs. The chip runs two RGB groups and has 4-pin for input/output. The serial communication protocol allows input to output passage whenever the chip receives new data. Data move from one module to another thanks to a clock provided on the control line. Every strip can be composed of a variable number of modules up to a theoretical maximum determined only by the speed with which we want to change the LEDs status.
Each chip continues in the pass through without displaying received data, until the latch pin (L-s) status changes . Then it writes the value from it’s communication registry in registry piloting the six channels.


For the HL1606, data is a bitmap (a one byte word for each RGB LEDS) corresponding to each of the three LEDs, managed according to a truth table having two bits for each LED. The chip does not have autonomous blending management (PWM), but it uses a SI line to give the automatic blending frequency, which is available as a stand-alone function.
The second key component of this project is a MSGEQ7 chip. The chip is designed for seven-band equalizers, for displaying the peak level of each of the bands. With just eight pins it has a “clever” mechanism: this chip offers, on a single pin, a voltage level that is equal to the peak level of one of the seven frequencies managed.
The transition from one frequency to another is managed via a strobe pin, which increments a multiplexer including all seven Bandpass Filters with peak detectors.
Basically, on the same pin on can be read a sequence the seven peak levels for the seven bands centered on 63, 160, 400, 1,000, 2,500, 6,250 and 16,000 Hz.
If we add an Arduino UNO, we have everything we need to read the seven values on different frequency bands, and create a representation of the same on a series of bars, in fact our giant Spectrum analyzer.
Creating seven bands without cutting the led strip

This slideshow requires JavaScript.

The flexible nature of the strip we’ve chosen allows us to model it as we prefer: in our case, we get seven bands bars simply by folding the strip to form a coil. Between a bar and the other we’ll leave three LEDs (to avoid excessive stress on the Strip).
The height of the bar depends on the total length; firmware adjusts it, using only the LEDs needed. In our case we are using a standard 5 meters strip and 160 LED: we will therefore have six curves by three LEDs (18 LEDs are not used) to have seven 20 LED bars each. Two diodes remain unused at the end of the Strip, that is considered in counts.
With this arrangement, even bars work in a verse and odd ones in another: this is managed by the firmware.
The Spectrum Shield
The peculiar MSGEQ7 chip has attracted the attention of several companies. Bliptronics and Sparkfun, have therefore carried out a Spectrum Shield: a shield for Arduino, mounting two chips and two stereo jacks: one for receiving the input signal and another for the pass through output.
The two MSGEQ7 handle the stereo signal channels, read from the analog A0 and A1 pin by the Arduino. The Reset and the Strobe of MSGEQ7 are, respectively, connected to D5 and D4 of Arduino.
The shield has a button to reset the Arduino connected through lateral connectors, while a large Breadboard area allows you to add any accessory components.
You don’t need a library specific for this shield: acting on Reset and Strobe you have the sequence of levels on Arduino analog inputs in an endless loop. A cycle that feeds a seven values vector you can then pass the data to the graphic representation.
How to handle the Strip

To represent the light bars on the strip, we use a ready-made specific HL1606 library. This library can manage a strip of arbitrary length, giving you control over the single LED. For performance reasons, the simplest version does not handle the PWM for the blending, restricting the feature to seven representable colors.
In addition to this library, the code requires SPI features handled by the standard “wire” library that will also set in includes.


From an electrical point of view, the Strip needs a 5 V power supply with a current of approx. 2 A, which must be taken from an external power supply. Arduino 5 V are not enough.
Of the other four signals coming from the strip, just DI, LI and CI , and interesting for us. You’ll find explanations regarding the use of the S signal in the box on the previous pages.  The connections to the Arduino i/o for these three pin are the following: D = D11; L = D12; C = D13.
The Spectrum Shield connects to the following lines of Arduino: Reset = D5; Strobe = D4; Left = A0; Right = A1.
The program

Our sketch consists of the classic parts: includes for libraries, initialization, setup and loop.
The initialization part loads the HL1606 library and the wire standard library. Then defines the connection pins for the strip and the Spectrum Shield.
The software manages the spacing between the bars and their length parametrically (3 and 20 for us). Always parametric is bars color, divided into three parts, with color and length are managed by many parameters. As happens in commercial spectrum analyzers, even our can have the sliding dot indication or variable length bar.
In setup we initialize the serial port, the two control pins of the Spectrum shield are defined as outputs and the Strobe/Reset sequence is performed to bring the chip at the beginning of the reading sequence. The main loop consists of a series of functions where first the spectrum is shown, then the next seven values are read, the reads are compared to the available led number and LEDS status is put in memory. Finally everything is turn off before the next loop start.

About Boris Landoni

Boris Landoni is the technical manager of Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.


  1. Scott Powell

    December 30, 2014 at 9:42 PM

    This is awesome! Thank you for taking the time to put together the build-page.

  2. jmmferraz

    February 1, 2015 at 5:09 PM

    Is it possible to this project but with individual leds?

    • BorisLandoni

      February 19, 2015 at 5:54 PM

      If they use the same chip, yes

  3. Pingback: Светомузыка | Pearltrees

  4. Pingback: Светомузыка | Pearltrees

  5. Balazs Bonyhay

    December 18, 2015 at 8:14 PM

    Is there any way to do this with a LPD6803 RGB LED Strip? This strip only has clock in and data in but no LI. How would I have to change the code in order to have the same outcome?

    • BorisLandoni

      January 7, 2016 at 6:30 PM

      Sorry, we have the code only for this strip

  6. imraneesa

    December 28, 2016 at 12:41 PM

    Dear Sir,
    I want to do the same with led strip that has ws2811 chip. what do i have to change in the program. Thank you

  7. perry

    April 23, 2017 at 8:12 PM

    You have a comment that say you’re only graphing the bottom 5 bands… but the code looks otherwise… Old debug comment?

Leave a Reply