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: