Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: OctoWS2811 LED Lib and Audio Lib - Freq/Amplitude driving LED color and brightness

  1. #1
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236

    OctoWS2811 LED Lib and Audio Lib - Freq/Amplitude driving LED color and brightness

    I'm picking up on Audio + LED strips because my 13 year old is bugging me for a cool led strip in her room... responsive to audio (amplitude and pitch). I offered this to her 2 years ago, but bailed on this project shortly thereafter because of (probably) interrupt conflicts between the audio library's FFT1024 and the fastLED library's simultaneous use of interrupt routines.

    I'm back on it.

    I have the "Teensy 3.2 OctoWS2811 Adaptor" and can run examples\Octo...\rainbow installed with Teensyduino.
    I'm using a Teensy 3.2 and have 3.6's in stock.
    The latest Arduino and Teensyduino is installed on a Mac accessible to her.

    I've not added back the Audio yet.

    By default, I'd plan to use a Neutronned mic and the ADC input from the audio library... piped into an FFT1024 object.

    I've seen other posts about the interrupt problems... one suggesting disabling the audio interrupts before executing the LED update call, and reenabling thereafter.

    What's the best practice for making a frequency-and-amplitude-responsive LED strip?


    Thanks!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    Quote Originally Posted by Davidelvig View Post
    What's the best practice for making a frequency-and-amplitude-responsive LED strip?
    The 2 easy ways are:

    1: ADC input and OctoWS2811 or WS2812Serial.

    2: Audio shield and WS2812Serial.

    Both WS2812Serial and OctoWS2811 do not block interrupts, so the audio lib can run just fine with either of these controlling the LEDs. No need to disable audio or do anything special with the interrupts.

    If using FastLED, both OctoWS2811 and WS2812Serial can be used as a FastLED driver. Just don't use FastLED's built in WS2812 driver, since it blocks interrupts.

  3. #3
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    Thanks!
    It's working!

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    Great. When you get it all build, hope you'll be able to share a video of it in action?

  5. #5
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    Will do.
    I took the quick route and used:
    - a Teensy 3.2 with the USB power cut
    - a 5V, 8A power adaptor
    - a teensy audio shield, and the AudioInputI2S for an electret microphone
    - a teensy OctoWS2811 Adaptor
    - one LED strip... 150 LEDs - 5 meters in length (Alitove)

    I'd like to add some touchable buttons for user interface (using the capacitive touch pins on the Teensy).
    I'm struggling to find a free pin that would allow a capacitive touch for input.
    I see at https://www.pjrc.com/store/octo28_adaptor.html that the shield draws many pins to ground, and pins 15 & 16 are tied to each other.

    Are the touch pins accessible in any way with the shield in place.?
    Otherwise, what input means (buttons, potentiometers, encoders) might work with the shield in use?

    I'll be downloading the WS2812Serial library and also trying the Neutronned mic and ADC input to free up some hardware. (no audio or Octo shield)
    I have a buffer chip I can use to get 5V singles to the strip.

    Pictures will come when it's more beautiful!

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,077
    Quote Originally Posted by Davidelvig View Post
    Will do.
    I took the quick route and used:
    - a Teensy 3.2 with the USB power cut
    - a 5V, 8A power adaptor
    - a teensy audio shield, and the AudioInputI2S for an electret microphone
    - a teensy OctoWS2811 Adaptor
    - one LED strip... 150 LEDs - 5 meters in length (Alitove)

    I'd like to add some touchable buttons for user interface (using the capacitive touch pins on the Teensy).
    I'm struggling to find a free pin that would allow a capacitive touch for input.
    I see at https://www.pjrc.com/store/octo28_adaptor.html that the shield draws many pins to ground, and pins 15 & 16 are tied to each other.

    Are the touch pins accessible in any way with the shield in place.?
    Otherwise, what input means (buttons, potentiometers, encoders) might work with the shield in use?

    I'll be downloading the WS2812Serial library and also trying the Neutronned mic and ADC input to free up some hardware. (no audio or Octo shield)
    I have a buffer chip I can use to get 5V singles to the strip.

    Pictures will come when it's more beautiful!
    There are some pins that overlap between the audio shield and the octows2811 shield. I'm not sure they would play together.

    The 7 pins brought out to the side of the octows2811 shield (0, 1, 23/A9, 22/A8, 19/A5, 18/A4, and 17/A3) all support touch sensitive inputs, and 5 of the pins can also be used for analog inputs. Note, if you plan to use i2c, you would need to use pins 18/19 for that, and that would leave 0, 1, 23, 22, and 17. Pins 23 and 22 are used for I2S.

    If you haven't soldered things together yet, you might be able to slip one of the shields that fit underneath the Teensy to bring out the pins underneath the Teensy:


    Or switch to a Teensy 3.6 (note, the 3.5 won't support touch sensing, but the 3.5 is 5v tolerant).

  7. #7
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    WS2812Serial is much better for this single-string project.
    Thanks, Paul & Michael.
    It's very easy using one LED control pin for a single string of 209 LEDs. All of the other pins are open for the push-button encoder, ADC microphone, I2S accelerometer, and I expect, capacitive touch.
    This might be a good intro project for someone wanting to try a bunch of input devices, and have the LEDs as feedback.
    I'll post pics, schematics, wire gauges, etc (and an STL file for 3D printing a controls housing.
    Mounting on the canopy bed today.

  8. #8
    Junior Member
    Join Date
    Apr 2018
    Posts
    9
    Quote Originally Posted by Davidelvig View Post
    WS2812Serial is much better for this single-string project.
    Thanks, Paul & Michael.
    It's very easy using one LED control pin for a single string of 209 LEDs. All of the other pins are open for the push-button encoder, ADC microphone, I2S accelerometer, and I expect, capacitive touch.
    This might be a good intro project for someone wanting to try a bunch of input devices, and have the LEDs as feedback.
    I'll post pics, schematics, wire gauges, etc (and an STL file for 3D printing a controls housing.
    Mounting on the canopy bed today.
    Hi,
    I'm doing something very similar (trying to use aux input in audio shield)
    I would really appreciate more details as I can't seem to make audio shield and octows work together.

  9. #9
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    @gavra,
    I'm happy to help. There a a few main options that will affect your choices.
    Can you list your available parts?
    - Teensy ? version
    - LED lights - brand, technology (WS2812?), number of strips, LEDs per strip
    - audio source (is this a line out from a radio?) or a microphone
    - 5V power supply
    - Teensy Audio shield

  10. #10
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    OK, here's a simple LED project that works with WS2812Serial and the Audio library
    My first attempt with Fritzing:
    Click image for larger version. 

Name:	Mic-To-LED.png 
Views:	39 
Size:	221.1 KB 
ID:	13727
    Note there are two voltages represented in red:
    • 5V from the jumper into the LED strip and Teensy through VIN, and
    • 3.3V out of the Teensy to power the mic.


    The mic is fairly unique - it's the right voltage (1.2V) to use directly with the Teensy Audio Library's ADC input.
    @Neutronned sells them on Tindy, I think.

    The LED strips use 5V and noticeable current. Lots of posts on this forum (and guidance from Paul) on 5V power supply sizing.
    Note, this also assumes cutting of the VUSB bridge on the back of the Teensy to avoid feeding power back into the PC's USB port.

    This setup allows using the audio libraries FFT1024 object, and analyzing the bins to make a sound visualizer on the LEDs.
    I could share a sketch to demonstrate that.

  11. #11
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    Updated graphic. The signal line to the LEDs must use a Hardware Serial pin on the Teensy. I moved the yellow connector.
    Click image for larger version. 

Name:	Mic-To-LED.png 
Views:	38 
Size:	224.3 KB 
ID:	13736

  12. #12
    Junior Member
    Join Date
    Apr 2018
    Posts
    9
    Much appreciated!
    As for my parts:
    teensy3.2
    5meter *30 leds/m * 7 strips of Ray wu's WS2812
    octows2812 adapter
    audioshield

    Maybe it's better we continue this in my original thread?
    https://forum.pjrc.com/threads/51209...ptor-1000-leds

  13. #13
    Junior Member
    Join Date
    Apr 2018
    Posts
    9
    Although i will try your set up maybe's it's enough for a start

  14. #14
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    236
    My sketch will only be for a single string, and a 150 LED string will be great fun.
    I think you'll have trouble with the OctoAdaptor (which uses many pins and ties most of the others to ground) and the Audio Shield, which also needs a number of dedicated pins for all of its functions.

    Start with a single LED strip solution above if you can get a mic at the right level (close to 1.2 V peak-to-peak, such as the Neutronned)
    If no acceptable 1.2V Mic, use the Audio shield (and not the Octo shield) for a single strip solution, using the WS2812Serial library for LED, and picking an unoccupied hardware serial pin for the LED signal line.

    For a 7-strip solution, I think it will be the Octo shield and find a free pin to connect a Neutronned mic for the ADC input using the Audio library, but not the Audio shield.

Posting Permissions

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