Need Help with teensy 3.2 + prop-shield led strip driver

Status
Not open for further replies.

derplecbob

Active member
Im using the Teensy 3.2 board shown here
https://www.pjrc.com/store/teensy32.html

and the prop shield soldered that goes with it, shown here
https://www.pjrc.com/store/prop_shield.html

im also using ws2812b, 144 leds/m strip X2 back to back.

i have the strips soldered to the led driver on the prop shield and fast led code uploaded to the teensy board.



here is my code

// Use if you want to force the software SPI subsystem to be used for some reason (generally, you don't)
// #define FASTLED_FORCE_SOFTWARE_SPI
// Use if you want to force non-accelerated pin access (hint: you really don't, it breaks lots of things)
// #define FASTLED_FORCE_SOFTWARE_SPI
// #define FASTLED_FORCE_SOFTWARE_PINS
#include "FastLED.h"

///////////////////////////////////////////////////////////////////////////////////////////
//
// Move a white dot along the strip of leds. This program simply shows how to configure the leds,
// and then how to turn a single pixel white and then off, moving down the line of pixels.
//

// How many leds are in the strip?
#define NUM_LEDS 127
uint8_t max_bright = 250;
// Data pin that led data will be written out over
#define DATA_PIN 7

// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8

// This is an array of leds. One item for each led in your strip.
CRGB leds[NUM_LEDS];

// This function sets up the ledsand tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(200);
FastLED.setBrightness(max_bright);
set_max_power_in_volts_and_milliamps(5, 500); // FastLED 2.1 Power management set at 5V, 500mA
// Uncomment one of the following lines for your leds arrangement.
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
//FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
// FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// FastLED.addLeds<APA104, DATA_PIN>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);

// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<P9813, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<APA102, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<DOTSTAR, RGB>(leds, NUM_LEDS);

// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}

// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed+ 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::Green;

// Show the leds (only one of which is set to white, from above)
FastLED.show();

// Wait a little bit
delay(3);

}
}

End of code


My main problem is that the leds to light up unless my thumb shorts out pins 11, 12, and Vbat. then The code works fine but I cant have the brightness up very high without it changing to a low brightness mode for some reason. Here is a video showing the problem
[video]https://streamable.com/3aka5[/video]
 
Hi,
The problem is that you use pin 7 as the DATA_PIN whereas this pin is an enable pin for the LED data. See the schematic on this page.
Here is a piece of code that should do the trick:
Code:
#include <FastLED.h>
#define DATA_PIN     11  // output pin of Teensy to input pin of prop shield
// connect the data line of the LED strip to the LED_DAT output pin of the prop shield
#define NUM_LEDS    144  // dot 0-143

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); // power strip from USB port

  pinMode(7, OUTPUT);
  digitalWrite(7, HIGH);  // enable access to LEDs
}

void loop() {
   // Move a single white led 
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      // Turn our current led on to white, then show the leds
      leds[whiteLed] = CRGB::White;

      // Show the leds (only one of which is set to white, from above)
      FastLED.show();

      // Wait a little bit
      delay(100);

      // Turn our current led back to black for the next loop around
      leds[whiteLed] = CRGB::Black;
   }
}

Did not test the code above because I don't have a prop shield. But it should put you in the right direction.

Success,
Paul
 
thanks so much that did the trick for getting the leds to communicate. My last problem still seems to be that the leds wont stay at full brightness, they still go into a low brightness mode after a couple seconds. Thank you for the quick response and actual working help. :)
 
Glad to hear it's working [almost].
With respect to the dropping brightness: would you mind posting your current code so that I can have a look at it again? You can use the
Code:
 tags to insert your code in your reply.

For a quick test you could remove these 2 lines from your code to see whether it makes a difference:
- uint8_t max_bright = 250; 
- FastLED.setBrightness(max_bright);

What happens with the brightness when you increase delay(3) to delay(100)?

I also saw that you use 144 leds/m strip X2. Does that mean that the total number of LEDs is 288? Could you try with 1 strip of 144 LEDs?

Are you using the latest 1.3.8 FastLED library?
 
here is my current working code.

Code:
#include <FastLED.h>
#define DATA_PIN     11  // output pin of Teensy to input pin of prop shield
// connect the data line of the LED strip to the LED_DAT output pin of the prop shield
#define NUM_LEDS    127  // dot 0-143

#define BRIGHTNESS  25



CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); // power strip from USB port

  FastLED.setBrightness( BRIGHTNESS );

  pinMode(7, OUTPUT);
  digitalWrite(7, HIGH);  // enable access to LEDs
}

void loop() {
   // Move a single white led 
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      // Turn our current led on to white, then show the leds
      leds[whiteLed] = CRGB::Blue;

      // Show the leds (only one of which is set to white, from above)
      FastLED.show();

      // Wait a little bit
      delay(10);

   }
}

Ive tried removing those lines of code but I get the same result. With both those lines in the code, and the brightness set to a value under 30, it works without going to the other brightness mode. Only when you increase the brightness above 30 something, then is shows the problem. This is a problem because I need the leds to work at almost full brightness regardless.

The brightness still dims when the delay is adjusted. And it still take the same amount of time to switch to the low brightness mode, no matter what the delay is, which tells me the delay most likely is separate from the problem.

I have two strips but they are both connected in parallel at the base so they act as just two 127 led strips, (not connected together at other end). My led count is 127 because I cut my strips shorter than 1 meter. 127 leds on both strips but you only need #define NUM_LEDS 127, to light up all of them.

Yes, im using the newest version of fastled.
 
Hmm, now it's getting interesting...
I just ran your code on a Teensy LC connected to a 144leds W2812B strip. The Teensy LC has a special output pin that drives 5V out [effectively the same as the prop shield does].
So I only had to change this line to:
Code:
#define DATA_PIN    17   // TeensyLC 5V pin
and keep the rest of the code the same.

I do not see a drop in brightness! Even if I increase the brightness to value 255, I don't see a drop.
So probably it's related to the way the strip is powered.
Here is a picture of how I powered the TeensyLC and strip.

IMG_20180128_075346522.jpg

Both the TeensyLC and strip are on a separate USB connector. Your strip is powered from the prop shield 5V pin.
Is it possible for you to power the strip from another 5V source?
I also saw on your video a black wire, a red wire and resistor on your breadboard. Are they doing something?
 
Last edited:
Thinking it all over again, the problem may be related to the 2 strips in parallel.
With this line
Code:
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); // power strip from USB port
you tell FastLED to calculate the max current based on one strip of 127 leds. But you do have 2 in parallel. Which doubles the current drawn from your USB port.
Could you try removing 1 of the strips?
 
One more remark
because I need the leds to work at almost full brightness regardless
Each RGB LED consumes about 60mA at full brightness. Having 288 leds means ~17 Amp at 5V... you will need an external powersupply.
 
I think your right about that. i ordered new strips just in case, and I can use them to test different power sources, which i think will solve that problem. thanks so much for your help.
 
Status
Not open for further replies.
Back
Top