Trying to light a single Neopixel

Status
Not open for further replies.

Axiom Greg

Active member
Hello,

I just started playing around with neopixels. I thought I'd start by trying to light a single neopixel with a Teensy 3.1 which seems like it should be pretty easy to do. However, no success thus far. I am using the Adafruit Neopixel library. I have connected the Neopixel to power, ground and data (the latter being a DO on the Teensy). I am using a 500ohm current limiting resistor on the DO. In all cases, the Teensy is being powered by USB. Here's what I've tried so far:

1) Power the neopixel with Vin (5v) from the Teensy usb.
2) Power the neopixel with V3.3 from the Teensy.
3) Same as 1, but powering the neopixel with a diode in series with the 5V (the idea is to drop the voltage a bit).
4) Try 1 and 2 without the current limiting resistor (hopefully I didn't damage the neopixel, but have I have several of them which I can try for testing purposes).

(at most, I have seen the neopixel briefly flash on power up. I believe that was case 4 above).

I have been assuming that my issue has to do with level shifting, but I'm not 100% sure. I see that there is the OctoWS2811 Adaptor, but that is way overkill for my project since I only need to power 8 neopixels.

Since all of my experimentation hasn't worked, what I would like to know is if there is a recommended way to drive a small number of neopixels from the Teensy (apparently I haven't found it).

Thank you!
Code:
#include <Adafruit_NeoPixel.h>

//create a NeoPixel strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 14, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(9600);
  strip.setBrightness(30);
  strip.show();
  delay(100);
}

// The main program
void loop() {
  strip.setPixelColor(0, 0, 255, 0);
  strip.show();
}
 
Last edited:
Add a delay in loop. Some of these LEDs don't work when you transmit more than about 400 times per second.

If that doesn't help, show us photos of how you're connecting the hardware. There probably a misunderstanding which defies words but would very likely be clear to see with a photo.

For experimenting, I'd go with connection #1 or #2, not using the resistor. The resistor is useless if the wires are fairly short (less than the length of a solderless breadboard) and the LED is powered by Teensy.
 
OK, I just started over and re-created the circuit (as I had a variety of other unrelated connections) so here's the hardware setup. I originally had the delay in order to "blink". I've added the delay back in to no avail.
Also, tried both 5v and 3.3v from Teensy.

TeensyNeopixel.jpg
 
maybe add a strip.begin(); after Serial.begin()

or try running the simple example from Adafruit NeoPixel lib
 
I was going to also mention probably need a strip.begin();

I have had luck running 1 when the voltage was 3.3v. Did not work if I passed in +5v. Unless of course I had a level shifter going out to the Neopixel
 
maybe add a strip.begin(); after Serial.begin()

or try running the simple example from Adafruit NeoPixel lib

That was it (forehead slap). I knew it had to be something simple. All along I thought it was a level shift issue. Fortunately no neopixels ware harmed during my experiments!

Thank you and to all who have responded.P_20191225_132510_LL.jpg
 
I have done the level shifting a few different ways. Sometimes I just use one of breakout boards from Adafruit or Sparkfun.

Other times I have used something like a: SN74LV1T125
Example a few years ago, I had a little hat that soldered on top of a T3.2 which connected in a Dynamixel Servo chain, and acted like a servo, and I could send Dynamixel Register writes to change the color of the Neopixel, which had them in the hands...

teensy-Neo-3d-dpak.jpg
 
Thanks for the recommendations. Since it's currently working without one, I'm not sure it's necessary in my case, but if I do happen to need one I want to make sure it has enough drive for the neopixel (e.g. TXB0108 level shifter isn't recommended for that reason). The 74HCT125/225 also seem like they might be good options.
 
Thanks for the recommendations. Since it's currently working without one, I'm not sure it's necessary in my case, but if I do happen to need one I want to make sure it has enough drive for the neopixel (e.g. TXB0108 level shifter isn't recommended for that reason). The 74HCT125/225 also seem like they might be good options.
IIRC, you probably want the 74AHCT125/225 or the 74AHCT125/225's instead of the 74HCT125. The difference is that the AHCT/AHC series is much faster than the HCT series.

Here is a datasheet for the HCT series and a through-hole version:

Here is the datasheet for the AHCT series:

In particular, the switching time for the 74HCT125 is between 10 and 190 ns, while the switching time for the 74AHCT125 is 1 to 15 ns. I've been looking into the data sheets recently. I had gotten a set of the 74HC125's previously, but I started looking at the data sheet and I noticed the difference in speed. I got the above 74AHC125's and I was going to solder it up this weekend (it mostly worked with the 74HCT125, but there were times when it seemed to miss a cycle).

If you need more room on your prototype board and/or you are making a surface mount PCB, I also got the following, but I haven't soldered it up yet:

Some Neopixel/WS2812B LEDs must be driven at 5v (or at least 3.7v), some can be driven with 3.3v. Some can be driven at 5v power but work with 3.3v signals, and some need higher voltage for the signals (i.e. you need a level shifter). I've had all variants. The newer Adafruit rings can typically be driven at 3.3v, and I've hooked them up to the 3.3v of the Teensy. I vaguely recall that the individual neopixels might be made by a different company, and so might have different characteristics. I do keep an eye on the max power if I'm using the 3.3v bus. I typically do 2 rings of 16 LEDs, and as long as I keep the max power of each LED to 30 or less, the max voltage used is about 75mA, which is well within the 120mA of the Teensy LC (3.2/3.5/3.6/4.0 boosts that to 250mA).

By keeping the power down to 30, I mean the sum of the R, G, and B values for each LED must be 30 or less. I was doing a test of the Teensy 4.0 WS2182Serial library, and it would freeze up, until I realized I was using the example, and froze when it was doing full white (255 for each of R, G, and B), and it was just too much for the 4.0's voltage regulator. When I switched to the 74HCT125, it was fine.

In the past, I have used this level shifter from Pololu.com:
 
Last edited:
Good point, I believe that neopixels run at high enough speeds that switching time can be an issue. It turns out that my current batch of neopixels seem to work fine fine at both 5V and 3.3V so it may only be a future concern for me. I plan on running only a small number (no more than 10) for my current project and so the 5V USB power should be fine. Since I won't be using the internal Teensy regulator, I'm less concerned about power draw but will still perform the requisite calculations to make sure I'm within reasonable limits of the power provided by my wall wart USB adapter. Thanks for the useful information, this is very good to know!
 
Status
Not open for further replies.
Back
Top