Teensy 3.2 + PropShield + 144LED/m Dotstars Partial LED Issue

Status
Not open for further replies.

Goose007

Member
Hi all,

I'm a complete noob when it comes to programming, and I picked up an Arduino based project to get my feet wet. Ultimately, I want to utilize my setup to go into a lightsaber project. My hardware currently consists of the following for the LED portion of the project:
- Teensy 3.2
- Prop Shield
- DotStar 144 LED/m Strip
- No external power, utilizing USB power

Problem Statement: To get familiar with various code elements I've decided to use the NeoPixel Strandtest example, and I've modified it to accept the prop shield (pin 7 enabled), and the Dotstar library for my strip. The problem is that when I put in 144 LEDS in the code I get a first colorwipe up the strand but then it goes all red with flickers. If I change the code to only using 30 LEDs everything loops as expected in the code with color changes, theater style, etc... Below is the code I'm using:

Current Root Cause Thoughts: Not enough power for the LEDS through USB input. If this is the case: What do I need to do to enable USB uploading while having external power supply? I have a DC 4.5V input plug that I can route direct to the propshield (5v, GND) but I read that I need to terminate a link between USB Voltage and PropShield Voltage??? Or, can I supply power externally to the Dotstars? I would prefer something within option #1 to eliminate extra wiring/connections in the future. Any help is much, much appreciated.


START OF CODE:

#include <Adafruit_DotStar.h>

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN 7
#define NUMPIXELS 30 // Number of LEDs in strip

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)

Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DOTSTAR_GRB);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {

pinMode(7, OUTPUT);

strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
digitalWrite(7, HIGH); // enable access to LEDs
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(255, 0, 0), 50); // Red
colorWipe(strip.Color(0, 255, 0), 50); // Green
colorWipe(strip.Color(0, 0, 255), 50); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
// Send a theater pixel chase in...
theaterChase(strip.Color(127, 127, 127), 50); // White
theaterChase(strip.Color(127, 0, 0), 50); // Red
theaterChase(strip.Color(0, 0, 127), 50); // Blue

rainbow(20);
rainbowCycle(20);
theaterChaseRainbow(50);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

void rainbow(uint8_t wait) {
uint16_t i, j;

for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;

for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();

delay(wait);

for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel
for (int q=0; q < 3; q++) {
for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, Wheel( (i+j) % 255)); //turn every third pixel on
}
strip.show();

delay(wait);

for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
 
You will definitely need an external power supply.
Each Pixel can use as much as 60mA, when full bright white. That's over 8 Amps! for a full white 144 LED strip.
Most USBs only supply 0.5 to 2A.

I'm assuming that the PropShield is mounted on the Teensy.

Power the DOTstars from a 5V 9A DC Power supply (Ground and +5V)
Power the Teensy through the USB connection.
Connect the clock and data from the LED strip to the PropShield pins.
Tie ONLY the GROUND from the power supply to the Teensy ground.
There is no need to cut the trace on the Teensy for USB power.
Don't forget to enable the level shifter on the PropShield.
 
Wozzy, thank you for the quick reply. A couple of clarifying questions, then I will give this a try (also, yes, the propShield is mounted to the Teensy):

1. I have the DotStar connected to the propShield's 5V, GND, Data, Clock, and I'm assuming I keep this as is, and apply the external power to the additional red/black lines of the DotStar (or do I remove the 5V from the PropShield and supply direct to my external supply?)
2. I'm not familiar with the terms "level shifter". I'm enabling the LED pin (7) in the code, is this what this means?

Again, thanks for your help.
 
If you are powering the Teensy and PropShield from the USB, do not hook it to the +5V from the external power supply. If you really want to hook it to the 5V supply, while the USB is hooked up then you will need to cut the trace on the circuit board. Alternatively, you can perform a minor surgery on the USB cable and cut the +5V wire (usually, but not always the red wire)

Oh and yes, Pin 7 controls the enable pin on the level shifter located on the PropShield
 
Last edited:
Update: I loaded the code, and then powered via external supply (no USB attach), and everything worked as expected. Wozzy thank you for your help!!!
 
No Problem.
It always makes people happy if you post some photos of your working project.
This thread may help someone else down the road that has similar questions or problems.
 
Alright, took some pics on the setup + switch over to external supply for the Teensy 3.2 mounted to prop shield.

This is the setup with USB Supply (Note: I had two swap the data and clock outputs from the Dotstar LEDS to match the Propshield output config)

USB Supply.jpg

Here is a close up:

USB Supply Close.jpg

THis is the setup with the external supply (Note: USB removed during this setup, and the external supply is fed directly to the propshield left side inputs)

External Supply.jpg

Next task is to try this same code with a button input for power on/off the LED, and cycle colors...
 
Status
Not open for further replies.
Back
Top