0

Controllin WS2801
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Controllin WS2801

by alwa123 on Sun Feb 02, 2020 8:21 am

Hi there,

i controll LEDs ws2801 with an ft232h with Circuit Python. Here is the code i use:

Code: Select all | TOGGLE FULL SIZE
#!/bin/python3
import sys
import time
import board
import adafruit_ws2801

numleds = 92
red   = int(sys.argv[1])
green = int(sys.argv[2])
blue  = int(sys.argv[3])

leds = adafruit_ws2801.WS2801(board.SCK, board.MOSI, numleds, brightness=1.0, auto_write=False)
leds.fill((red, blue, green))
leds.show()
print("LED Input R=" + str(red) + " G=" + str(green) + " B=" + str(blue))


Everything works fine so far. But when i tell the leds to be black (0, 0, 0), i cant turn them on againe, they remain black. If i take the power off the leds for some time it works again. Anyone knows what is wrong with my code? Thanks

alwa123
 
Posts: 3
Joined: Sun Nov 03, 2019 4:58 am

Re: Controllin WS2801

by siddacious on Mon Feb 10, 2020 10:30 pm

Can you post a picture that shows how you have connected the WS2801 LEDs? Please make sure the picture has good light and is in focus and you can see all of the connections

siddacious
 
Posts: 202
Joined: Fri Apr 21, 2017 3:09 pm

Re: Controllin WS2801

by alwa123 on Thu Feb 13, 2020 3:31 pm

Hi there,

thanks for the reply, here are some photos, hope i uploded them corretly. I think with the cable everything is fine. I can controll the LEDs, put every color i want even play some effekts like a rainbow effekt. Just when i sent the command 0,0,0 i cant bring them back to life with the showed code, like they store the information of the brightness.

When i blast the LEDs with the showed code below, after some time some of the leds come back and after another while all come back. The time it takes changes and is not always the same. Sometimes half an minute, but sometimes they even dont come back after 5 min. Or when i unplug the power from the LEDs for about 15 min it works again. Here is the code for the random colors that can bring them back sometimes:

Code: Select all | TOGGLE FULL SIZE
#!/bin/python3
import time
import random
import board
import adafruit_ws2801

### Example for a GEMMA M0 driving 50 12mm leds
oclock = board.SCK
odata = board.MOSI
numleds = 92
bright = 1.0
leds = adafruit_ws2801.WS2801(oclock, odata, numleds, brightness=bright, auto_write=False)

######################### HELPERS ##############################

# a random color 0 -> 224
def random_color():
    return random.randrange(0, 7) * 32

######################### MAIN LOOP ##############################
n_leds = len(leds)
while True:
    #fill each led with a random color
    for idx in range(n_leds):
        leds[idx] = (random_color(), random_color(), random_color())

    # show all leds in led string
    leds.show()

    time.sleep(.25)
Attachments
IMG_20200212_203239-min-min.jpg
IMG_20200212_203239-min-min.jpg (935.58 KiB) Viewed 21 times
IMG_20200212_203303-min.jpg
IMG_20200212_203303-min.jpg (703.64 KiB) Viewed 21 times
IMG_20200212_203252-min.jpg
IMG_20200212_203252-min.jpg (776.97 KiB) Viewed 21 times

alwa123
 
Posts: 3
Joined: Sun Nov 03, 2019 4:58 am

Please be positive and constructive with your questions and comments.