SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the LEDs and Illumination category should be posted in this forum.
#207428
After soldering together the lumenati parts, I used the s/w provided in the Hookup guide - and got unexpected results. All LEDs flashed, but not in the pattern shown in the guide's example. Trying to reduce the activity, I modified the s/w as follows below and noted that some LEDs stayed on when not supposed to, while others never, or rarely, went on.

In general, I am looking for guidance on how best to troubleshoot this problem. My goal is to enable the following s/w to work correctly, so I can use the lumenati as a flash for my RPi camera.

Any suggestions you can provide would be of value. I have access to a multi-meter and [very old] o-scope. My h/w is currently soldered together (I suppose that was a mistake, given my predicament). I can un-solder if needed; I also have a breadboard.

Hardware Details:

I have connected 4 lumenati 90R segments into a ring, cutting the co/ci do/di traces as required between the first and last segments (and verified using ohm meter). I followed the wiring diagram as presented in the Lumenati Hookup guide for RPi, with two exceptions -
1. I used the BOB-12009 (Logic Level Converter - Bi-Directional) instead of the BOB-15439 (Level Translator Breakout - PCA9306) - my understanding was that these were equivalent for this application.
2. I powered my lumenati ring directly from my RPi Zw's 2.5A power supply, as it should be able to provide more than enough current for both Zw and LEDs - using one of the 5V GPIO pins.

Code Used:
SFE_Lumenati.py (modified from Hookup guide):
Moderator edit to add code formatting.
Code: Select all
#Set up the SPI port on the Pi
import spidev
spi = spidev.SpiDev()
spi.open(0,0)

#Create LED array by sending this function num_LEDs
def set_LED_quantity(num_LEDs):
    global NUM_LEDs
    NUM_LEDs = num_LEDs
    global LED_array
    LED_array = [[0,0,0,0]] * NUM_LEDs

#Puts LED(num) parameters into LED_array
#Red, Green and Blue (r,g,b) values must be between
#0-255. Brightness must be between 0 and 31.
def set_LED(num, r, g, b, brightness):
    if (brightness > 31) | (brightness < 0):
        brightness = 15
    if (r > 255) | (r < 0):
        r = 100
    if (g > 255) | (g < 0):
        g = 100
    if (b > 255) | (b < 0):
        b = 100
    
    if (num < NUM_LEDs): 
        print "num, r, g, b:", num, r, g, b
        LED_array[num] = [r, g, b, brightness | 0xE0]

#These 4 bytes have to be written at the start and
#end of each data frame when writing to the LEDs
def _start_end_frame():
    for x in range (4):
            spi.xfer2([0x00])

#Write data to the LEDs
def WriteLEDs():
    _start_end_frame()
    for LED in LED_array:
        r, g, b, brightness = LED
        spi.xfer2([brightness])
        spi.xfer2([b])
        spi.xfer2([g])
        spi.xfer2([r])
        
    _start_end_frame()

#set LED array to 'off'
# if 'write' is true, write values to LEDs
def OffLEDs(write):
    for LED in range (NUM_LEDs):
        set_LED(LED, 0, 0, 0, 0)
    
    if (write):
        WriteLEDs()

Lumenati_demo.py (modified from Hookup guide):
#This is demonstration code for the Lumenati line of APA102c boards,
#specifically using (4) 90L boards surrounding one 8-pack board.

import time

from SFE_Lumenati import set_LED_quantity, WriteLEDs, set_LED, OffLEDs

#Set up array, 12 LEDs for a 90L x 4 config
set_LED_quantity(12)

#Delay duration
#wait = 0.15
wait = 0.5
longWait = 1

#Global brightness
brightness = 5 #range is 0-31

OffLEDs(1)
time.sleep(wait)

spacing = {
        2: [0, 6],
        3: [0, 4, 8],
        4: [0, 3, 6, 9],
        6: [0, 2, 4, 6, 8, 10],
        8: [0, 1, 3, 4, 6, 7, 9, 10]
}


try:
    #while True:

        for x in (2, 3, 4, 6, 8):
            print "spacing:", x

            for y in spacing[x]:

                print "y:", y
                # one LED: white
                set_LED(y,255,255,255,brightness)

                WriteLEDs()
                time.sleep(wait)

            #time.sleep(longWait)
            raw_input("Press Enter to continue ...")
            OffLEDs(1)

        #for i in range (5):
        #    OffLEDs(1)
        #    time.sleep(wait)

except KeyboardInterrupt:
    pass
#207469
Hi bobkster,

Sorry to hear you are having issues with some of the LEDs in your Lumenati boards. It sounds like it may be an issue with the software here but just to get a better idea of the issue, are the LEDs that are not working as expected consistently not working (eg. LED #3 is never turning on regardless of the command sent to it) or are they varying? Also, to eliminate any hardware issues, can you please take a few photos of your boards and the circuit they are in? Also, if you can try and show the LED behavior in a photo or short video, that would be helpful.

Another thing to try (assuming you have an Arduino to test with) is to use the FastLED Library and see if you can replicate the error as that would indicate the problem is with the LEDs on the Lumenati or if they work as expected, it would point to an issue with your modified code.