Control RGB Color or rutine via impulses
-
Thx, the DotStar look realy nice so i think i will wait until the Support from you're side is there.
-
David, it is possible to drive a WS2812 RGB led from SPI... Here is some Python code I used to drive a WS2812 strip from a Micropython board:
import math import gc from pyb import SPI def tsv2rgb(hue, saturation, value): """ See http://fr.wikipedia.org/wiki/Teinte_Saturation_Valeur#Conversion_de_TSV_vers_RVB """ S = saturation / 100. V = value / 100. Ti = int((hue / 60)) % 6 f = hue / 60. - Ti L = V * (1 - S) m = V * (1 - f * S) n = V * (1 - (1 -f) * S) if Ti == 0: red = V green = n blue = L elif Ti == 1: red = m green = V blue = L elif Ti == 2: red = L green = V blue = n elif Ti == 3: red = L green = m blue = V elif Ti == 4: red = n green = L blue = V elif Ti == 5: red = V green = L blue = m else: red = green = blue = 0 # Scale to 8 bits red *= 256 green *= 256 blue *= 256 return int(red), int(green), int(blue) def byte2bits(byte): b0 = chr(0x03) b1 = chr(0x0F) bits = '' mask = 0x80 while mask != 0: bits += b0 if (byte & mask) == 0 else b1 mask >>= 1 return bits def main(): spi = SPI(1, SPI.MASTER, baudrate=6400000, polarity=0, phase=1) spi.send(chr(0x00)) buf = bytearray(10 * 3) n = 0 while True: pos = 0 while pos < len(buf): buf[pos], buf[pos+1], buf[pos+2] = tsv2rgb(0, 100, 100) pos += 3 data = ''.join(list(map(byte2bits, buf))) spi.send(data) gc.collect() n += 1 if __name__ == "__main__": main()
-
I looked into this early last year and came to the conclusion that although it would work, it wouldn't be possible to get the timing perfectly consistent, because even if you use DMA to drive the SPI, other concurrent activity such as DMA to the network interface would be liable to mess it up. That's why I decided to support DotStar instead. The DotStar driver is already working and one of our OEM customers is using it.
-
Well, I agree if you want to have a continuous stream of data, to make fast animations, but it works fine without the need of a DMA to control a few leds...
-
Any news about RGB Support from the Duet?
-
@CrazyCreator said in Control RGB Color or rutine via impulses:
Any news about RGB Support from the Duet?
Duet 3 main board MB6HC supports DotStar RGB LED strips.
-
Great news, thanks for your work
-
@dc42 said in Control RGB Color or rutine via impulses:
@CrazyCreator said in Control RGB Color or rutine via impulses:
Any news about RGB Support from the Duet?
Duet 3 main board MB6HC supports DotStar RGB LED strips.
Only duet 3??? Not possible with duet 2 wifi?
-
To drive them from Duet WiFi, you would need an adapter to buffer, gate and and level shift the SPI signals on the daughter board connector.
-
since it would require hardware either with neopixel or dotstar on the duet2 board. which way would be the easier route? is there a tutorial page with hardware to purchase and downloadable code to compile into arduino?