Toggling multiple LEDs with external power source

Hello all,

I'm very new to electronics as a whole, and my lack of knowledge has left my googling insufficient. I need to control about 20 5mm yellow LEDs with a Teensy 4.1, and have them turn on and off randomly. I've got a working version with 4 LEDs, but they're all getting power via the Teensy's GPIO pins. It's my understanding the Teensy wouldn't be able to power all 20, so I'm planning to use external power. My question is how can I still individually toggle the LEDs on and off with the Teensy while using external power? Any general guidance would be greatly appreciated, sorry for my lack of knowledge!

1 Like
  1. you could use addressable strings (search: NEOPIXEL) (up to hundreds, with care)
  2. you could use an I2C port expander and put an LED on each output (16 per unit)
  3. you could use something like a MAX7219, and arrange your LEDs as you want, but wire them as if they were a matrix. (64 maximum)

Up to a point, with significant design restrictions, any one of the above will do what you want, but there's no really easy answer unless you change to a MEGA2560 and just wire your 20 LEDs to it's outputs. Even there, you begin to get to the limits of available output current, if you decide to put anything else on all the spare outputs.

  1. shift register
  2. transistors
1 Like

@kolaha good point. Also possible. Depends on how he wants to implement, solder skills, etc., but definitely an option.

With daisy-chained shift registers you can control an almost unlimited number of LEDs with just 3 output-pins.

I have a project with a different MAX chips, the MAX 6968. They are basically special-purpose shift registers designed for driving LEDs. They have built-in current limiting so the LEDs don't need resistors.

My project uses 6 of these chips to control 48 LEDs (with just 3 connections).

NeoPixel/WS2812 LEDs have a driver built-in to the LED any you can control many-many LEDs with just one data connection. They are generally RGB but you can send "yellow" data. You need a software library but the hardware wiring couldn't be easier!

MAX7219 needs 1 current limiting resistor for up to 64 LEDs. Solutions with IO expanders or shift registers require a resistor per LED.

The WS2812 strips are more versatile though an acceptable yellow might be illusive.

Hi, @jslater98
Welcome to the forum.

This may help.

Tom.. :grinning: :+1: :coffee: :australia:

  1. Relay

Not best as it's noisy, but still could work. Especially for high voltages.

Can I ask:
Why a Teensy?

Ended up finding a MEGA in our shop and am using that. Thanks for the help!

1 Like

@jslater98 then, please flag the topic as solved (pick a suitable post as the "solution") so no helpers read it unnecessarily. Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.