Can we drive several LED strips indepently attached to a single Teensy 3.x board ?

Status
Not open for further replies.

x_avier

New member
Hello Paul, hello there,

first thanks for the great work/releases of Teensy boards and the great OctoWS2811 library. I may ask a question already posted but I can't find similar one so I go for it.

Could it be possible to drive independently several LED strips attached to a single Teensy board. Example of set-up below :
- several LED strips attached to the same pin (in sync on this LED pattern)
- 1 LED strip attached to another pin with a different LED pattern ?

Best. Xavier.
 
Yes.

For 1 pin driving multiple LED strips, sure. Many newer LEDs work well with 3.3V signals. But it's still best to use a buffer chip like 74HCT245 to increase to a full 5V signal. The best connection is to run Teensy's signal to the inputs of multiple buffers, and then have each buffer drive a single strip. It's the exact same data, but electrically this way has lower noise and better reliability.

For driving multiple strips, sure, you can do that too. OctoWS2811 drives 8 of them. You can just use 2 of the 8 outputs and leave the other 6 unconnected.

Or you can use WS2812Serial. It drives 1 output, but you can use more than 1 instance of that library and just configure each instance for a different pin. Do pay attention to the docs (in the example comments, File > Examples > WS2812Serial) as only specific pins are supported.

If you instead use Teensy 4.0 or 4.1, you have yet another option. On those boards, OctoWS2811 can be configured to use any combination of pins. You can use less than 8 or more than 8. See File > Examples > OctoWS2811 > Teensy4_PinList. But that only works on Teensy 4. If you're using a Teensy 3.x, then OctoWS2811 is rigidly fixed to 8 pins which can't be reassigned. You only get that OctoWS2811 PinList function on Teensy 4 boards.
 
Dear Paul,
thanks a lot for your reply and these different options you proposed.
I am currently testing with a teensy3.2, using "WS2812Serial/BasicTest.ino" and connecting one strip(10 LEDs) on pin#1 and one strip(3 LEDs) on pin#5.
Below the way I created 2 instances of the WS2812Serial library, however when I drive leds and leds2 to see if they can be driven independently, the led strip on pin#5 does not show the BLUE/YELLOW sequence.
Is there is something wrong on the way I use the 2 instances of WS2812Serial ?
Best. Xavier.

Code:
#include <WS2812Serial.h>

const int numled = 10;
const int numled2 = 3;
const int pin = 1;
const int pin2 = 5;

// Usable pins:
//   Teensy LC:   1, 4, 5, 24
//   Teensy 3.2:  1, 5, 8, 10, 31   (overclock to 120 MHz for pin 8)
//   Teensy 3.5:  1, 5, 8, 10, 26, 32, 33, 48
//   Teensy 3.6:  1, 5, 8, 10, 26, 32, 33

byte drawingMemory[numled*3];         //  3 bytes per LED
DMAMEM byte displayMemory[numled*12]; // 12 bytes per LED

byte drawingMemory2[numled2*3];         //  3 bytes per LED
DMAMEM byte displayMemory2[numled2*12]; // 12 bytes per LED

WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
WS2812Serial leds2(numled2, displayMemory2, drawingMemory2, pin2, WS2812_GRB);


#define RED    0xFF0000
#define GREEN  0x00FF00
#define BLUE   0x0000FF
#define YELLOW 0xFFFF00
#define PINK   0xFF1088
#define ORANGE 0xE05800
#define WHITE  0xFFFFFF

void setup() {
  leds.begin();
  leds2.begin();
}

void loop() {
  int microsec = 1500000 / leds.numPixels();

  leds2.setPixel(1, BLUE);
  leds2.show();
  delayMicroseconds(microsec);
  leds2.setPixel(2, BLUE);
  leds2.show();
  delayMicroseconds(microsec);

  leds.setPixel(3, RED);
  leds.show();
  delayMicroseconds(microsec);
  leds.setPixel(4, RED);
  leds.show();
  delayMicroseconds(microsec);
 
  leds2.setPixel(1, YELLOW);
  leds2.show();
  delayMicroseconds(microsec);
  leds2.setPixel(2, YELLOW);
  leds2.show();
  delayMicroseconds(microsec);

  leds.setPixel(3, GREEN);
  leds.show();
  delayMicroseconds(microsec);
  leds.setPixel(4, GREEN);
  leds.show();
  delayMicroseconds(microsec);
 
}
 
Note on the Teensy 3.2 pin #1 is the normal pin for Serial1 TX1, and pin #5 is an alternate pin for the same serial line. I would imagine each of the different WS2812Serial strips need to use different Serial ports. I.e. you can use pin #1 or #5, but you can't use both at the same time. Try using pin #8 (TX3) or pin #10 (TX2) instead. Solder pad #31 underneath the Teensy is an alternate pin for TX2 (i.e. you can use either pin 10 or pad 31 but not both at the same time).
 
Dear Michael,
thanks a lot for your hardware hint and it works great with one LED strip on pin#1 and one LED strip on pin#8 driven independently.
Teensy 3.x is great and I look forward playing with Teensy 4.x.
Cheers and best.
Xavier.
 
Status
Not open for further replies.
Back
Top