0

12mm LED pixels random flickering
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 1:15 pm

Hello there!
I have a little issue with my led strip. I used the tutorial for the assembly, and I connected the led strip to a raspberry pi 3 a+.
When I run my script more than once, some led flickers in random time with random color. Sometimes its stops at LED nr 8 (or any other) (I use a 25pieces led strip) and doesn't change.
I checked the cables 3 times, I measured them with multimeter, I have the right adapter and everything.
I'm a beginner in programming, so if you can help me a bit, I would be very grateful.

Here is my code:
Code: Select all | TOGGLE FULL SIZE
import time
import random
import board
import adafruit_ws2801

i=0

odata = board.D5
oclock = board.D6
numleds = 25
bright = 1
leds = adafruit_ws2801.WS2801(
    oclock, odata, numleds, brightness=bright, auto_write=False
)
leds[0]=0xff0000
leds.show()
time.sleep(0.2)
for i in range(24):
    leds[i+1] = 0xff0000

    my_color = leds[0] # Returns (255, 0, 0)
     
    my_colors = leds[0:24] # Returns [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
    leds.show()
    time.sleep(0.2)
    leds.fill((0,0,0))
    leds.show()
    time.sleep(0.2)

leds.fill((0,0,0))
leds.show()
Last edited by Twisteduser on Mon Oct 26, 2020 2:11 pm, edited 1 time in total.

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 1:31 pm

Just to make sure what you have, is it one of these?
https://www.adafruit.com/product/738
https://www.adafruit.com/product/322

And you are following this guide?
https://learn.adafruit.com/12mm-led-pixels

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 1:38 pm

Yes, exactly.
I use the flat type LED.

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 1:49 pm

Ok, try running this simple example and report back what happens:
Code: Select all | TOGGLE FULL SIZE
import board
import adafruit_ws2801

odata = board.D5
oclock = board.D6
numleds = 25
bright = 1

leds = adafruit_ws2801.WS2801(oclock, odata, numleds, brightness=bright, auto_write=False)

leds.fill((255, 0, 0))
leds.show()

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 1:58 pm

1st try: the first 8 led turns green, others doesn't turned on.
2nd try: all the leds turns red.

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 2:01 pm

OK, let's check the hardware. Can you post a photo of your setup showing how everything is connected.

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 2:09 pm

Now I'm using the factory adapter for the raspberry pi.
Attachments
kép_2020-10-26_185642.png
kép_2020-10-26_185642.png (709.11 KiB) Viewed 111 times

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 2:18 pm

Thanks. And how are the jumper wires being connected to the LED strip?

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 2:27 pm

I used the same wiring colors as in the tutorial. (I soldered the cables)
Red: 5V
Blue: GND
Green: D6
Yellow: D5

(sorry for my bad english, this is not my native language, but i try to give you every parameters to figure out whats the problem in my setup)
Attachments
kép_2020-10-26_191517.png
kép_2020-10-26_191517.png (458.44 KiB) Viewed 110 times

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 2:36 pm

Are you connected to the IN side of the strip? Here is how to check:
https://learn.adafruit.com/assets/1022

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 2:44 pm

Yes, it is in the right direction.
Btw, is my code (what I posted earlyer) OK?

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 2:48 pm

We can take a look at your code once we verify the hardware is OK.

It may be power related. Let's try using just the first pixel. Try running this:
Code: Select all | TOGGLE FULL SIZE
import board
import adafruit_ws2801

odata = board.D5
oclock = board.D6
numleds = 1
bright = 1

leds = adafruit_ws2801.WS2801(oclock, odata, numleds, brightness=bright, auto_write=False)

leds.fill((255, 0, 0))
leds.show()

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 2:52 pm

First led OK. It's red.
Should I increase the numleds with +1, step by step and try all the leds till 25?

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Re: 12mm LED pixels random flickering

by adafruit_support_carter on Mon Oct 26, 2020 2:53 pm

First let's try other colors. Change this line to:
Code: Select all | TOGGLE FULL SIZE
leds.fill((0, 255, 0))

and see if you get GREEN.

And then change it to:
Code: Select all | TOGGLE FULL SIZE
leds.fill((0, 0, 255))

and see if you get BLUE.

adafruit_support_carter
 
Posts: 18190
Joined: Tue Nov 29, 2016 2:45 pm

Re: 12mm LED pixels random flickering

by Twisteduser on Mon Oct 26, 2020 2:58 pm

Colors are OK.

Twisteduser
 
Posts: 17
Joined: Mon Oct 26, 2020 1:02 pm

Please be positive and constructive with your questions and comments.