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

Thread: FastLED not turning on my Ws2812b Led Strip (using teensy 3.6)

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    16

    FastLED not turning on my Ws2812b Led Strip (using teensy 3.6)

    Hello everyone!
    I would really appreciate if someone could help me with this.
    I have bought a teensy 3.6 to drive my ws2812b LED strip, however when i used a simple blinking code on github using FastLED
    https://github.com/FastLED/FastLED/b...link/Blink.ino
    My Led strip remained turned off.
    Can anyone please let me know what am doing wrong?
    I have connected the LED strip data pin to pin11 on my teensy and then wired the ground of my teensy to the ground of the power source.
    Any help is appreciated !

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,955
    A couple of thoughts:

    Check your solder joints and such for connectivity.

    Some ws2812b LED strips need 5v to light up, many only need 3.3v to light up. Now, since you didn't mention powering the strip from the Teensy (which you can do for a few, but doing lots of LEDs can easily run into limits of the power supply), I assume you are powering it externally. What does your external power setup look like?

    If you are using a USB battery, many batteries will shut off if the power drain is too small. It may be that lighting up just one LED is not enough of a power draw to keep the battery active.

    If you are powering the strip with 5v, it may be that the strip is not seeing the transition on the Teensy data pin from high to low or low to high. This is typically because most hardware will only see the data transition if it is at least 70% of the powering circuit. 70% of 5v is 3.5v, and the Teensy 3.6 only emits 3.3v. So some strips will see it, some won't.

    You might want to try first using the Adafruit_Neopixel library, as it is simpler than FastLed, just to make sure the connection is setup.

    Again to debug the basic connection, try wiring up the strip so that 3.3v from the Teensy is sent to power the strip. Note, as I said, some strips can work with 3.3v (typically the older LEDs and the newest ones). The 3.6 can provide something like 250mA, which is ok for 3-4 LEDs, depending on how the Teensy itself is powered. If you turn down the max power of the light, you can run more. You can try powering the LEDs with the VIN pin (5v if USB), but you have to be careful, since the Teensy 3.6 cannot handle 5v input.

    If your strips need to run at 5v, you probably need to get a 74HCT245 or 74HCT125 chip, and hook that between the Teensy and the LEDs. Most voltage converters that you find are not fast enough to drive WS2812B LEDs, but the 74HCT245 is.


    If you are going to run a lot of strips eventually, you probably want the Teensy Octows2811 from PJRC, that handles all of the voltage conversions, etc:


    In the future, it would be helpful if you also had a picture that showed how all of the wiring is done. I've certainly mis-counted in the past and hooked the wire to pin 4 when the code is using pin 3.

    If you haven't done so already, you might want to read the Adafruit Neopixel best practices guide (Neopixel is the name Adafruit uses for its WS2812B and SK6812 LED strings/rings/matrices/etc.):

  3. #3
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    Hello! Thank you for your quick reply!
    I will answer your questions now and will try out all that you have suggested as soon as I can!

    My power source is external and not from the teensy 3.6, I use a 5v adapter with 1A output supply for my circuit! I will post a picture my circuit soon.

    I have used adafruit before and it was working, however FastLED is not which is very weird.

    Also the reason am moving to teensy 3.6 is that I had a working setup on my arduino uno, however it was too slow for me. So I am hoping with the new setup that I can push the limits of my personal project! I have been told that I should use both libraries “FastLED” and “WS2812Serial” to obtain a non blocking strip!

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,955
    Quote Originally Posted by Nader View Post
    Hello! Thank you for your quick reply!
    I have used adafruit before and it was working, however FastLED is not which is very weird.
    Not necessarily. There have been various bugs in FastLED on Teensys, which is why I suggested using the Adafruit library to make sure the basic setup works. Since I only use the Adafruit library (and I hope to start using the WS2812Serial library at some point), I don't really remember what the status is of FastLED.

    Quote Originally Posted by Nader View Post
    Also the reason am moving to teensy 3.6 is that I had a working setup on my arduino uno, however it was too slow for me. So I am hoping with the new setup that I can push the limits of my personal project! I have been told that I should use both libraries “FastLED” and “WS2812Serial” to obtain a non blocking strip!
    It depends on what you mean by "too slow". If you have a lot of LEDs, you are fundamentally limited by the fixed time it takes to update each LED in turn. Using FastLED, WS2812Serial, and/or the octows2811 library can allow code that is sensitive to missing interrupts (serial devices, servos, PWM, etc.) like you see with the Adafruit library. In addition, octows2811/FastLED can push down the limit, because they emit 8 strands in parallel.

    It depends on what else you need to do besides turning LEDs on/off, and how many LEDs you are supporting.

    Depending on your code, another thing to think of is never using the delay function except in specific circumstances. Hopefully, you already do this (good), but if not, you might to read on "Blink without Delay" and think how to reformulate the code.

    Specifically on the Teensy 3.5/3.6 if you are doing floating point calculations, use the float type everywhere, and if you call the math functions, use the version with a 'f' suffix (i.e. sinf instead of sin). The Teensy 3.5/3.6 have single precision floating point in hardware, but does double precision in software (the Arduino Uno does floating point in software).

  5. #5
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    I see where you are comming from, i will double check with adafruit library and get back to you about it.

    I mean by too slow, that i am sending many MIDI commands from my digital piano (so around 70 to 75 LEDs), and for each pressed key an led turns on and then off. And when too many keys are being pressed at once some LEDs remain on. From what i have been reading this is happening due to interrupts fron the adafruit library. So maybe incorporating FastLED and Ws2812Serial can solve this problem.
    What do you think?

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,955
    Quote Originally Posted by Nader View Post
    I see where you are comming from, i will double check with adafruit library and get back to you about it.

    I mean by too slow, that i am sending many MIDI commands from my digital piano (so around 70 to 75 LEDs), and for each pressed key an led turns on and then off. And when too many keys are being pressed at once some LEDs remain on. From what i have been reading this is happening due to interrupts fron the adafruit library. So maybe incorporating FastLED and Ws2812Serial can solve this problem.
    What do you think?
    This is where "it depends" comes into play. However, since WS2812B leds are always written to sequentially, if you are having problems with some lights sticking on, you might also need to make sure your wiring is up to snuff, your solder joints are good. It also may be that you are having electrical interference issues that is disrupting the communication line.

    The Adafruit library 'solves' the problems of interrupts by disabling interrupts while it is writing the entire string of lights. This means things that depend on a interrupt coming in have to wait until the library is done. If the library takes too long, you might lose interrupts if multiple interrupts were signaled. Things like reading serial input (which includes Midi), USB handling, controlling a servo, playing sounds, etc. to start failing (but the LEDs should be always all emitted).

    The Neopixel best practices lists these things among others (note, since I tend to only have a small number of LEDs, I don't always follow these, but if you are having reliability issues, you should think about following them):
    • Before connecting NeoPixels to any large power source (DC “wall wart” or even a large battery), add a capacitor (1000 µF, 6.3V or higher) across the + and – terminals as shown above. The capacitor buffers sudden changes in the current drawn by the strip.
    • Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel. The resistor should be at the end of the wire closest to the NeoPixel(s), not the microcontroller. Some products already incorporate this resistor…if you’re not sure, add one…there’s no harm in doubling up!
    • Try to minimize the distance between the Arduino and first pixel, so the signal is clear. A meter or two is usually no problem. Much longer and things can become unreliable.

  7. #7
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    Hello again
    Here is a dropbox link, this folder contains 2 pictures of my setup and a video showing the weird behaviour am getting.

    https://www.dropbox.com/sh/qbtj4gml4...EFyLcNEsa?dl=0

    In short the first few LEDs light up in white, and then the first LED starts blinking in Green?.. I am using the exact same blink example i mentioned in my very first post.. and i do not set any LED to show green color.

  8. #8
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    Dear Michael,

    I have confirmed that the adafruit library is working perfectly with my teensy 3.6.
    But again when i use any example with FastLED library in it, the LED strip just starts to do random things.
    I have now soldered the pins of my teensy 3.6 but the problem still remains.
    Am now worried that the new version of the FastLED is bugged ?

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,064
    Try adding #define FASTLED_ALLOW_INTERRUPTS 0, so the first 2 lines of your program look like this:

    Code:
    #define FASTLED_ALLOW_INTERRUPTS 0
    #include <FastLED.h>
    This special define must be done *before* you include FastLED.h. If done after, it has no effect.

  10. #10
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    Thank you Paul for your reply! I will try to add this as soon as I can and I will send the results here!

  11. #11
    Junior Member
    Join Date
    Feb 2019
    Posts
    16
    Hello Paul!
    I have tried what you suggested but the results are all the same as before.

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
  •