Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 31

Thread: Audio Visualizer with ws2811

  1. #1

    Audio Visualizer with ws2811

    Hi all,

    First post here. Anyways, I would like to sync a strand of addressable led's to music. I know in processing you can use the minim library to do all the audio processing, but where would I begin for the teensy?

    Thanks,
    Chad

  2. #2
    Welcome

    I have been working on something similar, a 3d POV music visualizer that uses minim in processing.

    I posted some early code and explanations here that you may find useful.

    In the case of where to start on the teensy code;
    First set-up some code that sets the leds depending on an array of bytes. IE loop through the different bands then within that loop through each led you have for that band. Then have a simple if statement checking if the particular led should be on or off (worry about colours later). Then fill that array manually with a few values all within the number of leds each band is given, when it works as it should you can move on.

    When you send the array over serial you will need to use the map function so the values fit with the number of leds you are using.

  3. #3
    I am actually in the process of creating this vector in matlab. You think this is a good idea?

  4. #4
    Personally I'm not familiar with matlab, is it just simulating the logic structure or something? What are you trying to achieve by using it?

    Have you got the strip running, what board are you using. I suggest playing around with example code, start simple change the colour of some random leds, check what you expect to happen does.

  5. #5
    Im using teensy 3.0 and I soldered some header pins to it and put it on a breadboard. I got the lights running using the neopixel library. I know this is wrong but I have the -5v supply connected to the ground bus on the breadboard and the ground pin from the teensy to the bus. It was the only way I could get it to not only light up but follow the code expectedly and not flicker white.

    As for matlab, I was thinking I could use it to process the audio and store that information in a matrix. It has "tool boxes" to read the .wav or flac and I can write some code to take care of storing the info. I was just going to try this for now but eventually Id like some real time audio processing

  6. #6
    Oh and theres also a feature that can convert your code into C

  7. #7
    If you are using the teensy 3 and the ws2811, then you can't go better than using the octosw2811 library. It is specifically designed for what you are doing.

    You are programming it with teensyduino right? Or are you doing it with the native code, I'm not familiar with that either.

    Look at the information about the octo library.

    You should be fine powering it over usb for now, just make sure you don't have a long strip hocked up.

    I think it would be overcomplicating if you didn't just use teensyduino. I thought you were going to use processing, that would be the easiest way. You should be able to get a live music visualization over serial, i'm having more trouble because of the pov time sensitive and more demanding code. It would be easier to go straight to the real time visualization.

  8. #8
    Im using the teensyduino. I have a 4 meter long strip and was planning on cutting it into 4 pieces but not until I figured this out. I can use USB to power my lights? Just connect it to Vin?

  9. #9
    I would expect that is too much.

    But because you are connecting to usb power, it all depends on your computer. Try searching for the output capabilities of your usb ports. Drawing to much current over usb might do nothing to your computer or it may brick it, I recon you could get away with having the whole thing on with lower brightness for short periods of time.

    Yes I know the feeling with not wanting to cut the strips, when I failed at using them for pov I cut 5m into sections of 5. Now it will be a mess if I want to use them for something else.

  10. #10
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    USB standard says each receptacle is to provide 500mA.
    In my experience, desktops and powered USB hubs don't provide anywhere near that much. Laptops- even less, save one port that some laptops claim is higher power (for charging phones).

    I have some USB power sources for charging smartphones - some are marked 1.0A.

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    If you want to be able to turn them up to full brightness, you need to budget 50 mA for each LED. It adds up quickly. 5 meters of LEDs with 60 per meter is 300 LEDs. The max current is 15 amps! That's far more than the 0.5 amps you can (usually) get from USB.

    Large LED projects need big power supplies. See the power supply section on the OctoWS2811 page. It's also important to locate the power supplies fairly close to the LEDs and use heavy wire. For 15 amps, you probably would need 16 gauge. The wire inside the strip isn't great, so for a long strip, you'll probably need to apply power at both ends.

    If you are careful to never turn the LEDs up past half way, you'll only need about half the current. They still look very bright. The increase from 50% to 100% is not as apparent as from 0 to 50%.

    The Crash Space folks from Los Angles has a large LED project using OctoWS2811 at Maker Faire. It had about 2000 LEDs, but I believe they were using them up to only 10 to 15% and they were driving by software that never turned on more than about 1/3 of them at a time. The LEDs were mounted on wood panels painted black. It looked great. They had the whole thing running on a single PC power supply. But if you do something like that, you need to be very careful in your software not to turn on all the LEDs.

  12. #12
    I am struggling just to power this thing. I must be doing something wrong.

  13. #13
    Have you read through all of the octo library information yet?

    Just telling us it doesn't work doesn't give us anything to go on; what does work, what do you think is causing the problem?

    Maybe upload a photo of your wiring?

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    If you trying to make a large LED display, it's going to take a lot of power to make a large surface look bright. There's no magic way to avoid this reality.

    Persistence of vision does not somehow make a large area look bright using only the relatively amount of power for a small number of LEDs. If you run a dozen LEDs at only 10 to 20mA each and them spin them fast over a large area, the whole thing will appear relatively dim.

  15. #15
    I have a 5v 10a switching power supply. I cut the end of a 3 prong surge protector off to connect from an outlet to the supply. I have black to Line, white to Neutral, and green to Ground. I then connect the +5v from the power supply to the +5v terminal on the LED strip. I have tried connecting another wire from the supply's ground to the ground terminal on my breadboard which is already connected to the ground pin on the teensy via jumper wire. I have also tried no ground from the supply and just the teensy's ground on the bus. I sometimes barely get a white flicker no matter which library, sometimes. The only time it works is when I run the neopixel library and have the the ground bus connected to the -5V and also have the teensy ground pin connected to the same bus. Does not work if teensy's ground is not connected to that bus. Only the neopixel library works for that setup. It actually works well but I need a thicker gauge wire from -5v to bus because I suspect there is a lot of current going through that. Click image for larger version. 

Name:	IMG_4358.jpg 
Views:	212 
Size:	147.6 KB 
ID:	703
    Last edited by chadder_all; 07-23-2013 at 01:22 AM.

  16. #16
    So the problem is only the neopixel library works and you think its because of the way the power is connected?

    Either the power is connected or its not. With the octo library have you connected pins 15&16? not doing that would cause you problems. What pin do you connect the data to?

    But it could be the software side of things. There are two different data rates that the strips could work at and different colour set-ups, with the octo try switching the data rate. If you are trying the fastspi there are also setting for what type of strip, but you should really use the octo its the best!

  17. #17
    just put 15 and 16 together and it worked! but it only when i had the same connection, -5v to the ground bus. I had all 240 (4m x 60/m) going but I stopped quickly when I smelled something burning. My breadboard is pretty warm on the supply bus. What do you think of this situation? why might it only work with -5v to the ground bus. Thanks for helping out!

  18. #18
    @Quwat

    How do I feed arrays of bytes to the teensy? can I do it in the arduino IDE?

  19. #19
    The reason it only works when the grounds are connected is because otherwise the data signal from the teensy, is like its not connected to the circuit at all. The signal comes from the teensy and it will only travel where it can get back to the teensy, there is no direct connection between the two grounds because two power sources go through transformers from the mains. AKA without a complete loop there is no circuit where current can flow.

    It sounds like you have shorted something out, this is not good it will damage the hardware and maybe even you. Follow all of your leads and unsure that they can not touch.

    The serial communication. Have you already got the code working on the teensy and in processing working independently? I would suggest doing the two ends first, check they are working then get things talking. This way you will know what you need to communicate and what factors to consider with the effects of the communication, before you go and get that working.

    Right now I am coding something similar, I am improving the processing side of my music visualization. Soon I will add the communication code to it and test it with my display code, to get a better idea of its performance. So you could play around with my processing code to, if you want. Really both of our needs are the same on the computer side.

    The communication code will be easy, worry about making the visualization look cool.

    I will post my processing code soon, its on my other computer.

  20. #20
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    I'm confused. You said you have a 5V 10A power supply. But then there's all this talk of -5V power. How is that? Is there another power supply creating -5V, or does this 5V 10A power supply provide both +5V and -5V?

  21. #21
    I think he is just referring to GND, I have the same power supply it has the symbols +V & -V to show the difference between the ground for the mains and the 5v. So it leads to call the ground -5V.

    But what would one need multiple polarities of supply in a circuit for anyway?

  22. #22
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    But what would one need multiple polarities of supply in a circuit for anyway?
    Long ago, analog circuitry was typically powered by +15V and -15V (30 volts total), and sometimes 12 was used because it was more convenient. Sometimes 18 volts (36V total) was used, to allow for larger signal output to maximize the signal to noise ratio. Especially for professional audio, positive and negative voltage signals with large voltage range is really useful.

    Modern silicon processes do not support such high voltage. For a while, using +5 and -5 volts was common. In fact, if you look at a selection of opamps specs, "V Span Max" falls into 3 pretty broad groups, 36V meant for old-style +/- 15V, 12V to 16V meant for +/- 5V power, and 5 to 6V, meant for running from a single 5V or 3.3V supply.

  23. #23
    Quote Originally Posted by PaulStoffregen View Post
    I'm confused. You said you have a 5V 10A power supply. But then there's all this talk of -5V power. How is that? Is there another power supply creating -5V, or does this 5V 10A power supply provide both +5V and -5V?
    As Quwat said it is a common terminal. I finally took a voltmeter to it. I was very confused by the -V notation. I am also going to connect the +5v directly to the led strip instead of the breadboard due to the large amount of current and heat. I wrote a little sketch in processing to due real time audio analysis from the line in and it works pretty well. Now I just need to figure out how to get that sketch and the teensy talking...

  24. #24
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Be sure to measure, without circuits attached, the voltage between -5 and 5V and ensure it is not 10V.
    If there is a GND or 0V on the power supply, then I'd assume that -5V is just that, -5 volts w.r.t. GND.

    If the supply is single-voltage, then the -5V marking was done by someone from Pluto, I say.

  25. #25
    I have a solid program in Processing doing some spectral analysis. But im getting problems using the serial library to communicate between the arduino IDE/teensy. It takes about a half second to register a 'hit' before the strip lights up. It must be the code I have written to the teensy because I lit up the board's LED no problem with not latency. But now i get a major lag in the Processing screen and also the strip lighting up. i will post some code but can someone tell me why this is happening? My programming seems to be the problem

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •