NeoPixels gradually changing color!

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
APSIProps
 
Posts: 83
Joined: Mon Oct 10, 2022 1:52 pm

NeoPixels gradually changing color!

Post by APSIProps »

Hello!

I have a Trinket M0, an ultra skinny neopixel strip cut to 38 LEDs, and a dual coin cell battery holder all wired up and coded. The code simply makes the LED strip light blue when the unit is powered on. However, I am experiencing an issue where the lights change from blue after being turned on for a few seconds. It will fade to green then yellow then orange, etc. Why could this be happening? I know it’s not dead batteries as I’ve replaced them many times. Thanks in advance.

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

Re: NeoPixels gradually changing color!

Post by adafruit_support_bill »

Please post the code that you are using.

User avatar
APSIProps
 
Posts: 83
Joined: Mon Oct 10, 2022 1:52 pm

Re: NeoPixels gradually changing color!

Post by APSIProps »

Here is the code! We were able to get a temporary fix by setting the RGB values to (0, 0, 255) instead of the one shown in the code below. However, I still need to figure out why this issue is occurring. Could it be a voltage or current issue?

Code: Select all

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        0 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 38 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  for(int i=0; i<NUMPIXELS; i++) { // For each pixel...

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(5, 37, 255));

    pixels.show();   // Send the updated pixel colors to the hardware.

  }
}

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

Re: NeoPixels gradually changing color!

Post by adafruit_support_bill »

neopixel strip cut to 38 LEDs, and a dual coin cell battery holder
Coin cells do not have much capacity or current delivering capability. As they quickly drain, the output voltage will drop. And the first LEDs to start dimming will be the blue ones - because they have the highest forward voltage.

The last to dim will be the red leds which have the lowest forward voltage. So the color balance will shift over time toward those lower voltage LED colors.

User avatar
APSIProps
 
Posts: 83
Joined: Mon Oct 10, 2022 1:52 pm

Re: NeoPixels gradually changing color!

Post by APSIProps »

That's what we thought but we hooked everything up to a power supply set at the correct voltage. They keep fading colors. The only thing that stopped the fading/changing colors was changing the RGB value from (5, 37, 255) to (0, 0, 255). When we did that, the color change no longer occurred.

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

Re: NeoPixels gradually changing color!

Post by adafruit_support_bill »

we hooked everything up to a power supply set at the correct voltage.
What power supply did you hook it up to? Pixels need more than 'voltage'. They need current too.

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

Return to “Trinket ATTiny, Trinket M0”