Weird behavior with Neopixels

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RogerInHawaii
 
Posts: 65
Joined: Wed Oct 22, 2014 1:27 am

Weird behavior with Neopixels

Post by RogerInHawaii »

I'm just getting started with neopixels but I have succeeded in connecting one to my Arduino Uno and controlling it. But I found an odd behavior. If I do something like:

Code: Select all

    pixels.setPixelColor(0, pixels.Color(255, 75,13));
    pixels.show(); 
    delay(1000);
It works as expected, showing the specified color for the time period of a second. But if I send all the same intensity values to the pixel, as in this:

Code: Select all

    pixels.setPixelColor(0, pixels.Color(128, 128, 128));
    pixels.show(); 
    delay(1000);
in which I'm hoping to get a half-intensity white light, the neopixel flashes momentarily but then goes black for the time period.
If I change any of the values just a little bit, like using (128, 126, 124) then it works as expected, although not quite the color I would like.

I tried numerous other values and it seems that if you specify the SAME value for each of the Red, Green, Blue values, it merely FLASHES that color but does not stay at the specified intensity.

Is it supposed to do that? It seems very weird to me.

User avatar
hiduino
 
Posts: 862
Joined: Sat Sep 01, 2012 7:05 pm

Re: Weird behavior with Neopixels

Post by hiduino »

Sounds like a power problem. How many Neopixels are you trying to turn on? How are you powering the Neopixels?

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Weird behavior with Neopixels

Post by adafruit_support_bill »

Please post the complete code and more details about the rest of your setup. A photo might be helpful.

User avatar
RogerInHawaii
 
Posts: 65
Joined: Wed Oct 22, 2014 1:27 am

Re: Weird behavior with Neopixels

Post by RogerInHawaii »

hiduino wrote:Sounds like a power problem. How many Neopixels are you trying to turn on? How are you powering the Neopixels?
I'm only running a single neopixel and I'm doing it from the 5V line of the Arduino Uno. It works perfectly fine for all sorts of other colors. It's only when I send the exact same value for Red, Green, and Blue that I see the symptom, which is that it flashes momentarily but then turns off instead of staying at the specified intensity.

User avatar
davidl13
 
Posts: 187
Joined: Fri Oct 25, 2013 10:51 pm

Re: Weird behavior with Neopixels

Post by davidl13 »

Try a separate power source for the NeoPixel but make sure you have a common ground for both supplies (on the pixel side)! ;-)

It really would be helpful to see a diagram and pictures.

User avatar
RogerInHawaii
 
Posts: 65
Joined: Wed Oct 22, 2014 1:27 am

Re: Weird behavior with Neopixels

Post by RogerInHawaii »

davidl13 wrote:Try a separate power source for the NeoPixel but make sure you have a common ground for both supplies (on the pixel side)! ;-)

It really would be helpful to see a diagram and pictures.
I'm just running a single neopixel chip (WS2812B). +5 from the arduino goes to VDD on the pixel. Ground from the arduino goes to ground (VSS) on the pixel. Pin 6 from the arduino goes to DIN on the pixel. The DOUT of the pixel is not connected to anything.

I used the very basic example code that comes along with the neopixel drivers as the basis for my initial experimentation with the neopixel, being sure to set the "number of pixels" to 1 in the initialization.

I can successfully set individual colors. I can make it blink on and off in a loop with some delays. I was trying to make it "fade in" from black, through a series of grays, to full white (with a slight delay between updates) when I first encountered the strange behavior. It flashed instead of maintaining each value. After much experimentation I discovered that if I simply set the color to white, or ANY "color" value where each of the Red, Green, and Blue values are IDENTICAL, then it merely flashes the pixel instead of setting it and keeping it at the specified value. I then determined that if I change any one of the Red, Green or Blue values just a little bit, then it worked correctly, setting and keeping the values rather than flashing and turning off.

For example, I could set it to 255,255,255 and it would just flash momentarily. Or 128,128,128 would flash (although dimmer as expected) Or 10,10,10 would also flash. But if I set it to 128,128,124 it would turn on to the specified value and remain lit.

But why?

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: Weird behavior with Neopixels

Post by Franklin97355 »

Try sending this code

Code: Select all

    pixels.setPixelColor(0, 255, 255, 255));
    pixels.show(); 
    delay(1000);

User avatar
davidl13
 
Posts: 187
Joined: Fri Oct 25, 2013 10:51 pm

Re: Weird behavior with Neopixels

Post by davidl13 »

Try a 10k resistor between DIN and GND and 470 Ohm between your bitstream source and DIN.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Weird behavior with Neopixels

Post by pburgess »

Which type of NeoPixels are you using?

If it's the through-hole type (5mm or 8mm), try adding a small capacitor (0.1 uF) across the + and - legs as close as possible to the LED, see if that improves things.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”