Hi everyone,
Sorry to resurrect an old thread. I'm curious regarding the Neopixels MichaelMeissner recommended (
https://www.adafruit.com/product/1734) as I'd like to use them in a MIDI pedal I'm trying to build.
The pins read
Data In
+5v
Ground
Data Out
If run from a Teensy 4.0 or 4.1, how would you guys go about powering them?
Cheers! Simon
The answer is it depends on how many lights you want to light up and how bright you want the lights. And as you get to more and more lights, things become more complex.
Some of the newer WS2812B lights can actually be run at 3.3v (which means you don't have to translate the data signal from 3.3v to 5v), but you ultimately only have 250mA available from the Teensy processor, and it needs power as well. So perhaps you can run 10-16 LEDs this way, assuming you don't use high power for the LEDs (I tend to use a maximum of 30 for any one LED, where the 30 is the sum of the R, G, and B power levels). IIRC, a 16 LED ring would draw about 75mA. But note, a random LED might not work at 3.3v. The data in pin would be connected to a random Teensy pin (the data out pin connects to the next light in the chain).
However for real time stuff, you likely want to switch from using the basic Adafruit neopixel library to using the WS2812Serial library. The Adafruit neopixel library disables interrupts while the whole chain is being written (due to the critical timing based on the WS2812 specification, where you need to produce the next set of bits in a fixed period of time). The WS2812Serial library on the other hand restricts your data pin to one of the serial port TX pins. But it operates in a non-blocking fashion, so that other things that need interrupts are not blocked.
For a bit more LEDs (maybe 100 or so), the way to do this is use a fast 3.3v to 5v converter. Note, the random voltage converters are not fast enough (it the converter mentions I2C, SPI, or dual direction, it generally will not be fast enough). The simplest converter to use is the 74AHCT125, which is one of the few fast converters that are available in through hole format rather than surface mount (which you need to solder to a breakout board). Here is Adafruit's entry for it (you can get it from other suppliers):
In this configuration, you hook you the VIN (5v) pin from your Teensy to the VCC pin on the 74AHCT125 and to the VCC on the first light in the strand. Connect Teensy ground to the ground amd 1OE pins on the chip and and to the ground pin on the LED strip. Connect your data pin to the 1A pin on the chip. Connect the 1Y pin to the Data in pin of the strip. For successive strips, connect the VCC, and Ground pins to both strips, and connect the Data Out pin of the first strip to the Data In pin of the next strip.
However, you are limited by the power going through the VIN pin (500mA?), and ultimately the USB cable powering the Teensy. If you hook up the VUSB pin, you should be able to get access to the entire USB power going into the Teensy. But note many USB connections will only give you 500mA.
Beyond 100 LEDs or so, you probably can't power the LEDs from the USB power that powers the Teensy, but you have to have multiple power sources, to power a set of LED strips, interconnecting the grounds, but not the power. It is also at that point you may need to switch to the OctoWS2811 adapter and the OctoWS2811 library:
The Adafruit neopixel uberguide tries to document many of the pitfalls (but it is written from an Adafruit background, so it doesn't mention Teensy specific things like WS2812Serial):
I would connect Vin from the Teensy to the 5V and ground from Teensy to ground on the LED. I think you connect SCA and SDA from the Teensy to to two other pins. You can chain all of those LEDs together. I hope that helps, but that's the general gist of it.
This won't work. See the above posting for the reasons.