Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Addressable RGB 30-LED Strip, 5V, 1m


#1

I have on addressable RGB strip and connect it to arduino. I am sure the connect is correct but when i use the sample code to test for the strip. The LED just be lighted. (maybe white light) When I try to change the color by input (100,100,0!), it didn’t have any change. Could anyone have same exprience?


#2

Hi.

I am sorry you are having problems with your LED strip. What Arduino you are using? Can you post some pictures of your setup that include all connections? Also, please post the code you are having trouble with.

-Derrill


#3

hi,
I uploaded the code which i use and the pictures. I really need the help since the project is behind the schedule. Thanks.
Jackie



LedStripGradient.ino (901 Bytes)


#4

submit other picture



#5

Hi, Jackie.

I tested the code you posted and the standard wiring from our website, and it worked just fine. However, when I disconnected the Arduino’s power, the LEDs froze in a pattern much like your picture. I suspect the problem is with your connections. I could not see the actual connections to your LED strip, only wires coming in from the edge of the picture you posted. Also, please just run the basic example code without any additions until you get it working. The “Serial.println” function does not work without a “Serial.begin” in any case.

-Derrill


#6

I tried it on Arduino UNO and pro mini both again by your sample code without any change. The LED only be turned on but the color CANNOT be changed.
When I touch the signal pin directly (ground pin is floating.), the LEDs color will be changed randomly. That means the connection is correct. Are you sure this strip is support for arduino?

[code]#include <PololuLedStrip.h>

// Create an ledStrip object on pin 12.
PololuLedStrip<12> ledStrip;

// Create a buffer for holding 60 colors. Takes 180 bytes.
#define LED_COUNT 60
rgb_color colors[LED_COUNT];

void setup()
{
}

void loop()
{
// Update the colors.
byte time = millis() >> 2;
for(byte i = 0; i < LED_COUNT; i++)
{
byte x = time - 8*i;
colors[i] = (rgb_color){ x, 255 - x, x };
}

// Write the colors to the LED strip.
ledStrip.write(colors, LED_COUNT);

delay(10);
}[/code]







#7

This is not a valid way to verify the correctness of your connections. Can you remove the tape from your LED strip connector and post a close-up picture of that so we can make sure you have things connected right?

Yes, this strip works with the Arduino when properly connected. The following forum post has another example Arduino LED strip sketch. Can you try that and tell us exactly what happens?

- Ben


#8

Hello,

I have the exact same problem here.

I received my Pololu Addressable RGB 30-LED Strip, 5V, 1m, but I really can’t make it work.

I’m plugin it to a Arduino UNO board, just like in the website picture (except i plug it into pin 12, not 7)

I tried both of given examples : the LEDs are ON but in white only (i cannot change the color)

Note : if i unplug the strip, plug it back, and change the number of leds i want to display (ie : 5 instead of 30), the first 5 leds are ON (but white), and the rest of the leds stay OFF.

I use Arduino UNO R2
My version of arduino is : 1.0.5

Here is the code i use :

[code]#include <PololuLedStrip.h>

// Create an ledStrip object on pin 12.
PololuLedStrip<12> ledStrip;

#define LED_COUNT 5
rgb_color colors[LED_COUNT];

void setup()
{
//
}

void loop()
{
colors[0] = (rgb_color){ 255, 0, 0 };
colors[1] = (rgb_color){ 0, 100, 0 };
colors[2] = (rgb_color){ 0, 0, 50 };
colors[3] = (rgb_color){ 0, 0, 0 };
colors[4] = (rgb_color){ 0, 255, 255 };

ledStrip.write(colors, LED_COUNT);

// Result : the 5 first LEDs are ON, but they’re all white

delay(10);
}[/code]

Any help ?

Thank you very much,


#9

Update : I’ve just been to my office to try on a Arduino Leonardo : i’ve got the exact same results.

I’m quite stuck. Any help would be appreciated :slight_smile:


#10

Hello.

I ran your code on an Arduino Uno R3 without any modifications and it worked perfectly. I suspect your issue is connection based. Can you post some pictures of your setup including all connections?

-Derrill


#11

hello Derrill,

Thank you for your reply.

I’ve soldered the connecting wires - yellow for the ground, white for the signal. Here is a picture :

Any idea ? Thanks again.


#12

Can you use a multimeter to verify that you are connecting the correct pin from the LED strip to ground on your Arduino? You can do a continuity test by touching one lead of the multimeter to the outside of the DC power plug barrel (the negative connection) and the other to the pins you have your leads soldered to on the strip.

-Derrill


#13

yes i’ve checked it : i am connecting the right pin to the ground - i used a multimeter to double check it, as you said.


#14

hey back,

i’ve tried to make it work this weekend… No success. Any tip ? I’m quite hopeless :frowning:

Thanks,


#15

Hello.

I am sorry your are having trouble with the LED strip. Is there some reason you want to use pin 12 instead of pin 7? Until you have things working, I would encourage you to try the examples without modifying them and use pin 7. Could you try the LedStripGradient example that comes with PololuLedStrip Arduino library, and move the white wire to pin 7, and see how that behaves?

What happens if you change LED_COUNT in LedStripGradient example from 60 to 10? How many LEDs are lit and what color are they?

If you are still seeing all white, then maybe the drivers in this LED strip have a lower threshold than we would expect for detecting the difference between 0 bits and 1 bits, resulting in every bit being read as a 1. I can help you modify the Arduino library to send shorter pulses and that might solve the problem.

–David


#16

Thank you very much for your reply. I live in France (so it’s the night here), but I’m ready to stay awake a bit longer if that can help me solve this !

In the examples I’ve downloaded from the website, the pin 12 is always used. I tried on pin 7 and several others : exact same results.

Now, if I change the LED_COUNT to 10, 10 leds will be ON, but white.

Note: here are some other tests I’ve made, based on the exact “LedStripGradient” example (just changing the LED_COUNT.

setup led_count to 10 ; upload : 10 leds are lit.
change let count to 15 ; upload : 15 leds are lit.
change led count to 10 ; upload : 15 leds are still lit
unplug “signal” cable : 15 leds are still lit
plug it back : still the same
unplug “power” cable : all leds off
plug it back : 10 leds are lit

maybe that can help ? I’m here to do any test you’d like me to do.

Thanks again,


#17

David,

Note that if you wish to help me modify the library to test shorter pulses, i am right now in front off PololuLedStrip.h, waiting for your call to mess things up :slight_smile:

Edit : i didn’t wait for your call, and tried to change the “delayMicroseconds(24); // Hold the line low for 24 microseconds to send the reset signal.” line

I’ve tried 2, 12, 24 and 48 ms : nothing changes.

Thanks,


#18

Sorry, you were right about the pins.

I wouldn’t change the delayMicroseconds line. Instead, we should try shortening the length of the pulse that represents a 0. To do that, you can find the line in PololuLedStrip.h that says:

That should be line 281.

Above and below that line you will see the code for some NOPs. A NOP is a simple instruction that takes 1 cycle and does No Operation; it is useful for adding delays to code. When looking at the NOPs, you also need to pay attention to the #ifdefs around them.

Let’s look at the code just above line 281:

#if F_CPU == 16000000
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n"
#elif F_CPU == 20000000
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
#else
#error "Unsupported F_CPU"
#endif

This code means that if the CPU is 16 MHz, we should do 7 NOPs, and if the CPU is 20 MHz, we should do 10 NOPs. Since the Arduino UNO and Leonardo both run at 16 MHz, you should only pay attention to the code between the #if and #elif.

Since the pulses seem to be too long, we should make them shorter by moving some NOPs from above line 281 to below. For example, if you moved 4 NOPs, then lines 271 through 289 would become:

#if F_CPU == 16000000
        "nop\n" "nop\n" "nop\n"   // removed 4 NOPs from here to shorten the 0 bits
#elif F_CPU == 20000000
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
#else
#error "Unsupported F_CPU"
#endif

        "brcs .+2\n" "cbi %2, %3\n"              // If the bit to send is 0, drive the line low now.    

#if F_CPU == 16000000
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n"   // added 4 NOPs here to keep the 1 bits the same length
#elif F_CPU == 20000000
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
        "nop\n" "nop\n" "nop\n" "nop\n" "nop\n"
#endif

Does this make sense? Could you try replacing lines 271 through 289 with the code above and see how it behaves? Also, please set LED_COUNT at 10 and use PololuLedStripGradient while you are doing this experiment. It might take a few tries to get things right. If you see 10 white LEDs, then I think you haven’t transferred enough NOPs. If you see about 5 white LEDs, then I think you transferred too many NOPs and the 0 bits are not being registered at all. If you continue to have trouble, please send me the modified PololuLedStrip.h you are using.

–David


#19

… Bam ! Works like a charm.

Both LedStripColorTester and Gradient works, with LED_COUNT set to everything I want.

Thanks a lot !

I hope this post will help other people like me.

Why do you think I had to change the pulse ?

Thanks again,


#20

I am glad it worked for you! As I suggested before, maybe the drivers in this LED strip have a lower threshold than we would expect for detecting the difference between 0 and 1. Alternatively, your Arduino might be running slower than expected (16 MHz); but that is unlikely since you did try two Arduinos. I thought that I built enough tolerance into the Arduino library when I made it, but it is possible our supplier might have changed something about the LED strip. We will look into it more.

–David