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

Thread: Teensy 4.1 with WS2812B

  1. #1
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17

    Teensy 4.1 with WS2812B

    Hey guys

    after 3 days of testing and trial and error, I decided to address the public.

    I have a self-made LED matrix with WS2812B LEDs 16x16 which work without problems under Arduino (Uno as well as Nano). With the Teensy I simply can't get the whole thing working. I have a random flickering on the strips, not the simplest codes seem to work.


    I have so far the following libraries through and am with the nerves at the end:


    - FastLED

    - WS2812Serial

    - WS2812

    - octows2811


    NOTHING seems to work here .... any idea or a simple code snipped which is running on your side with the Teensy 4.1 + WS2812B

    I am a total beginner with teensy. Therefore it would be very helpful if someone could send me a codesnipped which works in the constellation 4.1 + WS2812B


    Thanks for your help!!

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,024
    Sorry it has been awhile since I played with neopixels and the like.

    One thing I found with Neopixels was they wanted to be driven with 5v signals and the Teensy outputs 3.3v signals.
    I was able to make one work with 3.3v signal by connecting up the neopixel to use 3.3v instead of 5v... But not sure that would work well in a chain of them.

    So I when I normally play with them I end up using a level shifter, either on my own boards, or use some simple one from places like Sparkfun/Adafruit.

    I have also played around some with using the Teensy LC with them as there is one IO pin that is setup with an level shifted signal. Or with with PJRC PropShield, although
    it is more setup for DotStar with two signals.

    Good luck.

  3. #3
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17
    Hey there, thank you fou your input.

    FunFact:
    I power the neopixels with a separate power supply unit. Means 5V and GND are handled by the power unit. Only the digital "signal" comes from the teensy. So i dont think there is a Problem with the Voltage level or am i wrong?
    To exclude that I have too little power in addition i tried the whole setup with just 4 Pixels. No success

  4. #4
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    320
    Quote Originally Posted by plumped View Post
    Hey there, thank you fou your input.

    FunFact:
    I power the neopixels with a separate power supply unit. Means 5V and GND are handled by the power unit. Only the digital "signal" comes from the teensy. So i dont think there is a Problem with the Voltage level or am i wrong?
    To exclude that I have too little power in addition i tried the whole setup with just 4 Pixels. No success
    @plumped:

    Did you connect a common ground between your separate power supply unit for the neopixels & the ground of the Teensy 4.1 ?? From the Arduino IDE, click on File -> Examples -> OctoWS2811 (under Examples for Teensy 4.1) for several examples that you can use to make sure that your hardware is working correctly.

    Good luck & have fun !!

    Mark J Culross
    KD5RXT

  5. #5
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    959
    Hi, I think that KurtE was actually saying that the signal and the power need to be of the same (or similar) voltage. Even though you are using 5v separate power supply, the teensy is still only outputting 3.3v data signal. Arduino (depends what you are using) may well be putting out 5v data signal. try either bumping up data signal V or lowering power V. Its been a while, but I think data was required to be within 0.5v of power V

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,515
    Hardware-wise, make sure you have a GND connection from Teensy to the LEDs. The GND wire should follow the same physical path as the signal wire. Most modern WS2812B can work with a 3.3V signal input. But some can not and you need a level shifter to increase the signal from 3.3V to 5V. Unidirectional chips like 74HCT245 and 74AHCT125 are best.

    Software-wise, 2 bugs were recently fixed in FastLED (one of them was use of OctoWS2811 from within FastLED). So if you use FastLED, install the latest beta. And keep an eye out for any messages Arduino prints about duplicate copies of libraries... make sure you're using the FastLED library which Teensyduino installed in the {Arduino}/hardware/teensy/avr/libraries/FastLED directory. WS2812Serial, OctoWS2811, and Adafruit_Neopixel should work fine if you have 1.54 or 1.55 installed. To check, in Arduino click Help > About.

    In terms of general troubleshooting, showing us the actual code you're using for testing and photos of the actual wiring can sometimes help. Just last week we had a thread where WS2812 LEDs weren't all updating (but at least 1 LED was) and what initially was thought to be a library compatibility problem turned out to be a "simple" bug in the test program where the wrong variable was used inside a loop, so the code wasn't actually changing the pixels. Those are the sort of mistakes that can be very hard to notice when you've gone over the same code and wiring over and over. If you show us photos and an exact copy of the complete test program you're using, sometimes we can spot those sorts of things.

  7. #7
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17
    Quote Originally Posted by kd5rxt-mark View Post
    @plumped:

    Did you connect a common ground between your separate power supply unit for the neopixels & the ground of the Teensy 4.1 ?? From the Arduino IDE, click on File -> Examples -> OctoWS2811 (under Examples for Teensy 4.1) for several examples that you can use to make sure that your hardware is working correctly.

    Good luck & have fun !!

    Mark J Culross
    KD5RXT
    Would be cool if that works, but the out of the box "BasicTest" yells Error compiling for board Teensy 4.1.

    Any idea?

  8. #8
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17
    Quote Originally Posted by plumped View Post
    Would be cool if that works, but the out of the box "BasicTest" yells Error compiling for board Teensy 4.1.

    Any idea?
    Allright the solution for the "BasicTest" yells Error compiling for board Teensy 4.1. was to change naming to avoid loading the wrong library in arduino instead of teensy folder.

  9. #9
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17
    Quote Originally Posted by PaulStoffregen View Post
    Hardware-wise, make sure you have a GND connection from Teensy to the LEDs. The GND wire should follow the same physical path as the signal wire. Most modern WS2812B can work with a 3.3V signal input. But some can not and you need a level shifter to increase the signal from 3.3V to 5V. Unidirectional chips like 74HCT245 and 74AHCT125 are best.

    Software-wise, 2 bugs were recently fixed in FastLED (one of them was use of OctoWS2811 from within FastLED). So if you use FastLED, install the latest beta. And keep an eye out for any messages Arduino prints about duplicate copies of libraries... make sure you're using the FastLED library which Teensyduino installed in the {Arduino}/hardware/teensy/avr/libraries/FastLED directory. WS2812Serial, OctoWS2811, and Adafruit_Neopixel should work fine if you have 1.54 or 1.55 installed. To check, in Arduino click Help > About.

    In terms of general troubleshooting, showing us the actual code you're using for testing and photos of the actual wiring can sometimes help. Just last week we had a thread where WS2812 LEDs weren't all updating (but at least 1 LED was) and what initially was thought to be a library compatibility problem turned out to be a "simple" bug in the test program where the wrong variable was used inside a loop, so the code wasn't actually changing the pixels. Those are the sort of mistakes that can be very hard to notice when you've gone over the same code and wiring over and over. If you show us photos and an exact copy of the complete test program you're using, sometimes we can spot those sorts of things.
    Thank you Paul for your clear description. I am now powering 5 pixel directly from the 3.3V from the teensy (for testing purposes). Ground also connected to teensy GND and it perfectly runs as expected!


    Now the question is, how i can i calculate the needed power supply? i have 256 pixels in the frame. I have calculated once a value of 5V 15A is that possible?

    Click image for larger version. 

Name:	20211122_165728.jpg 
Views:	19 
Size:	121.7 KB 
ID:	26632

  10. #10
    Junior Member plumped's Avatar
    Join Date
    Nov 2021
    Location
    Switzerland
    Posts
    17
    Allright its now working also with power everything over 5V power supply.... I think the point here was to use the same GND for Teensy and also the LEDs which @kd5rxt-mark mentioned at the beginning :-)


    Click image for larger version. 

Name:	20211122_170923.jpg 
Views:	15 
Size:	131.4 KB 
ID:	26633

    Click image for larger version. 

Name:	20211122_170930.jpg 
Views:	12 
Size:	111.5 KB 
ID:	26634

    Click image for larger version. 

Name:	20211122_170934.jpg 
Views:	15 
Size:	101.9 KB 
ID:	26635

Posting Permissions

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