joosteto / ws2812-spi

python routines to program the WS2812 RGB LED chips on the raspberry, using the hardware SPI MOSI.
GNU Affero General Public License v3.0
61 stars 24 forks source link

[Feature request] Orangepi Support #3

Open Tom-Neverwinter opened 7 years ago

Tom-Neverwinter commented 7 years ago

specifically support for the OrangePi Zero

LucaBertuolo commented 7 years ago

It's already working on Orange Pi Zero... I've made a video for you... https://youtu.be/OLTufsrQZc0

Just select the correct SPI dev...

Tom-Neverwinter commented 7 years ago

Thank you for your wonderful work :)

LucaBertuolo commented 7 years ago

I didn't do anything... :) I've just use the code with the correct spi port... spi.open(1,0)

As soon as possible i will use a DSO for understand where is the problem in the first led... As you can see in the video, the first led is always Green even with a logic level adapter 3.3/5v...

zipzit commented 7 years ago

@LucaBertuolo Two things:
1) Your first LED remaining on, isn't that the issue that art103 is talking about here?

I had to modify ws2812.py to use write2812_pylist4() and replace tx=[] with tx=[0x00]. Otherwise, the SPI bus defaults to having MOSI high for a period of time before starting the sequence (checked on a scope). This was causing the 1st LED to have ~50% green always on.

2) You also mention something about "a logic level adapter 3.3/5v" I'm way confused here. I thought that WS2812 data input required 5v logic (ref: Arduino / Pic) Aren't Raspberry Pi's (plus different flavors, Orange and Banana) and C.H.I.P. 3.3v logic? Does the Pi require a logic voltage shift (hardware?) to be robust driving WS2812 LEDs? Is it possible that SPI always driven at 5v logic by design on a Pi? Can you explain?

LucaBertuolo commented 7 years ago

Hi,

1) Thanks, i've not noticed that issue, i will try this modification in a few days...

2) The WS2812 require a TTL 0-5v signal on DataIN pin, but the Orange Pi's GPIO provide a 0-3.3v output. You could use a signal of 0-3.3v for drive the WS2812, but this is not datasheet-compliant... Many people drive the WS2812 with a signal of 0-3.3v and a power supply of 5v, but this is not the correct ways, even if it works... The correct ways is to use a logic level adapter from the 3.3v of the Orange Pi board, to the 5v of the WS2812, something like this.

doublehp commented 6 years ago

LucaBertuolo nope ... https://www.sparkfun.com/products/12009 is not compatible with WS2811. The hardware side of this issue have been discussed in here: https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=200793 http://www.electrobob.com/ws2812-level-translator/ http://www.orangepi.org/orangepibbsen//forum.php?mod=viewthread&tid=3318&page=1&extra=#pid21903

Do not use bidirectionnal adapters for these LEDs, they can't handle them.