Is PI 3 with WS2813 using PWM on GPIO18 possible?

  • Hi all,


    I'm new here, great forum/software here!


    After some research I decided to buy components to build a HDMI source ambilight add-on for my TV.
    Had a PI 3 already, so bought the following:

    • 5V 10A power supply
    • HDMI Splitter
    • HDMI2AV converter
    • USB 2.0 video grabber (chip: UTV007)
    • 5m 6 LED per meter WS2813 LED strip
    • Level Shifter (3V to 5V) 74AHCT126


    As you can see I want to drive the strip directly from the PI.
    Most projects use the WS2812B or earlier, but I wanted to have the advantages of the WS2813.
    They seemed to be interchangeable, but after some testing this does not seem to be the case entirely.


    Current setup:

    • PI 3 with raspbian
    • Strip cut a 188 leds
    • PC (win10 HyperCon) > HDMI2AV > Grabber > PI
    • Power supply > Level shifter / WS2813 (power on one side for now)
    • PI GPIO18 > Level shifter
    • Level shifter > WS2813 DI


    HyperCon:


    Results so far:

    • Connection with PI is working
    • Installed Hyperion on PI using HyperCon
    • Without the level shifter I got some colors, but not the right ones and something that looks like the booteffect.
    • With the level shifter I usually get "white" light with some colored leds and no boot effect.
    • Can grab screen, seems OK.


    Current problems:

    • Can't get any logical colors from the strip, tried different byte orders.
    • Some leds are flickering.
    • Can't get static color by use of color picker.


    Question:
    Is it possible to drive the WS2813 by using the Hyperion PWM driver? I did (eventually) read soms hints in a few threads stating the SPI driver should be used for the WS2318, is this true?

  • Ok thanks @Akriss, that brings color to my setup!


    I do now use PSI driver on GPIO 10.
    Using PI 3 so according to library docu I've also set the following:

    • appended spidev.bufsiz=32768 to /boot/cmdline.txt
    • appended core_freq=250 to /boot/config.txt


    Tweaked the settings a bit:

    • color order is BRG
    • delay at 150ms
    • update feq. at 25Hz
    • luminance gain at 0,9 to prevent LEDS from going 100% brightness


    Other calibration will be done when strip is mounted.
    It's working pretty nice now!
    SSH color picker is also working now.


    Not using the level shifter anymore because that seemed to give worse results.
    Still have some slight (global) flickering now and then when LED's are white.
    Any suggestions on that issue?


    Also, did not jet connect the power supply to both sides of the strip and the first leds seems to have died already, oops!

  • Hi,


    I mounted the strip in the back of my TV.
    It was working when connected with 10CM of 4 wire RGB cable, but with 2,5M it's not.


    So, I thought the problem would be the voltage drop over the long wire.
    Mounted the level shifter again, but without any success so far.
    Strip has different colors depending on when I connect the data wire.
    This color is random and does not match any color on the display, screen grab is OK.


    The strip is a 4 wire, but could not find the resource so used a different one in this design:


    Any tips on how to get the signal to the strip?
    Or could this be something else?

  • Try grounding unused inputs on the shifter, here is a example.

    (node mcu pin = Rpi pin)


    However, I've was never able to get a good working ws281x led with wires >0.5 meters.
    The closer the led strip to whatever is sending the data, the better.


    A Arduino works good as a data relay if you can't avoid a long run of wire between Rpi and strip. The data is sent via USB to the Arduino, then and the Arduino (that is a few cm away) translates the data and drives the leds. The wiki has some info on the Arduino setup. The forum as well.


    Hope is of help.

  • Thanks for the extra tip, tried it,it did not work, no response on the strip.
    But it got me trying something else.


    Tried connecting the OE to the 5V, and this gave some expected response.
    Maybe this has something to do with the fact it's a different level shifter? See datasheet of the 74AHCT126 I use.

    Connecting all inputs and switch ports has no different result than only connecting the used ports.
    So connecting the switch port seems to do the trick but I kept the rest connected, just to be sure and because for unused inputs this is also mentioned in the datasheet :thumbup:


    Also played with the power supply voltage.
    Tried raising and lowering the voltage to the extends of the PSU (4,5V and 5,5V, measured at the PSU output points), but the best results still seem to be at 5V.


    When sending 255 blue, the strip will color blue, but some leds also blink in different colors at the configured refresh rate.
    Same for results for green and blue.
    This blink is very noticeable, but the colors are only visible when looking directly at the leds itself.
    Only one in the three leds has one constant color.


    As I do get the signal trough using the level shifter, It looks like the signal is high enough to switch the leds, maybe it's not a clean block signal anymore so the timing (length of the signal at the correct height) is wrong and for some leds results in the wrong colors?


    I happen to have a node mcu lying around, but don't like the extra hub that much.
    I also thought of adding a thicker signal wire (less resistance), but that's another extra wire going to the TV :(


    Do you know of any other possible solution for me to try?

  • 74AHCT125 vs 74AHCT126, Hmm both seem the same. Sorry I'm clue less of what the difference is. I'v only used 74AHCT125.


    I happen to have a node mcu lying around, but don't like the extra hub that much.


    Why not go wireless with the node mcu? With this, https://hyperion-project.org/t…-esp32-for-hyperion.3004/


    Extra hub? I'm not understanding this part.


    Some info that might help. https://github.com/jgarff/rpi_ws281x/issues/203


    Hyperion uses that library to drive WS281x strips of leds.

  • In don't like the node mcu at my TV because I've build everything into a settopbox already and the PSU still needs a cable from the box to the tv.
    If it's necessary I will go down that path, but if there is anything else I can try first I will.
    You wrote about the arduino as a relay, that's what I meant, not my best word choice :rolleyes:.


    That github link clarifies the level shifter function for me, I'm now confident I've connected it correctly so that could not be the problem anymore.
    Thanks for your helpe again!
    As also mentioned in that thread I will try using a resistor on the output of the level shifter.
    If that does not work I will also try a thicker data wire.

  • Got it working!


    Well, the resistor did not work, only made things worse.
    Also tried raising/lowering the voltage with that.


    Searching the web I stumbled upon this thread, which reminded me about how important de PI configuration is for SPI to work.
    Started to check every thing I've read about specific PI configurations for SPI and ws2813.
    Found out I made an error in the PI's config.txt.
    I didn't un-comment "core_freq=400" line.
    This and the level shifter connected correctly almost solved my problems completely.
    Also connected the WS2813 BI connection to ground, this fixed my first LED and don't know why, but also seemed to improve overall stability of the strip.


    I'm not done calibrating, but my main question about driving the WS2813 directly from the PI has been solved.


    I now wonder if this could have worked with PWM after all.
    Back then I didn't have the level shifter connected correctly.
    I've read that PWM is more CPU intensive than SPI, so I'll probably stick with the SPI, but maybe I'll try this again at some point.


    Here my latest setup is af follows: (although the BI is missing because I don't have the right resource for Fitzing)


    Again, thanks for your help @Akriss!

  • Zitat

    I now wonder if this could have worked with PWM after all.
    Back then I didn't have the level shifter connected correctly.
    I've read that PWM is more CPU intensive than SPI, so I'll probably stick with the SPI, but maybe I'll try this again at some point.


    Hey!
    Im using same chip/setup and it works with PWM(ws2815)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!