SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By CircuitPeople
#125691
I have one of the "ding and dent" addressable RGB strips and an having issues getting it to function as I expect it should. I'm controlling it with a FEZ Domino, 3.3V logic (perhaps the issue) and using a secondary 5V power supply for the power lines on the strip.

The problem is that I can't get anything but the first LED to light up. I can change it's color at will, but no matter how may bits I clock in nothing seems to overflow to the second LED or any other than the first. Is there a common issue here I'm overlooking?

Code below:

var r = new Random();
var led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);

var data = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di0, true);
var clk = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di1, true);

var colors = new uint[32];
for (int i = 0; i < colors.Length; ++i)
colors = (uint)r.Next(0xFFFFFF);

while (true)
{
for (int i = 0; i < colors.Length; ++i)
{
uint color = colors;
uint mask = 1;
for (int b = 0; b < 24; ++b)
{
var bit = ((mask & color) == mask);
clk.Write(false);
data.Write(bit);
clk.Write(true);
mask = (mask << 1);
}
}
clk.Write(false);
Thread.Sleep(200);
By Liencouer
#125707
V_IH of the WS2801 is 0.8*VCC. 0.8*5V = 4V. That would be the first place to look. Also, I'm not certain what Thread.Sleep(200); does, but the WS2801 datasheet recommends clock be low for >500uS to latch the shift registers.

Also, the code tags are your friend.
Code: Select all
while (true)
{
    for (int i = 0; i < colors.Length; ++i)
    {
        uint color = colors[i];
        uint mask = 1;
        for (int b = 0; b < 24; ++b)
        {
            var bit = ((mask & color) == mask);
            clk.Write(false);
            data.Write(bit);
            clk.Write(true);
            mask = (mask << 1); 
        }
    }
    clk.Write(false);
    Thread.Sleep(200);
}
By CircuitPeople
#125718
Thanks for pointing out the logic level from the DataSheet, I missed that. Clearly a problem. In .Net Micro-land the Thread.Sleep(...) call is a delay in milliseconds, well longer than necessary just so my slow eyes could see what was going on...
Code: Select all
code.Tag.Apply(this);  // indeed :) 
By esklar81
#125724
CircuitPeople,

Here are a few thoughts off the top of my uninformed head:
  1. To what value are you initializing colors.Length?
  2. How, if at all, can you tell the difference between not reading a non-blank color assignment for an LED and failing to load the data to an LED. Put another way, if you load "0" as the color to the LED, won't that look just like not having loaded any color to it?
  3. What do you believe the dimension(s) of "colors" is/are? You appear to be initializing it as an unsigned integer, but using it as if it were an array. I don't know what your compiler is going to do if you initialize something as an integer and try to write to it and read from it as if it were an array, but it wouldn't surprise me if the first element of the "array" were written and read as the values of the variable, but that reads and writes to subsequent elements of the "array" were potentially damaging and random events, respectively.

Happy Hunting,
Eric
By CircuitPeople
#125942
A quick update: I think the LED strip is a little more "dinged" than just the cracks in the waterproofing. I'm using 3.3V to 5V logic conversion, very carefully checking connections, etc. and there is still no action on any of the LEDs other than the first. I altered the code to simply clock 768 "ones" down the strip, then set the clock low. Is there any sort of termination required for this strip? Someone with the strip working want to walk me through their setup?
By dext3r
#125975
just throwing this out there...what happens if you tie the data line "high" and run the clock....??

(i have a couple of the 'ding and dent' strips and hooked up to an arduino pro (5V) and they seem to work OK. i tried to chain two together to make a strip of 64, but only the first 32 light up correctly. if i tie the data high though, all 64 light up white. so they work, i just need to figure out why the data signal isnt passing thru correctly)