Hello,
I am using a 24 Neopixel ring with a teensy 3.6. Only 18 pixels illuminate and I ran some code to test it. When this code is run, the pixels that do work light up in the pattern green, then the green pixel turns to white, then the next pixel is blue and the next red. The pattern repeats till all 18 pixels are filled. Please help.
#include <Adafruit_NeoPixel.h>
#define PIN 23
Adafruit_NeoPixel ring = Adafruit_NeoPixel(24, PIN, NEO_RGB + NEO_KHZ800);
void setup() {
ring.begin();
ring.clear();
//ring.setBrightness(70); //adjust brightness here
ring.show(); // Initialize all pixels to 'off'
}
void loop()
{
for(int i=0;i<25;i++)
{
ring.setPixelColor(i, ring.Color(255,0,0));
ring.show();
delay(500);
}
}
Neopixel Ring not working
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- caitlinsdad
- Posts: 627
- Joined: Fri Feb 24, 2012 4:23 pm
Re: Neopixel Ring not working
Take a close look at the neopixel itself and see if there is a yellowish half-moon element there. If you have it, they are RGBW neopixels, RGB and White. They are coded a little bit different.
1. You need to change the following line to tell the sketch you have RGBW neopixels.
and
2. Setting colors will have the added parameter for White, so use:
You can look for the Neopixel Uberguide in the Adafruit Learn section to get all the details on neopixels. Good luck.
1. You need to change the following line to tell the sketch you have RGBW neopixels.
Code: Select all
Adafruit_NeoPixel ring = Adafruit_NeoPixel(24, PIN, NEO_RGBW + NEO_KHZ800);
2. Setting colors will have the added parameter for White, so use:
Code: Select all
ring.setPixelColor(i, ring.Color(255,0,0,0));
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Neopixel Ring not working
I believe caitlinsdad has the correct diagnosis. That repeating pattern and lighting up only 75% of the pixels is a pretty solid indication that you have RGBW pixels and are using RGB in your code. If you change the ring definition as he describes, you should be back in business.
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Hey,
I was just wondering, for this code to work, would you need to install drivers into the RGBW ring or do these work without installed drivers such as this ring: https://www.adafruit.com/product/2862? Also, what is the difference with the K? I see rings some have 4000K others have 6000K.
Thank you,
Joaquin
I was just wondering, for this code to work, would you need to install drivers into the RGBW ring or do these work without installed drivers such as this ring: https://www.adafruit.com/product/2862? Also, what is the difference with the K? I see rings some have 4000K others have 6000K.
Thank you,
Joaquin
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Neopixel Ring not working
Microcontrollers don't use drivers per se, they have libraries of functions that allow them to talk to external devices. For NeoPixels, it's the Adafruit_NeoPixel library.
The K value tells you what color the white LEDs are. 4000K is a warm white (more yellow) while 6000K is a cool white (more blue).
The values themselves are black-body emitter temperatures in degrees Kelvin (+1K is the same as +1C, but the Kelvin scale starts at absolute zero).
Any object hotter than absolute zero radiates energy in the form of photons knocked loose by thermal collisions. That escaping energy cools off the object slightly. The object also receives energy from photons hitting it, and that energy heats it up slightly. If the object is the same temperature as its surroundings, the amount of energy it emits is the same as the amount of energy it receives, and its temperature doesn't rise or fall.
A perfectly black object absorbs all frequencies equally, so it also has to emit all frequencies equally. We talk about that kind of object -- called a 'black body' -- when discussing thermal radiation problems to avoid "it emits more of this frequency than that one" details.
The hotter an object gets, the more energy it radiates, and the higher the average frequency of the emitted photons gets. At about 475C (750K) the average frequency enters the visible light spectrum and we see it as a reddish glow. As the temperature rises farther, more and more frequencies from the visible spectrum occur, and the red light shifts toward white.
We test that idea by making a hollow cylinder of graphite (a close approximation to a black body), capping both ends, drilling a small hole in the side, and heating it. The inside surface has to stay at the same temperature as the air inside the space, and the amount of energy lost through the small hole is small enough to ignore, so the light coming out of that hole will be a good approximation of a true black body radiating at the given temperature.
At 4000K (3725C), the light coming out is white, but still has more red-and-yellow components than a pure white. At 6000K (5725C), the light coming out has more of the blue spectrum than the red spectrum.
That corresponds to the way white LEDs are made.. there's actually no such thing. A 'white LED' is really a blue LED covered by a layer of photoreactive paint that absorbs blue light and emits yellow light (same basic idea as fluorescent paints, just operating at a slightly lower input frequency). The human eye sees a combination of blue and yellow as white, so we create 'white LEDs' by making the layer of paint thick enough to convert some blue light to yellow, but let the rest of the blue pass through unchanged.
LEDs with a thicker layer of paint produce a little more yellow than blue, and manufacturers aim for a 4000K yellow-white. LEDs with a thinner coat of paint let more blue through, and manufacturers aim for a 6000K blue-white.
The K value tells you what color the white LEDs are. 4000K is a warm white (more yellow) while 6000K is a cool white (more blue).
The values themselves are black-body emitter temperatures in degrees Kelvin (+1K is the same as +1C, but the Kelvin scale starts at absolute zero).
Any object hotter than absolute zero radiates energy in the form of photons knocked loose by thermal collisions. That escaping energy cools off the object slightly. The object also receives energy from photons hitting it, and that energy heats it up slightly. If the object is the same temperature as its surroundings, the amount of energy it emits is the same as the amount of energy it receives, and its temperature doesn't rise or fall.
A perfectly black object absorbs all frequencies equally, so it also has to emit all frequencies equally. We talk about that kind of object -- called a 'black body' -- when discussing thermal radiation problems to avoid "it emits more of this frequency than that one" details.
The hotter an object gets, the more energy it radiates, and the higher the average frequency of the emitted photons gets. At about 475C (750K) the average frequency enters the visible light spectrum and we see it as a reddish glow. As the temperature rises farther, more and more frequencies from the visible spectrum occur, and the red light shifts toward white.
We test that idea by making a hollow cylinder of graphite (a close approximation to a black body), capping both ends, drilling a small hole in the side, and heating it. The inside surface has to stay at the same temperature as the air inside the space, and the amount of energy lost through the small hole is small enough to ignore, so the light coming out of that hole will be a good approximation of a true black body radiating at the given temperature.
At 4000K (3725C), the light coming out is white, but still has more red-and-yellow components than a pure white. At 6000K (5725C), the light coming out has more of the blue spectrum than the red spectrum.
That corresponds to the way white LEDs are made.. there's actually no such thing. A 'white LED' is really a blue LED covered by a layer of photoreactive paint that absorbs blue light and emits yellow light (same basic idea as fluorescent paints, just operating at a slightly lower input frequency). The human eye sees a combination of blue and yellow as white, so we create 'white LEDs' by making the layer of paint thick enough to convert some blue light to yellow, but let the rest of the blue pass through unchanged.
LEDs with a thicker layer of paint produce a little more yellow than blue, and manufacturers aim for a 4000K yellow-white. LEDs with a thinner coat of paint let more blue through, and manufacturers aim for a 6000K blue-white.
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Hey, thank you for your explanation! If I get different K values for the white, will the RGB be affected (significantly)? Or does the color of the white only change?
Thank you,
Joaquin
Thank you,
Joaquin
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Neopixel Ring not working
The K-value of the white LEDs only applies to the white LEDs in RGBW NeoPixels. If you turn on the red, green, and blue pixels at 100%, you can get just about anything.
It's normal to see a 5:1 variation in the amount of light emitted by LEDs operating at the same current, even with LEDs from the same batch. Some pixels might produce a composite white more to the red end, and others will produce a white closer to the blue end.
It's normal to see a 5:1 variation in the amount of light emitted by LEDs operating at the same current, even with LEDs from the same batch. Some pixels might produce a composite white more to the red end, and others will produce a white closer to the blue end.
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Got it! Thank you for your help.
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Hey Adafruit Community,
I was transitioning from an RGB ring to an RGBW ring using the code: Adafruit_NeoPixel ring = Adafruit_NeoPixel(24, PIN, NEO_RGBW + NEO_KHZ800);
However it kept on saying that NEO_RGBW was not declared in the scope. Is there a way to fix this?
Thank you
I was transitioning from an RGB ring to an RGBW ring using the code: Adafruit_NeoPixel ring = Adafruit_NeoPixel(24, PIN, NEO_RGBW + NEO_KHZ800);
However it kept on saying that NEO_RGBW was not declared in the scope. Is there a way to fix this?
Thank you
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Neopixel Ring not working
Check to make sure you have a recent version of the Adafruit_NeoPixel library:
https://github.com/adafruit/Adafruit_NeoPixel
Those constants are defined in the header file:
https://github.com/adafruit/Adafruit_Ne ... .h#L61-L89
https://github.com/adafruit/Adafruit_NeoPixel
Those constants are defined in the header file:
https://github.com/adafruit/Adafruit_Ne ... .h#L61-L89
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Thank you, however I have never used github before. How do import a library into the Build?
Also, I already added in this library:
but it still does not work. Any idea why?
Thank you
Also, I already added in this library:
Code: Select all
#include <neopixel.h>
Thank you
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Neopixel Ring not working
There is a green button on the right side of the Github page for downloading libraries.
This guide explains how to install libraries once you download them.
https://learn.adafruit.com/adafruit-all ... -libraries
This guide explains how to install libraries once you download them.
https://learn.adafruit.com/adafruit-all ... -libraries
- Attachments
-
- Capture.PNG (5.81 KiB) Viewed 583 times
- JoaquinR
- Posts: 6
- Joined: Sun Nov 11, 2018 4:35 pm
Re: Neopixel Ring not working
Hello, I attempted to install the github library with no success. I am using the Particle IDE, which is web based.
Any idea why? How can I fix this issue?
Since this allows you to import .cpp and .h library files, I attempted to copy and paste the .cpp and .h files,
but various errors kept on occuring, such as: pins_arduino.h: No such file or directoryAny idea why? How can I fix this issue?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Neopixel Ring not working
We don't know much about the internals of the Particle IDE and how they manage libraries. Probably best to post this question on the Particle forums.
https://docs.particle.io/support/menu-base/
https://docs.particle.io/support/menu-base/
Please be positive and constructive with your questions and comments.