5v output?

batmundo

Member
Hi! New to the world of Teensy here. I have a a lighting rig I built using Arduino Megas a while ago, and now I'm exploring swapping them out for Teensy boards instead. From what I can tell looking at the specs, it seems like all the boards only have 3.3v outputs - are there any Teensy boards that have 5v 10 outputs? Or will I just need to get level shifters to get things to 5v? And I assume I would need to do this per output? (Also new to level shifters...)
 
Hi! New to the world of Teensy here. I have a a lighting rig I built using Arduino Megas a while ago, and now I'm exploring swapping them out for Teensy boards instead. From what I can tell looking at the specs, it seems like all the boards only have 3.3v outputs - are there any Teensy boards that have 5v 10 outputs? Or will I just need to get level shifters to get things to 5v? And I assume I would need to do this per output? (Also new to level shifters...)

Other than the Teensy 2 systems (which IIRC have less horse power than the Megas), all Teensy systems are 3.3 volt systems.

In general, you would want to use level shifters. You didn't mention what type of lights you are using.

I can't tell from your description what your rig looks like.

If you have 10 single LEDs each controlled by a digital pin, then one possibility is using 10 separate pins on the Teensy, and you would use level shifters. One of the preferred level shifters is the 74AHCT125, typically used for WS2812B LEDs described below. In the through hole version, it can shift 4 separate pins, so you would need 3 separate chips. Adafruit sells these, and you can get them elsewhere as well:

If you are using higher power LEDs, you may need to use 10 separate NPN or PNP transistors to drive the LEDs. I don't think you are using this on the Mega.

Alternatively if you are driving 10 single LEDs, you could use an I2C servo driver using something like a PCA9685 chip. This is connected to the Teensy via the I2C bus (pins 18 and 19). The Teensy sends commands to the device on which pins to turn on/off and whether to use PWM (pulse width modulation). This unit sold by Adafruit can drive up to 16 lights (or servos). It has a jack for separate power input to drive the LEDs:

Note with the above unit, you might need 2 2.2k resistors for pull-up resistors. Many of the newer Adafruit I2C devices have pull-up resistors built-in, but the older devices typically don't. A pull-up resistor is a resistor that is wired in parallel between the data pin and 3.3v (i.e. you would need one for pin 18 and one for pin 19).

If you are using lights with the WS2812B or SK6812 protocols (which Adafruit calls neopixels), you would use the 74AHCT125 level shifter as mentioned earlier. If you have 10 separate WS2812B/SK6812 LEDs, you would need 3 74AHCT125 shifters. The 74AHCT125 is fast enough to be used for WS2812 lights (WS2812 does not have a clock pin, instead the data pin must deliver data in fixed timing intervals -- many of the other level shifters meant for slower devices is not fast enough). However, WS2812 lights can be chained together. This means you only need one pin on the Teensy to control 10 lights.

WS2812B/SK6812 LEDs come in a variety of form factors:
  • They come in single LED units and you would connect each unit to the next via wiring;
  • They come in straight strips;
  • They come in rings;
  • They come in matrix formats.

Adafruit has a learning guide about neopixels. I would tend to quibble with a few bits of the guide (since it hasn't been updated to cover modern microprocessors and lights as I might prefer), but in general it gives a decent introduction.

I've built various WS2812B/SK6812 cosplay bits and pieces over the years, such as a bowtie with 1 or 2 16-LED rings, suspenders with LEDs running through them, etc. With modern SK6812 LEDs, you often times don't need the level shifter. Officially you still 'need' to use it, but I find in practice it often works if I'm just driving 16-32 LEDs without doing the shifting.

Now with WS2812B/SK6812 LEDs, once you get past 100 or so LEDs, you often want to optimize it and do things like light 8 separate strands at the same time. Teensy has a board made for this and a library to drive it. The pin layout for the board is the pin layout for the Teensy 3.x processors. The Teensy 4.x processor are a little more flexible, and can drive more than 8 strands of light. So you could use 2 boards, and rather than stacking them on the Teensy, connect them via wires (or just rework your setup to use 8 streams). This board is nice because it has a lot of the resistors and level shifters and such that you would need. The LEDs are connected via 2 RJ45 (typically used for ethernet) cables, 4 LEDs per cable. I have not used this board:

An alternative lighting system to the WS2812B/SK6812 is the APA102 LEDs (that Adafruit calls dotstars). Each strand has a clock pin and a data pin. So in this case, you would need double the number of level shifters, and double the pins. But like WS2812B/SK6812 LEDs, with APA102 LEDS, you can chain them together and you would only need 2 pins.

You probably aren't using this on the Mega, but another system are matrix style breakouts that allow you to make things like the flashing electronic signs in Times Square. One company makes a Teensy 4.0/4.1 compatible shield that can drive 32x32, 32x64, and 64x64 RGB matrixes. I have used the Teensys and some of the Adafruit RGB boards:
 
Last edited:
Ah sorry, I guess more info would have been helpful. So yeah, I'm running APA102s, with 5 LED strips on separate outputs (with clock and data each, hence the 10 outputs). I initially tried WS2813s, but needed to switch to the APAs because I was running into issues reading MIDI input. The five outputs consist of 3 sets of 147 LEDs and 2 sets of 280, totaling 1001 LEDs. I recently dove into learning TouchDesigner and am trying to update the rig to work with TD, but am running into speed issues with the serial data being received by the Mega - it seems like it can barely get up to 12 fps. From going through this thread (https://forum.derivative.ca/t/hitting-bottleneck-controlling-close-to-4-000-leds/5909), I'm getting the feeling I'm going to need to switch to Teensy to be able to drive everything at a faster frame rate and have it look nice and smooth...
 
I initially tried WS2813s, but needed to switch to the APAs because I was running into issues reading MIDI input.

Maybe you were using one of the blocking libraries, like Adafruit_Neopixel or FastLED with its default WS2812 driver? Those block the rest of your program from running while the LEDs update.

If you use WS2812Serial or OctoWS2811, you get non-blocking LED update which has minimal impact on the rest of your program.
 
Yeah, I'm using FastLED with APA102s - when I first built the rig, MIDI data was getting dropped due to interrupt issues (this was like 5 years ago so I don't remember the exact details), and after some forum inquiries it sounded like APA102s were the way to go. I'm guessing WS2812Serial or OctoWS2811 wouldn't work with APA102s?
 
Last edited:
Yeah, I'm using FastLED with APA102s - when I first built the rig, MIDI data was getting dropped due to interrupt issues (this was like 5 years ago so I don't remember the exact details), and after some forum inquiries it sounded like APA102s were the way to go. I'm guessing WS2812Serial or OctoWS2811 wouldn't work with APA102s?

Ws2812Serial and the OctoWS2811 library are WS2812B/SK6812 only (hence the name). I recall in the past that the OctoWS2811 library did not support the RGBW leds. I don't recall if Ws2812Serial supports them or not. The OctoWs2811 board that PJRC sells should work with APA102's, since it just passes the data through after doing level shifting.

Ws2812Serial requires you to use one of the pins that are used for the serial UARTs TX (8 pins in Teensy 4.1, 7 pins in Teensy 4.0). Ws2812serial does not block interrupts. However, when I briefly tried them, I didn't notice a way to start the transfer and come back and then poll later to find when they are done. But at least things like servos, audio, uarts, etc. that needs the interrupts to be handled in a timely fashion should work. Note, I only use a few neopixels, so I'm not stressing the limits like you are.

As Paul mentioned, the Teensy 4.0/4.1 no longer has fixed pins that must be used for the DMA when using the Octows2812 library. But you would need to set up your own level shifting, etc. instead of using the board provided.
 
Back
Top