Audio Spectum Analyzer

Status
Not open for further replies.

Zinic

Member
DIY-KIT-AS1424-digital-Level-Meter-Audio-LED-_1.jpg

Hi all,

I've been browsing the store and am itching to buy a Teensy. But I want to get some guidance on a project idea before I go buying parts I don't need.

I want to create a wall-sized audio spectrum analyzer. I'll be something much bigger than the picture above, that I'll hang on my wall. I am thinking 60x32 = 1920 LEDs. In order to do this, I need to analyze audio live and drive all these LEDs at the same time. That led me to Teensy controllers. I don't know how fast of a microcontroller I need, but I figured Teensy 3.6 is plenty fast with it's 180Mhz clock rate and floating point arithmetic unit. The audio library provided will help with the audio analyzing.

Now I have to decide on which addressible LEDs to use. I bought 1 strip of WS2811 to test out, but then learned that they are slow at 400Hz and are very stringent with timing. This may not be ideal if I plan on processing audio at the same time. SPI LEDs on the other hand are not limited by timing or speed, so it sounds like that's the way to go.

Then there's the power issue. 1920 LEDs all lit up at max brightness will draw over 100A. That's insane - the breaker will trip way before then. So I'll have to limit the brightness based upon the amount of LEDs that are lit up.

Here are my questions:
Am I right on my assumptions (Teensy 3.6 is good, SPI chipset LEDs are the way to go, power won't be an issue if adjust brightness)?
What's the best way to multiplex the 32 columns? Or would it be better to daisy-chain the columns?
Which LED strip should I buy?
The SPI LED's I've seen are 5V. I understand 5V to power them, but do the RGB data bits have to transfer at 5V too? The Teensy 3.6 is only 3.3V out.
Would this be something you'd be interested in seeing a build log?
And finally, any recommendations would greatly by appreciated. I haven't see anyone do this before, so I feel like I am missing something.
 
I want to create a wall-sized audio spectrum analyzer. I'll be something much bigger than the picture above, that I'll hang on my wall. I am thinking 60x32 = 1920 LEDs.

Yes. The answer is yes!

The OctoWS2811 library comes with a SpectrumAnalyzer example that does exact this.

https://github.com/PaulStoffregen/O...xamples/SpectrumAnalyzer/SpectrumAnalyzer.ino

If you've installed Teensyduino, just select Teensy in the Tools > Boards menu, then click File > Examples > OctoWS2811 > SpectrumAnalyzer to open this example!


I don't know how fast of a microcontroller I need, but I figured Teensy 3.6 is plenty fast with it's 180Mhz clock rate and floating point arithmetic unit. The audio library provided will help with the audio analyzing.

Teensy 3.2 is fast enough.

For a larger display, like 3000 to 6000 LEDs, you'd probably want to step up to 3.6.

Definitely buy the Octo adaptor board and use CAT5 or CAT6 cable to run the data signals. Follow the wiring guidelines. The most critical point is placing the power supplies close to the LEDs with short, large size wire for each LED strip. You want the data ground and power grounds to meet at or very close to each LED strip.

Follow those guidelines and things usually work out well. Long power wires and skimping on the wire size are the death of these sorts of projects. It is 100 amps, afterall!


I bought 1 strip of WS2811 to test out, but then learned that they are slow at 400Hz and are very stringent with timing.

OctoWS2811 takes care of the tight timing, in a fully non-blocking way which scales up well to large projects.


Then there's the power issue. 1920 LEDs all lit up at max brightness will draw over 100A. That's insane - the breaker will trip way before then.

Indeed power is a big issue. But it's 100 amps at 5 volts, which is 500 watts.

Using 75% efficient power supplies, that's ~660 watts drawn from the AC mains. At 120 volts, you're looking at about 5.5 amps. Or half that if using 240V AC.


Am I right on my assumptions (Teensy 3.6 is good, SPI chipset LEDs are the way to go, power won't be an issue if adjust brightness)?

Teensy 3.6 may be a little on the overkill side for only 1920 LEDs. But then the extra $10 for double the performance is probably the least expensive part of this project.


What's the best way to multiplex the 32 columns?

Follow the OctoWS2811 SpectrumAnalyzer example, and maybe read the general OctoWS2811 page.

https://www.pjrc.com/teensy/td_libs_OctoWS2811.html


Would this be something you'd be interested in seeing a build log?

Always awesome to see big LED projects! If you're willing to take photos and write about the build, I'm sure many people will be interested to read about your efforts.
 
Great response Paul. Thank you. I'll have to look into it tomorrow and if I have any more questions, I'll be sure to ask them here. :)
 
@zinic I did a similar project using Teensy 3.2 and I'm very happy with the performance and capability. The project displays the spectrum or a microphone input for 32 bands. The spectrum lib supplied by PJRC was 16 bands but I easily modified the code to expand to 32 bands. Granted my display is a display and not led's, but you can get a feel for the performance from watching my vid.

https://www.youtube.com/watch?v=tCUUaf6nYE8&t=174s


Hope this helps.
 
Alright, so here is what I am thinking. It looks like the show() function of the octoWS2811 library would take (30e-6*1920) = 0.058 seconds to update all 1,920 LEDs. That's 17 updates a second. That is too slow for my needs. What I am aiming for is the exact replica of the spectrum analyzer shown here, https://youtu.be/blIMhSO_Uhs?t=1m20s , albeit with fewer bands and hopefully surpassing 60 times a second (which is what the video plays at in HD on a PC).

According to Phillip Burgess on Adafruit:
Can I use NeoPixels for POV (persistence of vision) displays?

Not recommended. The refresh rate is relatively low (about 400 Hz), and color displays in fast motion may appear “speckled.” They look fine in stationary displays though (signs, decorations, jewelry, etc.). For POV use, DotStar strips will look much better (they have about a 20 KHz refresh rate). Source https://learn.adafruit.com/adafruit-neopixel-uberguide/the-magic-of-neopixels#faq-6

Those DotStars transfer data with SPI, which is why I am thinking that is the best option. But you're the resident expert, Paul. Can I achieve my goal using WS2811 or similar LEDs?

There is still one thing I still don't understand. On the page about DotStars from Adafruit, it says:

DotStars are 5V devices. While you might get them to respond to 3.3V signals, this is not a guaranteed thing and should not be counted on. For low-voltage microcontrollers and systems such as Raspberry Pi, a logic level shifter (e.g. 74AHCT125) is recommended for both the data and clock pins. Source: https://learn.adafruit.com/adafruit-dotstar-leds/overview

I don't think he is referring to the 3.3v controller powering the LEDs, but sending the data bits. Is that really an issue to consider?

----------------------------------------------------------------------

@zinic I did a similar project using Teensy 3.2 and I'm very happy with the performance and capability. The project displays the spectrum or a microphone input for 32 bands. The spectrum lib supplied by PJRC was 16 bands but I easily modified the code to expand to 32 bands. Granted my display is a display and not led's, but you can get a feel for the performance from watching my vid.

https://www.youtube.com/watch?v=tCUUaf6nYE8&t=174s

That's pretty cool KrisKasprzak. I like how you also went through your code too. I wonder how it would look if you fed a music signal instead of using a microphone.


Hope this helps.
 
It looks like the show() function of the octoWS2811 library would take (30e-6*1920) = 0.058 seconds to update all 1,920 LEDs.

It's 8 times faster than you've estimated, because OctoWS2811 sends 8 streams in parallel. For 1920 LEDs, you connect 240 to each pin. LED update time is 30us * 240 + 300us = 7.5 ms.

Truly, the example that comes with the library really does work. You should give it a try. The SpectrumAnalyzer update rate is 86 Hz, due to the speed of 50% overlapped 1024 point FFT, even though the LEDs could update at 133 Hz.


Those DotStars transfer data with SPI, which is why I am thinking that is the best option.

Usually I do not recommend APA102, unless you really need POV. If the LEDs are stationary, avoid Dotstar. The clock propagation does not "regenerate" the clock well. It's basically making a copy of a copy, analog style, so the clock signal gets worse the farther down the strip you go.

https://www.pjrc.com/why-apa102-leds-have-trouble-at-24-mhz/

Adafruit's website is filled with all sorts of helpful advice that's mostly good, but some of it is quite questionable. Many people have an overly optimistic idea of APA102 because Adafruit promotes them as a solution... but the problem solved is the inability of most boards to do WS2812 protocol well. That's not an issue with Teensy! :)

Likewise you'll find all sorts of advice like adding a big capacitor. But they don't explain that's mostly for the situation where you've purchased a cheap power supply with a long lead attached. While that is a good quick fix for the modest size project mode people build with Adafruit's projects (under 100 LEDs), it's not such good advice when you scale up to 2000 LEDs. For a large project, you need much bigger power supplies and they must be located close to the LEDs with short, large size wire. Adding a capacitor will compensate for long wires for a small project, but that sort of advice won't serve you well for a big project. In other words, read Adafruit's site (and any website, even here) with some critical thinking and skepticism. There's a lot of general advice that's spoken as if it's applicable to all situations, but isn't.
 
Last edited:
It looks like the show() function of the octoWS2811 library would take (30e-6*1920) = 0.058 seconds to update all 1,920 LEDs. That's 17 updates a second. That is too slow for my needs.
If I understand you correctly, you assume that the frequency bars are updated 60 times a second, because its an HD video?

I have not measured it, but from my experience with spectrum displays, the spectrum analyser in that video looks like it has a software lowpass filter (maybe a simple exponential averager), which dampens a too quick response of the bars.

So I doubt that you would need 60 updates per second to achieve smooth appearance, because the bar values are lowpass-filtered anyway.
 
It should be clear that the human eyes and brains cannot precisely read and follow the spectrum readings if the refresh rate exceeds 10 - 15 fps... Wait.. was that -3dB or -2.8dB???
 
@PaulStoggregen
I'll do it with teensy 3.2 and octo shield. I also want to get the teensy 3.6 to play around with =P. Thanks. It'll take a while before I can update on my progress with it.

@DD4WH
Because the maker of the video rendered at 60fps, youtube plays it back at 60fps when HD is selected. It looks fluid, so I thought I wanted all my LEDs to update at least 60 times a second. Thanks for bringing up the idea of the guy in the video using a lowpass filter. I really like how it looks, so I'll look into dampening the higher frequencies myself.

@Theremingenieur
15fps is terribly slow. If you shake your mouse back and forth, you can easily see the spacing of the cursor between screen refresh rates. Most likely your monitor is is refreshing every 60 seconds. At 15fps, those cursor spacings will be further apart. So I am thinking the same will be noticed with a spectrum of LEDs. The quicker it refreshes, the better it will look (and more closely align with the sounds of the music)
 
That's cool Chris.

I managed to put mine together after much headache, and it's looking really good so far. I still have to straighten all the LEDs, and add buttons and knobs to the thing. And I am still tweeking the settings to provide a good looking spectrum.

One of the things I want to do is display scrolling text. Is there a library that converts characters to coordinates that I can easily port over? If not, I might have to create bitmaps for all the characters, which doesn't sound fun.

https://photos.app.goo.gl/WZavJGYJHa7Czd2a6
 
as far as driving an LED display i'm not sure what libs are out there, the ili9341_t3 lib i used has scrolling text
 
Status
Not open for further replies.
Back
Top