0

Neopixel button problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neopixel button problem

by rhartl on Fri Dec 20, 2019 8:43 pm

I am using neopixels to light up a vacuum tube (think steampunk). Purchased the neopixel button and soldered one with an ordinary soldering iron. Connected in to pin 6 on a 16 mhz trinket pro using 470 ohm resistor. Powering with a bench power supply at 4.9 volts. Put a capacitor across the input. It has intermittently worked but now it is completely dead. Here is my code:

Code: Select all | TOGGLE FULL SIZE
 
#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        6 // On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 1 // 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);
void setup() {
  // put your setup code here, to run once:
    // 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)
  pixels.clear();
  pixels.show();
}
void loop() {
  // put your main code here, to run repeatedly:

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
 
    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.clear();
    pixels.setPixelColor(0, pixels.Color(0, 150, 0));
    pixels.show();   // Send the updated pixel colors to the hardware.
    delay(1000); // Pause before next pass through loop
     
     pixels.setPixelColor(0, pixels.Color(150, 150, 0));
    pixels.show();   // Send the updated pixel colors to the hardware.
    delay(1000); // Pause before next pass through loop
     
     pixels.setPixelColor(0, pixels.Color(255, 0, 0));
    pixels.show();   // Send the updated pixel colors to the hardware.
    delay(1000); // Pause before next pass through loop
     pixels.setPixelColor(0, pixels.Color(0, 255, 255));
    pixels.show();   // Send the updated pixel colors to the hardware.
    delay(1000); // Pause before next pass through loop 
}
 


Help...

rhartl
 
Posts: 80
Joined: Tue Jan 27, 2015 1:31 pm

Re: Neopixel button problem

by dastels on Fri Dec 20, 2019 10:28 pm

I see 2 potential problems.

1) and most likely the problem: 4.9v < 5.0v I assume you have that attached to Vbat? There's a 5v regulators on board that converts that voltage DOWN to 5v. I'm not really sure what will happen if you give it less than what it regulating down to. Likely nothing good.

2) Bench supplies can be rather noisy. Digital circuitry is rather sensitive to noisy power.

Dave

dastels
 
Posts: 1643
Joined: Tue Oct 20, 2015 3:22 pm

Re: Neopixel button problem

by rhartl on Sat Dec 21, 2019 7:02 pm

Did not know that, that there is a built in voltage regulator. So what is the voltage range the regulator will tolerate?

Also I have the control line connected to the Neopixel via an alligator clip wire. Spose that isn’t a good idea either.

rhartl
 
Posts: 80
Joined: Tue Jan 27, 2015 1:31 pm

Re: Neopixel button problem

by dastels on Sat Dec 21, 2019 7:41 pm

5-16v
Alligator clips are ok with a board made for them like the CircuitPlayground models or a Gemma: i.e. big holes with some space around them. Be very careful about them touching other connections/wires.

Dave

dastels
 
Posts: 1643
Joined: Tue Oct 20, 2015 3:22 pm

Re: Neopixel button problem

by caitlinsdad on Sun Dec 22, 2019 4:07 pm

Not really sure but the function call may not be right
Code: Select all | TOGGLE FULL SIZE
pixels.setPixelColor(0, pixels.Color(0, 255, 255));

should be
Code: Select all | TOGGLE FULL SIZE
pixels.setPixelColor(0, 0, 255, 255);


It is expecting the (pixelnumber, r, g, b) and the converted single color value may not be interpreted right. Arduino library may have difficulty with function in a function... Your neopixel could have lit up signaled from noise on powering up so that might be what you have seen previously. Good luck.

caitlinsdad
 
Posts: 587
Joined: Fri Feb 24, 2012 4:23 pm

Re: Neopixel button problem

by caitlinsdad on Sun Dec 22, 2019 4:27 pm

and be sure your power supply ground is connected to the board ground to establish common reference for the neopixel to work.

caitlinsdad
 
Posts: 587
Joined: Fri Feb 24, 2012 4:23 pm

Re: Neopixel button problem

by bcochran1 on Wed Dec 25, 2019 4:34 pm

rhartl wrote:Did not know that, that there is a built in voltage regulator. So what is the voltage range the regulator will tolerate?

Also I have the control line connected to the Neopixel via an alligator clip wire. Spose that isn’t a good idea either.

Hi,

There are two different versions of the Pro Trinket: 3v and 5v. These versions differ in clock speed as well. The clock speed matters when you select your board in the Arduino IDE "Boards" menu. You should visit the Introduction to the Pro Trinket tutorial and carefully read it. https://learn.adafruit.com/introducing-pro-trinket

As was mentioned -- it is not good to use a bench power supply for your project. Instead, use one of the 5 volt power supplies offered by Adafruit. Read the "Power Pins" section of the tutorial with care. As was also mentioned, try to keep your power and signal wires separated from each other. Do not let them touch. Read the "Neopixel Uber Guide" to get advice on powering your Neopixels.

The Trinket line is pretty old and there isn't much sense in sticking with it. The newer boards like ItsyBitsy M0 or M4, and the Feather line, have native USB and are much easier to work with. I suggest using those instead.

Thanks so much

Bob

Thanks so much

Bob


bcochran1
 
Posts: 449
Joined: Mon Jan 21, 2013 10:46 pm

Please be positive and constructive with your questions and comments.