1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + Other Software [Orange Pi] WS2812b SPI with a Level Shifter (?)

Discussion in 'Hardware Support' started by gebn, 22 February 2017.

  1. gebn

    gebn New Member

    Messages:
    26
    Hardware:
    RPi3, +Arduino
    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
    1. 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?


    2. 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?

      upload_2017-2-22_0-9-10.png

      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!
     
    Last edited: 22 February 2017
  2. penfold42

    penfold42 Active Member

    Messages:
    746
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    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
     
  3. gebn

    gebn New Member

    Messages:
    26
    Hardware:
    RPi3, +Arduino
    thanks for replying so late , was about to hit the hay myself !
    1. 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!
    2. 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.
     
  4. penfold42

    penfold42 Active Member

    Messages:
    746
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    On a raspberry Pi with only 1 spi device you don't need the cs line and can wire OE to ground on the hct125

    As long as the orange Pi has stable MOSI pin when not active this will be fine.
     
  5. gebn

    gebn New Member

    Messages:
    26
    Hardware:
    RPi3, +Arduino
    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

    Compiled Hyperion-ng as at 10th March

    Currently 43 LEDs Connected like this
    MOSI > 74HCT125 A PIN -///////////- 74HCT125 Y PIN > 470ohm Resistor > DataIN Strip
    SPI0_CS > 74HCT125 OE PIN^

    Ground between Pi, Powersupply, 74HCT, LED Strip
    Capacitor inline with LEDs VCC+ and VDD-
    Also tested connecting OE to Ground, Same Issues
    Also Tested Bypassing Resistor, same issue on Raspberry Pi, untested on OrangePi

    GRB byte order, baudrate left default at 3000000

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