Problem with NeoPixel Circuit - Page 1
Forum section: electronics / projects

author: CodyW
author_rank: Contributor
timestamp: May 23, 2017, 12:32:10 pm
content: Hi Everyone,This is a board I've designed for light painting, more specifically, spinning orbs –[Orb Example]I built the NeoPixel circuit up on a breadboard and used an Arduino Uno R3 to control it –[The circuit in action]. I replicated the circuit on my PCB, with the addition of a 5V LDO.I assembled the board today and it doesn't work. When I apply power the NeoPixels turn on as a bright blue. This shouldn't happen until I've pressed one of the buttons. The Arduino boot-loader and the code I'm using uploaded fine and I've double checked the pinouts for the pinouts are correct. I'm completely stumped. Does anyone know what could be causing the problem?Additional information: The micro is a ATMega328P-AU (U3) and the NeoPixels (U1) are in a four lead 5mm LED package. The top copper fill is the 5V supply and the bottom is the ground plane.Orb Tool SchematicOrb Tool Layout

author: Andy Watson
author_rank: Super Contributor
timestamp: May 23, 2017, 12:46:43 pm
content: Quote from: CodyW on May 23, 2017, 12:32:10 pmWhat steps have you taken to initialise the neo-pixels? I have found that most often they will power-up in totally off state, but there is no guarantee. They can and do power-up in any state. Try holding the data line low for at least the reset period of 50uS.

author: tszaboo
author_rank: Super Contributor
timestamp: May 23, 2017, 12:49:03 pm
content: I think it has something to do with your reset. Maybe your board does not have enought bypassing, the 328P will wake up later than the LEDs, lines are floating int meantime etc. Try adding a pulldown on the pin you are using for data.

author: ajb
author_rank: Super Contributor
timestamp: May 23, 2017, 03:28:12 pm
content: The atmega needs a pullup on the reset line and local bypass caps at each pair of power pins. I don't see any +5V connections to the micro, but I'm guess you're using the top side copper pour for that?

author: stj
author_rank: Super Contributor
timestamp: May 23, 2017, 05:57:33 pm
content: why did you ground the data output on the final led?i dont have the datasheet, but that just looks so wrong to me.

author: BrianHG
author_rank: Super Contributor
timestamp: May 23, 2017, 10:14:21 pm
content: Quote from: stj on May 23, 2017, 05:57:33 pmYes, that is wrong. You can damage the last Neopixel like that since that pin is an output.Also, R1 should be 10 ohms or less. You might be smearing the data driving the first Neopixel. Note that my Neopixel projects used no resistor and worked fine, but, they used a PIC as a microcontroler.

author: darrellg
author_rank: Unknown
timestamp: May 23, 2017, 10:55:18 pm
content: Quote from: BrianHG on May 23, 2017, 10:14:21 pmNot according to the Adafruit NeoPixel Überguide athttps://learn.adafruit.com/adafruit-neopixel-uberguide/basic-connections, which saysQuote

author: BrianHG
author_rank: Super Contributor
timestamp: May 23, 2017, 11:56:05 pm
content: Funny, where would these spikes come from. I've never seen spikes when I scoped the data lines.

author: CodyW
author_rank: Contributor
timestamp: May 25, 2017, 06:02:23 am
content: Thanks for the help, guys! I really appreciate it.I've cut the last data out pin on my board so it shouldn't be grounded. Thank you for pointing that error out. I can't recall why I did that.What pull up resistor value would you recommend for the reset pin? 1K?Quote from: ajb on May 23, 2017, 03:28:12 pmYup, I'm using the top copper pour for power and the bottom for ground.Quote from: Andy Watson on May 23, 2017, 12:46:43 pmThank you, Andy. I've added my code below so you can see how I initalise them. How could I hold data line low for 50us reset period? .Code://what is this bit doing?#include <Adafruit_NeoPixel.h>#ifdef __AVR__#include <avr/power.h>#endif// Which pin on the Arduino is connected to the NeoPixels?// On a Trinket or Gemma we suggest changing this to 1#define PIN 12// How many NeoPixels are attached to the Arduino?#define NumPixels 6// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NumPixels, PIN, NEO_GRB + NEO_KHZ800);const int BtnTrigger = 9;const int BtnColourMode = 10;const int BuzzerPin = 8;int BtnTriggerState = 0;int BtnColourModeState = 0;int LastBtnTriggerState = 0;int LastBtnColourModeState = 0;int colour;unsigned long timer = 0;uint32_t white = pixels.Color(100, 100, 100); // 0uint32_t magenta = pixels.Color(100, 0, 50); // 1uint32_t red = pixels.Color(100, 0, 0); // 2uint32_t orange = pixels.Color(100, 50, 0); // 3uint32_t yellow = pixels.Color(100, 100, 0); // 4uint32_t green = pixels.Color(0, 100, 0); // 5uint32_t cyan = pixels.Color(0, 100, 50); // 6uint32_t blue = pixels.Color(0, 0, 100); // 7uint32_t purple = pixels.Color(50, 0, 100); // 8uint32_t off = pixels.Color(0, 0, 0); // 9uint32_t colourMode = {off, white, magenta, red, orange, yellow, green, cyan, blue, purple};void setup(){pinMode(BtnTrigger, INPUT);pinMode(BtnColourMode, INPUT);pinMode(BuzzerPin, OUTPUT);pixels.begin(); // This initializes the NeoPixel library.}void buzzer(){digitalWrite(BuzzerPin, HIGH);delay(50);digitalWrite(BuzzerPin, LOW);}void trigger(){buzzer();delay(5000);for(int i = 0; i < NumPixels; i++){pixels.setPixelColor(i, colourMode);pixels.show(); // This sends the updated pixel color to the hardware.}delay(20000);for(int j = 0; j < NumPixels; j++){pixels.setPixelColor(j, colourMode);pixels.show(); // This sends the updated pixel color to the hardware.}}void colourSelect(){buzzer();if (colour < 9){colour++;for(int k = 0; k < NumPixels; k++){pixels.setPixelColor(k, colourMode);pixels.show(); // This sends the updated pixel color to the hardware.}}else {colour = 0;}delay(50); // Debounce}void loop(){int BtnTriggerState = digitalRead(BtnTrigger);int BtnColourModeState = digitalRead(BtnColourMode);if (BtnTriggerState != LastBtnTriggerState) {if (BtnTriggerState == HIGH) {timer = millis();colourSelect();}else if(timer >= 1000){//Millis wait a second after the button has been pressed//when the button is pressed, t_i= 0. Turn off after t_f = 1000msfor(int l = 0; l < NumPixels; l++){pixels.setPixelColor(l, colourMode);pixels.show();}}}if (BtnColourModeState != LastBtnColourModeState) {if (BtnColourModeState == HIGH) {trigger();}}delay(50); // DebounceLastBtnTriggerState = BtnTriggerState;LastBtnColourModeState = BtnColourModeState;}

author: Siwastaja
author_rank: Super Contributor
timestamp: May 25, 2017, 06:07:00 am
content: Quote from: BrianHG on May 23, 2017, 11:56:05 pmFrom parasitic LC circuit.See:https://www.eevblog.com/forum/projects/reducing-voltage-spike-on-transition/

author: CodyW
author_rank: Contributor
timestamp: May 26, 2017, 06:14:49 am
content: Bump.

author: CodyW
author_rank: Contributor
timestamp: May 28, 2017, 06:03:56 am
content: Last bump.

author: Helix70
author_rank: Unknown
timestamp: May 28, 2017, 06:20:16 am
content: Does it operate correctly despite starting out blue?

author: hamster_nz
author_rank: Super Contributor
timestamp: May 28, 2017, 07:37:29 am
content: Just on the schematic Is there a pulldown resistor as well as the series resistor for each switch? Or are you using a weak internal pulldown on the MCU pin?Looks like it might be floating to me....

author: CodyW
author_rank: Contributor
timestamp: May 28, 2017, 08:38:37 am
content: Thanks guys!Quote from: Helix70 on May 28, 2017, 06:20:16 amIt doesn't unfortunately.Interestingly though, I swapped out the 5050 SMD NeoPixels I use in my bread board prototype circuit, for the 5mm through hole variety that I'm using on my PCB and I get the blue, but after a button press everything operates as normal.Quote from: hamster_nz on May 28, 2017, 07:37:29 amI'm just using the the pull down. It seemed to work fine on my bread board prototype. Would it be better practice to use a series resistor between the MCU pin and the switch along with the pulldown?The only difference between my PCB and the bread board prototype is that I'm using and Arduino Uno R3 to control everything.

author: hamster_nz
author_rank: Super Contributor
timestamp: May 28, 2017, 08:46:51 am
content: Quote from: CodyW on May 28, 2017, 08:38:37 amIt might be working on the breadboard through luck - just to be sure, maybe bodge 10k between the far side of the R2 & R3 (by the switch) and ground? That way when the switch isn't pushed, it will see 10k+470 to ground, and when pushed it will see 470 to +5V.I would be more inclined to use the MCU's internal pullup, ("pinMode(x,INPUT_PULLUP)" in Arduino speak), and have the switch drag it down to ground.

author: Helix70
author_rank: Unknown
timestamp: May 28, 2017, 09:00:54 am
content: There is your clue. The uno has much better decoupling and probably handles the reset pin differently. Have a look at the uno schematic. In short, ceramic caps right next to the power pins, add an electrolytic reservoir on the 5v rail too, use a ground plane instead of thin traces for ground, and use appropriate pull up resistors for the reset. Your pcb isn't using smd neo pixels, are they on wire looms?

author: CodyW
author_rank: Contributor
timestamp: May 28, 2017, 02:45:06 pm
content: Thank you hamster_nz and Helix70!I'll drop the Arduino Uno and build up the full circuit on the bread board once I receive the breakout boards I've ordered and make the changes that you guys have suggested. Hopefully that solves the problem. Thank you!

author: CodyW
author_rank: Contributor
timestamp: June 11, 2017, 07:59:42 am
content: Hi Everyone,I've built the circuit up on the breadboard using a few breakout boards. I added a 10K pull up and a signal diode on the on the reset pin and withOn my breadboard, I am using the broken out 5050 NeoPixels by Adafruit instead of the through-hole 5mm variety.Before I added in the 5V voltage regulator , I powered the circuit from the Arduino and it works perfectly. I then swapped that over for the LDO which is on a breakout board and the NeoPixels turn on pink and flickered when the circuit is powered on and just stay like that (they should be off when power is applied and not flicker). I triple checked the connections, measured the output of the LDO and it's outputting 5V. I swapped out the LDO's output filter cap, C7 from 10uF to 2200uF (it's what I had) and it still shows pink on power up. The flickering stopped though.It seems like a power issue but apart from that I have no idea what's going on. Any ideas?CodyCurrent schematic:

author: stj
author_rank: Super Contributor
timestamp: June 11, 2017, 10:31:04 am
content: can you give me a link for 5mm neo-pixels please, i'v not seen them.

author: darrellg
author_rank: Unknown
timestamp: June 11, 2017, 03:19:05 pm
content: Quote from: CodyW on June 11, 2017, 07:59:42 amThe symptoms you describe sound like you don't have all the grounds connected together.

author: CodyW
author_rank: Contributor
timestamp: June 12, 2017, 06:27:22 am
content: Quote from: stj on June 11, 2017, 10:31:04 amHere we go, stj:https://www.adafruit.com/product/1938.There's also an 8mm version:https://www.adafruit.com/product/1734Quote from: darrellg on June 11, 2017, 03:19:05 pmThank you, darrellg!