LED audio visualizer

Hi, I've been looking into making an audio visualizer using an ESP8266 with WS2812b LED strip. Originally I was just making a programable LED strip, but now I'm thinking of altering it. I found a great schematic and a tutorial on how to make something similar to what I want, but there are a few adjustments I'd like to make and I just want to ask around and see if it'll work how I imagine it could.

Original Schematic:


Website with instructions:

I would like to change a few things, the first being removing the breadboard and using a MSGEQ7 Seven Band Spectrum Analyzer Breakout Board instead of just the chip which is what he is using, I believe this would make it easier to take the circuit off the board. Next I want to remove the push button and Potentiometer from the circuit as there are only to change modes and brightness of the LEDs.

Controller wise I'm changing from an Arduino Nano to an ESP8266 just because that's what I have.

Overall I am a beginner with electronics so help figuring out how and why certain components will work together along with making my project are my main goals, people on this forum have been fantastic to me so far and I am very grateful for all the support I have received, and any future support is very welcomed.
Thank you for your time.

A nice frizzy picture but next to useless. This would be a great time for you to invest some time in a real CAD program such as KiCad, it is free for the downloading. There are others but I am familiar with this and it does not have any restrictions as to board size etc. You can start with schematic capture. This will not be a weekend learning project, expect to spend several short sessions with it. Once you have it as a schematic making changes will be easy. When you have what you want KiCad will take you through PCB layout etc and to the final Gerber files the PCB house needs. It does not currently do auto route, you do it using a generate rats nest. There are lots of online tutorials etc on KiCad and how to use it.

Not a schematic! It's a breadboard wiring diagram, not as useful as a schematic.

1 Like

You're right, I chose the wrong wording

1 Like

Too early to remove the breadboard. Breadboards are for prototyping a new circuit. Only when you have your new circuit working and fully tested should you think of removing the breadboard.

Looks like a good board. Hope fully it's available without the 90 degree pin headers pre-soldered, so you can solder some straight pin headers, pointing down under the board, for easy use on breadboard and later on stripboard or custom PCB for final assembly/soldering. If not, you will just have to plug it into the breadboard vertically for now, and maybe de-solder the 90 degree header pins later.

There are many types of esp8266, please explain what you have. Ideally post a link.

It's possible your strip won't work well with the esp8266 board. Esp boards work at 3.3V and ws2812 strips work at 5V. Sometimes you can be lucky and they will work ok together. But sometimes you get flickering and incorrect colours because the strip cannot read the lower voltage data signal from the board. Don't use the bi-directional logic-level shifter boards commonly found on eBay etc, they don't always work. Use a 74hct14 or similar chip

1 Like

Make sure you purchase MSGEQ7 from reputable stockist or you will be back asking why it doesnt work

2 Likes

I've never used the MSGEQ7 or addressable LED strips, but I've made a few sound activated effects

I like those ideas!!!

Are you sure the pot isn't used as a sensitivity control (to adjust for varying sound level)? That may not be necessary because you can adjust the sensitivity in software... No by adjusting the signal level, but by adjusting how the software reacts to the "numbers".

The LED strips want a 5V data-control signal and I believe the MSGEQ7 also "works best" at 5V so I suggest you use a different Arduino board.

The wiring is pretty simple, especially if you get the breakout board. But it's never "forgiving".

...I've got a couple more comments but I've got to go for now.

1 Like

Got it, thank you for the reminder

More... Much more... Much-much more...

Personally, I don't buy from "unknown" Amazon suppliers, or eBay, etc., because you almost never get complete documentation. But the MSGEQ7 board looks pretty simple as long as you have the MSGEQ7 datasheet. (1) The only thing "unusual" is that it looks like it's stereo with two analog outputs and shared digital connections for both chips/channels.

The MSGEQ7 is a slick little chip... Frequency analysis can be done in software but it takes lots of processing power. With the chip doing all of the work your code can mostly focus on running the LEDs which is also processor-intensive.

Frequency filtering can also be done with op-amps but you'd need one for each frequency band.

BTW - The MSGEQ7 works with line-level or headphone-level signals. If you want to use a microphone you can get a "microphone board" which has a built-in preamp. If you want to use a speaker signal from a high-power amplifier you'll need an attenuator and an over-voltage protection circuit.

For WS2812, Adafruit is your best source of information.

Have you done any programming? Or are you going to just copy someone else's code?

Modifying existing code that you don't understand can be difficult so it's usually easier to start-over yourself. Overall, the code for the MSGEQ7 isn't too complicated and since you'll be using a library for the LED strip the "hard part" has been done for you and you only have to know how to use the library.

If you are new to programming, programming is generally "hard" but the Arduino isn't a bad place to start (except that you are often learning electronics at the same time).

This probably isn't the best "beginning project" but since you probably are using some example code to read the MSGEQ7, and you'll be using a library for the LEDs, your part can be as simple or complicated as you want, and you can start-out simple.

The "secret" is to start with one of the simple working examples to get the basic structure. I'm not a beginner and I'm not really an expert but I usually start-out with the Blink Example or Read Analog Serial so I don't forget something simple. Of course you can delete the code you don't need once it's working.

Then write just one or two lines of code at a time, testing as you go-along. That's not quite as easy as it sounds... You can't just start at the top and work down... The compiler has to see a "complete program" even if it doesn't do anything useful yet. For example, if you just delete the bottom-half of a program it won't work and you'll get lots of reported errors.

Of course professional programmers write more than one or two lines at a time but they never write the whole program without testing & debugging as they go-along.

The compiler will report syntax errors but the messages are often cryptic and sometimes they point to the wrong line... I misplaced ONE curly-bracket in a big program once and I got HUNDREDS of errors. None of them said anything about a wrong curly bracket! I had to start "commenting-out" code until it compiled again. Then I could start putting-back code to track-down the real error.

If you've only written a couple of lines you know where the error is. (in my case I think I had copied-and-pasted from one part of the code to another.)

There are two important programming concepts and once you understand these you can start to make "useful programs" -

Besides the main Arduino loop() there are 3 kinds of loops in C++. (for loops, do-while loops, and while loops). A loop does something over-and-over (like updating each LED in the string), usually until some condition is met (like until you've updated the last LED). You can often loop thousands of times instead of writing thousands of lines of code.

The other important concept is conditional execution (mostly if-statements). This is how software "makes decisions" (like what color to make an LED).

As always, work on the input (audio & MSGEQ7) and output (LEDs) separately before putting everything together.

It doesn't matter which one you work on first. With the input, the MSGEQ7 puts-out 7 analog voltages in sequence. You can read those values and send them to the serial monitor (like the Analog Read Serial Example) so you can seem them. (You don't have to calculate the voltage, you can just use the raw numbers).

Of course with real audio those numbers are always changing so for testing you can use Audacity to generate 7 tone-files matching the 7 center-frequencies. (Nothing is perfect and a pure tone will probably "leak" into the other channels but with a tone, one of the bands should read a lot higher than the others.)

Once you can read those 7 numbers, you can do whatever you want with them!

Similarly with the LED strip, write some simple test code to make sure you can get whatever colors & patterns you want. You might want to start-out with something really simple like making all of the LEDs the same color.

Once the input & output are working you can start doing whatever colors/patterns you want with the data from the MSGEQ7.

And finally, here's the GOOD NEWS - Once you've got it basically-working and the hardware is done you can add more code to make it more interesting. And if you think of doing something different you can update the code at any time and it's just a matter of loading the new firmware.

When I was working on my effects I'd come home from work every day and add some new effect or some new variation. Since the hardware was done and working it was just some "typing on the keyboard" and of course I kept the old working versions in case I messed-up something.

Personally, I like a lot of randomness - Just for example, maybe the bass is represented by red and then after awhile bass is blue. Or if there is a sequence it could sequence from left-to-right and then right-to-left. (Like I said, I haven't used a WS2812 and I'm not sure how easy it is to reverse a sequence. The 1st LED is always addressed first and all of the data passes-through the 1st LED but I think you can create the appearance of reversing.)

...One of my projects is a "giant VU meter". I have two 8-foot "strings" of 24 LEDs mounted in black ABS pipe (one for left and one for right). So as a "starting point" it's exactly like any regular LED VU meter except the LEDs are spaced 3 or 4 inches apart. But, it randomly reverses (starting at the top instead of the bottom). It also randomly inverts, so all of the LEDs are on with silence and as at goes louder more LEDs go off. There is also a "dot" mode (where one LED is on at a time). Sometimes you'll see that in real VU meters. And there are "dots" modes where some random number of LEDs in a row represents the loudness. It also randomly "mirrors" so the middle LEDs comes-on first and the string lights-up up and down as the sound goes louder.

It's just red LEDs and it's just reading the volume or "beat" with no frequency information. But when you mix-and-match all of those random variations there is enough variety to keep it interesting.

Plus... It has 6 other "modes" in addition to the VU meter. Most of these are sequencing-chasing effects, and again everything is randomly reversed, inverted and mirrored. You can run it "all night" and never see ALL of the modes & patterns. (There are some switches so I can lock-in an effect in case I just want to see the VU meter effects, or if I just want it to act like a regular LED meter, etc.)

I have some "plans" for a project with color-changing LEDs, but I don't feel the need for frequency analysis. In the 1970s I built a color organ from a kit. (That's not exactly the same as mine, but the same concept.) A color organ just has 3 or 4 different colored lights for 3 or 4 frequency bands (no "movement"). I got bored with it and I eventually converted it to pop-up a different random pattern on each beat. I still have a version of that random beat effect that runs colored floodlights.

One last thing - My World's Simplest Lighting Effect adjusts automatically to the volume so you get lots of "led action" with quiet & loud songs or if you turn the volume up or down. Most of the code will be useful to you, but you can copy that part (or that concept). It's a simple effect but I actually have a "real effect" similar to that with floodlights, but of course with random variations and with other effects on the same lights so it doesn't get too boring.

All of my effects use the same automatic sensitivity concept. ...This means my meter effect is useless as a "meter" but it makes a better effect.

(1) The data sheet calls it a "Graphic Equalizer" but this is WRONG!!! (Bad translation?) It's actually a "Spectrum Analyzer" chip.

1 Like

Thank you very much for the in-depth explanations! I know how to code, I'm just new to building electrical circuits.

I learned about using the VIN pin on the ESP8266 with 5v as that pin is connected to the 5v USB micro connector. I'll be honest and say that I wired up my LEDS today for a regular strip just to check everything and it seems that the ESP8266 is doing ok working like that, although I am having some weird issues, although that may be more of an issue with my wiring and soldering than the board since it seems to be working just fine.

Assuming the way I'm using the VIN pin isn't going to entirely wreck the board in a day I think I'm going to go with that for now just because I have it.

Thank you so much for your time and explaining the process of working on the input, that's gonna be really helpful.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.