[Orange Pi] WS2812b SPI with a Level Shifter (?)

  • Hello all,
    I am almost done on my ambilight kit, i have been very busy on other things but also eagerly awaiting the arrival of a Fushicai UTV007, and with it's arrival being days away I've been getting my hands dirtier.


    So i got Hyperion to successfully compile on an Orange Pi using an Armbian image and was told that instead of using an Arduino; the SPI driver should work with other-fruit Pi's. So I compiled with the " -DENABLE_SPIDEV=ON " flag and systemctl service ran fine until now (SPI should be enabled by default from kernel since 5.16).

    However I wanted to verify a few details with all of you to see if I am on the right track

    • I have read that the transfer size is limited to 128 bytes on sun6i family.
      The H3 Processor on my OPi Plus is a sun8i family and it's datasheet (page 63) shows that it supports "Full-Duplex Synchronous; Two 64-bytes FIFO TX and RX with DMA or Interrupt Based"


      Does this limit the refresh rate of the LEDs; especially since im using a ~280 LED Build?




    • Would anyone check this diagram out for me?
      I don't know how I should wire the outputs to the 74HCT125? Should i wire a ground from the GPIO to the 74HCT125 or the LEDs? What should i do with unused OE pins on the shifter?




      Ignore the 74HCT125D mistake on pin 13 and 12; the ground should be connected to pin12 and pin11 on the 4A and 4Y Line

      I had previously used a 470 ohm resistor between Arduino and DataIn, I left it there since I wasn't sure if i should remove it, Capacitor is there to protect the LED's, I could only find a 10V one locally and was told it makes no difference.




    Thanks all, will be posting a full tutorial when i get the capture card!

  • Quick answers for now...
    1) as long as the spi driver uses dma to feeds the fifo fast enough to ensure back to back transmission it should be ok
    If not, most of the leds will likely flicker.


    It's uses 12 bytes per rgb led so would max out at 5 leds


    2) you need ground between power supply, leds and PI.


    I also wouldn't recommend putting 20 amps through a breadboard - power and ground need to go direct to led strip and then take ground to breadboard and Pi

  • thanks for replying so late , was about to hit the hay myself !

    • thought so too, hope it doesnt drop from dma to interrupt to often, but ill guess ill have to plug it in to see the results!
    • ground to pi sorted then


    another question though; does the output enable line on the HCT need to connect to the SPI_CLK or SPI_CS, i read on this forum that i need to connect to CS, but on another that i need to connect to CLK since OE acts as an opening and closing gate (??????) ?


    and i wont be using a breadboard, just going to do everything direct, i just like using a virtual one since it helps me plan better, my leds are already wired anyway! :p thanks for the tip nontheless, will help me compile a better sketch for later.

  • somewhat of a double post, sorry for that but i do need some help on this.

    Connected everything as outlined above, done specific edits to remove the first green led as outlined here. Now i got some weird glitches.


    I have tried editing /libsrc/LedDevices/LedDeviceWS2812SPI.cpp variable SPI_FRAME_END_LATCH_BYTES with 6 and 80 and unsigned_ptr to 3. In all cases i fixed the first green led, but not this (webmshare).


    With the Raspberry Pi 3 and no edits to the , i get something completely different. it works except for this random white flashing.


    So close to fix but i always seem to find something in the way



    as for debug, at best i could build a arduino oscilloscope to send images of data output, since i cent lend one from anyone

Jetzt mitmachen!

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