WS2812B Wrong colors

Hi!

I am making a project from instructable Arduino Powered Headdress

Most of the LEDs are not producing the expecting colors. On the picture attached, all LEDs should be green.

There are 88 LEDs : 2 strips of 11 (the eyes), and 1 strip of 66 (the dome)

Only the eyes and 5 groups of 2 in the front are consistently correct, all other ones are consistently the wrong colors. Since the issue is with the same LEDs with different programs, I concluded that it was a hardware problem, so I swapped a "correct" one with a "wrong" one, and the issue is at the same place, meaning that the LED or the wiring is probably not at fault Only with 100% white I can get all LEDs the same color.

  • I use a mix of those two products: Amazon and Amazon

  • The board is a Arduino pro mini atmega328 p 5V

  • Schematics: |500x267

  • The code (error is the same with all the other codes)

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

#include 
#ifdef __AVR__
  #include 
#endif

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

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      88

// When we setup 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 = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 10; // delay for half a second

void setup() {
  
  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() {

  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

  for(int i=0;i

The instructable mentions: According to the Neopixel online guide it specifies 1000uF capacitors on the live and ground lines and a 300-ohm resistor on the signal lines, I have omitted these in my build by mistake, it has not affected the lights in any way but you may want to add them to be sure on your build. Can it be the issue?

Any help appreciated!

IMG_20171202_230654.jpg|2016x1512

Measure the voltage to the strips and controller. What do you get?

The series 330Ω resistor and the 1000μF capacitor is to protect the neopixels strips from damage.

.

I get 5.7V at the controller, 5.5V at the beginning of the main dome strip, and 5.1V at the middle.

it has not affected the lights in any way

Not only is he a normal idiot that many Instructables authors are, he is arrogant as well. Of course it has affected his lights, it is just that he is too stupid to do the tests that show this and probably hasn't got the equipment nor skill to use it.

This shows what the waveform looks like with and without the resistor. See those spikes? Each one is punching a tiny hole in the oxide layer of the LED controller and eventually it will fail.

|500x194

Their is a lot more to electronics than something appearing to work, that is why we put out good advice only for idiots to think it dosn't matter.

By the way your colour problem has its roots in the fact that some strips need RGB colour order and others need GRB colour order. It looks like the code and your hardware do not match, normally you just need to change your code so they do. But this idiot has wired all three strips to the same pin, so you will have to wire each strip to a different pin and then write the code to output to each strip holding a different pattern ( RGB or GBR ) to suit the hardware you have. He should have done that in the first place so the colours would be more flexible.

Nice photo by the way.

adding resistor to ws2812 drive.png|1462x568

Thanks for replying Grumpy Mike,

I think your comment is harsh: he has generously shared his build, and specified that he was not a arduino specialist. He is certainly not arrogant, and calling him an idiot is not very nice.

Thanks for explaining why the resistors are necessary, I'll add them.

I think the RGB / GBR is not the issue here: I use 2 different kind of LED, since the color in the program is 0,150,0 I should have Green and Blue lights. instead I get red, white blue and more on both types of LEDs.

Can it be that the data is corrupted because of the lack of resistor / capacitor?

Do not omit the capacitor!

It absorbs power spikes on power up (without it, you may see LEDs flicker when turned on, causing damage).

Colours could be affected without these if you have damaged the pixels without using them.

Show us a good image of your wiring.

.

Thanks Larryd!

I’ll add the resistors and capacitors asap.

I don’t think the color issue is due to damaged LEDs since I swapped the 1st and the 2nd ones on the main main dome strip and colors are wrong the same way: it’s position-related.

I can’t really give a better image of the wiring: it’s crammed in a box. What do you need to know that is not on the drawing in the first post?

Often we find out, too late, that things are not wired as in a schematic.

Did you try the things mentioned by Mike?

.

Often we find out, too late, that things are not wired as in a schematic.

Fair enough! It will be difficult to check, but we are making a second helmet, we will see if we have the same issue.

Did you try the things mentioned by Mike?

He mentioned the capacitor and resistor, which I will do as soon as I receive it and using both RGB and BRG LEDs, which can't be the issue.

Can it be that the data is corrupted because of the lack of resistor / capacitor?

No. It is because of what I said in reply #3 in the next but last paragraph.

he has generously shared his build, and specified that he was not a arduino specialist.

So getting you to build crap is OK because he said he was not a specialist. In my book it is arrogance to even think he can tell anyone how to build any electronics when he knows so little. If he had any decency he would have asked here about his circuit first.

Did you know you need a resistor for each of your LED strips, not one for all three?

3615gregoire: I get 5.7V at the controller, 5.5V at the beginning of the main dome strip, and 5.1V at the middle.

5.7 volts is too high at the controller power pin.

Did you know you need a resistor for each of your LED strips, not one for all three?

Yes, thank you!

It is because of what I said in reply #3 in the next but last paragraph.

The RGB / GBR difference between the 2 kind of LEDs? Then how come I get different colors on BOTH types of LEDs? The only color in the code is 0,150,0, and for both kind of LEDs, I get some green, some blue, some red and some white.

If it was the issue, one kind of LED would be green, the other one blue, or am I missing something? (which could very well be).

5.7 volts is too high at the controller power pin.

Thanks, I changed the setting on the buck converter to have 5V.

Ok then strip it back, just try a code that simply fills one strip with the same colour, green will do. Post that code so we can look at it. And say what number led gives what colour.

Are you using a real Arduino Pro Mini or is it a ripoff clone?

Ok then strip it back, just try a code that simply fills one strip with the same colour, green will do. Post that code so we can look at it. And say what number led gives what colour.

I have tried on my girlfriend's helmet, which is the a similar build, and we have temporarily connected only the main dome, so 1 strip, 1 color (0,150,0) in the program, and we also get multiple colors displayed.

On my helmet: Strip 1 (eye): 11 LEDs, all green Strip 2 (eye): 11 LEDs, all green Strip 3 (main dome) 66 LEDs: LED: Color: 0 White 1 Blue 2 Red 3 White 4 Blue 5 Red 6 Green 7 Green 8 Green 9 Green 10 Green 11 Green 12 Green 13 Green 14 Green 15 Green 16 White 17 Blue 18 red 19 White 20 Blue 21 red 22 white 23 blue 24 red 25 white 26 blue 27 red 28 white 29 blue 30 red 31 white 32 blue 33 red 34 white 35 blue 36 red 37 white 38 blue 39 blue 40 white 41 blue 42 red 43 white 44 blue 45 red 46 white 47 blue 48 blue 49 blue 50 blue 51 blue 52 blue 53 blue 54 blue 55 blue 56 blue 57 blue 58 blue 59 blue 60 blue 61 red 62 red 63 red 64 red 65 white

Code is still the simple one, with only one color (other codes tried give unexpected colors, with only 6 to 15 being right):

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

#include 
#ifdef __AVR__
  #include 
#endif

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

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      88

// When we setup 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 = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 10; // delay for half a second

void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  // End of trinket special code

  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() {

  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

  for(int i=0;i

Are you using a real Arduino Pro Mini or is it a ripoff clone?

I use generic ones, I have tried with two makes with the same results: This one and this one.

Thank you for the help!

Thanks for that. Yes those two boards are fakes so their might be a quality issue here.

Can you do some tests for me as I have not got your system? With only the long strip connected reduce the green value from 150 down to 8. Now disconnect the wire from your boost converter to the 5V line of the Micro and power it from the USB socket of your computer, does it show all green now?

Thank for your continued help Mike.

As suggested, I have: - Disconnected the eyes strips - Added a capacitor on the power to the LEDs strip - Added a resistor on the Data cable - Disconnected the power cables from the converter - Changed the program for color: 0,8,0 - Power the system from USB

The color sequence is the same as before, at least for the 15 first LEDs (I haven't checked them further one by one).

We have done the same on my girlfriend's helmet, she as also a string of different colors. We use 2 different makes of the Mini Pro.

I'll be away from home for a week, but if you have more suggestions, I'll be happy to try more.

We use 2 different makes of the Mini Pro.

Are any of these real or are they both ripoffs?

Do you have any other sorts of Arduino you can try?

They are both not original. I can't seem to find an original for sale online since it has been been discontinued.

I'm going to try to simplify further: reduce the length of the cable, maybe also the length of the strip.

Well I set up a Pro Micro and ran your code in reply #14. This is what I got.

|500x375 So I am not seeing the same issue as you.

If I have got this right then with two strips connected, a short one and a long one, both on the same pin. Are you getting all 11 of the short strip green but the first 11 ( at least ) of the long strip different colours? That seems to suggest you have a problem with the long LED strip rather than the code or timing.

I notice from the schematic of the Pro Mini that it could be fitted with a 8, 16 or 20 MHz crystal. What is fitted on yours, it should be marked on the top.

IMG_2277.JPG|1000x750