Weird Results with OctoWS2811 on Teensy 3.1

Status
Not open for further replies.

Wozzy

Well-known member
I am getting weird results running OCTOWS2811 on the Teensy3.1
If I install a Teensy3.0 in the breadboard, and compile it for Teensy3.0 works great, slow smooth color transitions.
If I swap it for a Teensy3.1, and recompile it for Teensy3.1, I get flickering and jittering random colors.
The breadboard is wired just like in the example with 100 ohm resistor and jumper on pins 15-16.
I get the same results with the example rainbow sketch.
I have another Teensy3.1, so I'll solder up some pins and give that a try.
Is anyone else seeing similar issues.

Code:
/*  OctoWS2811 Rainbow.ino - Rainbow Shifting Test
    http://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    Copyright (c) 2013 Paul Stoffregen, PJRC.COM, LLC
*/

#include <OctoWS2811.h>
const int ledsPerStrip = 33;
DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];
const int config = WS2811_GRB | WS2811_800kHz;
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
int rainbowColors[2160];

void setup() {
  for (int i=0; i<2160; i++) {
    int hue = i / 6;
    int saturation = 100;
    int lightness = 50;
    // pre-compute the 180 rainbow colors
    rainbowColors[i] = makeColor(hue, saturation, lightness);
  }

  leds.begin();
}

void loop() {
  rainbow(0, 5000);
}

void rainbow(int phaseShift, int cycleTime)
{
  int color, x, y, offset, wait;

  wait = cycleTime * 1000 / ledsPerStrip;
  for (color=0; color < 2160; color++) {
    for (x=0; x < ledsPerStrip; x++) {
      for (y=0; y < 8; y++) {
        int index = (color + x + y*phaseShift/2) % 2160;  // 2160 elsewhere & 180 here is cool
        leds.setPixel(x + y*ledsPerStrip, rainbowColors[index]);
      }
    }
    leds.show();
    delayMicroseconds(wait);
  }
}

Teensy 3.1
Teensy3.1.jpg

Teensy 3.0
Teensy3.0.jpg
 
Just to be sure, I reloaded a new Arduino 1.0.5 installation on my WinXP machine.
BTW This time I put it in C:/Arduino-1.0.5
However, this did not correct the problem.

Next I soldered header pins on my other Teensy3.1, and inserted it in the breadboard circuit.
This one exhibits the exact same behavior as the first.

I guess I need to dig into the OctoWS2811 timing.
 
Last edited:
I'm not having much success using my WS2811 lightstrips with the Teensy 3.1

I tried to run some older sketches that used the FastSPI_LED2 library on the Teensy3.1, but I'm getting delay.h errors
I also tried to compile the FirstLight example sketch included with FastSPI_LED2 RC5 Library, I receive several errors.

I changed the LED Arrangement configuration to:
FastSPI_LED2.addLeds<WS2811, DATA_PIN, GRB>(leds+18, NUM_LEDS/3);

The delay.h error I receive is:
...FastSPI_LED2/delay.h: In function 'void _delaycycles_AVR() [with int LOOP = 6; int PAD = 0]':
...FastSPI_LED2/delay.h:33:4: error: unknown register name 'r16' in 'asm'


I've attached a screen-cap of the error screen.
Has anyone else seen this, or figured a workaround?
I already alerted Daniel Garcia over on FastSPI_LED Users on G+
Arduino1.0.5.jpg
 
Do you have a way to convert the 3.3V signal from the Teensy 3.1 to 5V, e.g. a 74hc245? Maybe the IO signals of the MK20DX256 in the T3.1's aren't as strong as the ones in the T3.0's MK20DX128?
 
Potatotron,

No I'm running the light strips directly...
The Greeled strips have never had a problem with this.

That's a good idea though... I'll drag the scope upstairs and take a look.
 
Last edited:
Thanks Paul... I'm convinced it's a timing issue.

It wasn't the voltage, in fact my Teensy3.1 output signal was just slightly higher than the 3.0

I created a sketch that just keeps updating the lightstrip with a single color (cyan)

I hooked the outputs to the scope for both the 3.0, and 3.1, one at a time.
In the photos below, all scope settings, program sketch, and circuits are the same.
You can see that the frequency is much higher on the 3.1.

Oscope Teensy 3.0.jpgOscope Teensy 3.1.jpg

I'll hook up the logic analyser to try and make sense of this,
but it'll have to wait a few days as I'll be traveling starting very early tomorrow morning.
 
Last edited:
I'll look into this soon.

So uhhhh... if it turns out that you need to touch up the library a bit for the T3.1 and it just so happens that you can turn OctoWS2811 into DodecaWS2811 (ya know, while you've got the hood open and all), then that'd be pretty nifty wouldn't it? Erm... not that I have an agenda or am asking you to look into that, of course! >.> <.<
 
Ha, I had to google "dodeca" ;)

I looked at this quickly and I'm also seeing strange waveforms. Will investigate in detail on Monday.

Odds are pretty much zero I'm going to expand beyond 8 output, at least anytime soon. But I did put gamma correction into movie2serial not long ago, so you can expect to see that...
 
hello forum!

i just bought my first teensy : a 3.1 for a project with severals WS2811 led strip
so i installed teensyduino 1.18 and the OctoWS2811
i checked all the connexion and everything looks like ok
and i tried the basic test but nothing happened. and the best i could get was to light on several led in white at the begining of the strip
Do you have any idea what hapened?

thanks for your help
 
hello forum!

i just bought my first teensy : a 3.1 for a project with severals WS2811 led strip
so i installed teensyduino 1.18 and the OctoWS2811
i checked all the connexion and everything looks like ok
and i tried the basic test but nothing happened. and the best i could get was to light on several led in white at the begining of the strip
Do you have any idea what hapened?

thanks for your help

Hard to be sure w/o some details of how things are wired up (e.g. how are they powered, whats tied back to GND, etc), but I'd wager that its grounding issue or that you forgot to connect pins 15&16 on the teensy.
 
hello forum!

i just bought my first teensy : a 3.1 for a project with severals WS2811 led strip
so i installed teensyduino 1.18 and the OctoWS2811
i checked all the connexion and everything looks like ok
and i tried the basic test but nothing happened. and the best i could get was to light on several led in white at the begining of the strip
Do you have any idea what hapened?

thanks for your help

Did you bridge pins 15 and 16?
 
thanks for your quick replies,
i tryed to draw something to show how it is wired

View attachment 1288

So, I just switched out a Teensy 3.0 for a Teensy 3.1 on a octows2811 set up that I know works robustly for the 3.0 (34x8 array, 100 ohm resistors, short wires, common ground, etc - it has worked well for a long time), and I have the same sort of issue, a lot of flicker. I only get the fixed white leds if the CPU is on 24MHz, but the colours are all over the place on 48MHz. I also updated Teensy Loader to 1.18-rc1. I have also looked at changing the resistor value, which has not seemed to help.
 
Last edited:
I had the very same flickering+strange colors behaviour with my Teensy 3.1 and OctoWS2811 as described in the first post (using the setup from the OctoWS2811 page + example sketch). Switching to Teensynduino 1.18-rc1 fixed the problem. Thanks!
 
I am new to Teensy and LEDs and I am also getting wierd results.

My setup:
Teensy 3.1
Arduino 1.05
Teensyduino 1.19
2 strips of DC5V WS2811 pixel nodes, 50node a string
Hardware connected as described here for a Teensy 3.0: https://www.pjrc.com/teensy/td_libs_OctoWS2811.html#videodisplay
Running BasicTest Example Program

I can run one strip alone OK but only RED, GREEN, and BLUE colours work (YELLOW 0xFFFF00, PINK 0xFF1088, ORANGE 0xE05800, WHITE 0xFFFFFF go to red after a very quick flash of the correct colour).

When I add a second strip to Pin 14, both strips go into a speeded-up color wipe that is only red.

Can anyone suggest what I should do next to figure out what might not be working?

Is the Teensy 3.1 pin configuration different from the Teensy 3.0 perhaps?
 
When I add a second strip to Pin 14, both strips go into a speeded-up color wipe that is only red.

Is it something to do with power consumption? I have 2x 50 leds running off the teensy which is plugged into my MacBook Pro via USB. Should I be moving to a dedicated 5V power supply?
 
100 leds * ~60ma = 6 amps. The USB port on a Macbook can probably source a Maximum of 1 amp (probably only 500ma for generic devices) so you are way beyond what the port can provide...
 
As nclecaude says you definitely need a dedicated power supply for this. One thing you could do for testing is keep all the LEDs at a very low power level (e.g. no pixel component brighter than 0x0f). But even then I wouldn't run more than ~ 50 LEDs without a dedicated power supply.

Are you using the new WS2812Bs (4 pins per LED)? My experience is Teensy 3.1 + WS2812B always requires the 74hct245 level shifter, whereas with Teensy 3 and the older WS2812s (6 pins per LED) you could often get away without it.

Finally, it's unlikely this is your problem but please check your wiring and make sure everything is correct. Just last Friday I was trying to play with some FadeCandy-ish temporal dithering and nothing was working and I almost threw the whole kit out the window…until I looked closer and found I'd connected pins 16 & 17, not 15 & 16.
 
Thanks nclecaude and potatotron.

I guess I thought I could test this out with a couple of LED strips and my breadboard before buying a power supply! Clearly not.

I did try a simpler test sketch that only lights three LEDs at a time and it works fine showing all colours properly (and proving the point that it was a power problem).

I just ordered two 40A power supplies and an OctoWS2811 Adaptor just to be safe!

Thanks for your help.

B.t.w. One LED was dead right from the start. Is that quite common or did I destroy it myself with what I did here?
 
Actually it was the third one in the first strip! This was one of three that I separated from the other boards so perhaps I damaged it when I did that.
LED strip 50.jpg
 
Last edited:
Here is my revised Basic Test code if anyone else wants to test a new strip of LEDs without blowing their power supply:

Code:
[FONT=courier new]/*  This is a variation on the Basic RGB LED Test provided
    by Paul Stoffregen:
    http://www.pjrc.com/teensy/td_libs_OctoWS2811.html

   Instead of lighting all your LEDs at once, this routine
   lights three at a time to conserve power while still 
   allowing you to check if all your LEDs are working.
   
   See the serial output for a log of the LEDs being lit.

  Required Connections
  --------------------
    pin 2:  LED Strip #1    OctoWS2811 drives 8 LED Strips.
    pin 14: LED strip #2    All 8 are the same length.
    pin 7:  LED strip #3
    pin 8:  LED strip #4    A 100 ohm resistor should used
    pin 6:  LED strip #5    between each Teensy pin and the
    pin 20: LED strip #6    wire to the LED strip, to minimize
    pin 21: LED strip #7    high frequency ringining & noise.
    pin 5:  LED strip #8
    pin 15 & 16 - Connect together, but do not use
    pin 4 - Do not use
    pin 3 - Do not use as PWM.  Normal use is ok.

  This test is useful for checking if your LED strips work, and which
  color config (WS2811_RGB, WS2811_GRB, etc) they require.
*/

#include <OctoWS2811.h>

// Adjust these constants to the LED strips you have connected
const int ledsPerStrip = 50;
const int numberOfStrips = 2;

DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];

// Make sure this configuration is right for your LED strips
const int config = WS2811_RGB | WS2811_800kHz;

OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);

void setup() {
  // initialize serial communication  
  Serial.begin(38400);
  
  leds.begin();
  leds.show();
  
}

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

int a = 1, b = 2, c = 3;

void loop() {
  char s[20];
  // uncomment for voltage controlled speed
  // millisec = analogRead(A9) / 40;

  leds.setPixel(a, RED);
  leds.setPixel(b, GREEN);
  leds.setPixel(c, BLUE);
  leds.show();
  Serial.print("LEDs lit: ");
  sprintf(s, "%3d, %3d, %3d", a, b, c);
  Serial.println(s);
  delay(500);
  
  leds.setPixel(a, BLK);
  a = b;
  b = c;
  c = (c + 1) % (numberOfStrips*ledsPerStrip);
    
}[/FONT]
 
Last edited:
Status
Not open for further replies.
Back
Top