Teensy 3.2 + FastLed + LPD8806

Status
Not open for further replies.

Yot

Member
Hi guys,

I recently bought a Teensy 3.2 to make my LPD8806 do crazy things I use to do easily with my Arduino Uno. Unfortunately, I can't make it work correctly.
I'm simply trying the Fastled Blink example without any success. I uncommented the right lines, tried so many Data and Clock configuration, it always give me weird behaviour.
Does anyone have succeded with it?
Any help would be really appreciated.
 
There have been threads in the past that the then current version of Fastled were broken with some versions of Teensydunio. Here is a thred on github about the failure conditions: https://github.com/FastLED/FastLED/issues/339

It might help to post the example that you used with your modifications (see rule #1) so that those that use FastLed can say whether those are the correct modifications.

Note, I don't use FastLed, this is all due to various postings other have made in the last year.

If I read the thread correctly, it seems to be that if you rev up FastLed and Teensydunio to their latest versions, that the bug is fixed.
 
Been brought up before but are you level converting your LEDs? Teensy 3.2 runs at 3.3V which historically has been spotty with 5V LED strips. If you have a couple of spare LEDs you can try connecting say 5 to run off 3.3V and check if you can get the RED channel to light (other channels won't like the lower voltage). Don't use many since the 3.3V reg won't cope with the current.

If that's the problem then you'll need to work out a solution to getting your levels stepped up. Prop shield is the off the shelf solution, otherwise there are assorted breakouts. A hackky solution is to sacrifice a single LED and wire it so it's got a standard diode in series with power and ground (two diodes). This means it's running on 4V, offset from ground by 0.5V and MAY be able to both read the 3.3V output and output level high enough for the remaining 5V LEDs to read. Exact results will depend on exactly how your LEDs are fabed.
 
Yot, we want to help. But we need to see what you are doing. Please post your code and show us your circuit (photo, diagram, or both).
 
Thanks Michael, I'm going to check this!
@Gremlin, I'm using a separate 5V 10A Power supply.
@Markonian: As I said, the code is the Fastled Blink example you can find in the Examples of the fastled library.
Here's a diagram Diagram.jpg

I'm going to dig the thread on Github and give a feedback
Cheers
 
That likely won't work without level conversion. It may work for some LEDs, but it is not guaranteed to work.

The problem is you are feeding the LEDs 5v of power, but the data/clock signals are only 3.3v. The LEDs may/may not recognize the power transition in a 3.3v signal. You need to convert both data/clock signals to 5v (or at least higher than 3.3v). Alternatively, assuming the LPD8806 can handle 3.3v, drop the power down to the LEDS to 3.3v.

In particular, the 74AHCT125 tends to be recommended for converting 3.3v to 5v for LEDs: https://www.adafruit.com/products/1787.

If you add the prop shield (either with the motion sensors, or the LC version without), it has a buffer to level shift pins 11 and 13 to VIN for APA102/WS2812B LEDs. Note, on the prop shield you need to set pin 7 high to enable the LED conversion. The prop shield also includes a mono amplifier, if you eventually want to add sound effects.

There are bi-directional level shifters meant for i2c buses, that don't have a good reputation for high speed lights. But I have used the Pololu level shifter for neopixels (ws2812b) LEDS: https://www.pololu.com/product/2595, but the above two level shifters are probably recommended.
 
Last edited:
Thanks Michael, I'm going to check this!
@Gremlin, I'm using a separate 5V 10A Power supply.
@Markonian: As I said, the code is the Fastled Blink example you can find in the Examples of the fastled library.
Here's a diagram View attachment 8484

I'm going to dig the thread on Github and give a feedback
Cheers

You'll also need to connect the Teensy's GND to the GND in common with the LEDs and power supply.

I'd also recommend powering the Teensy from your 5V Power Supply rather than USB Power. That way the Teensy can still control the LEDs when not connected to a computer.

I second other's recommendation adding a level shifter. This will make the circuit MUCH more reliable.

Here's a known good circuit:

PixelDriver 1.0 schematic.png

Edit...

Notes:

1. Teensy has had the trace cut between VIN and VUSB on the underside of the Teensy
2. The 74HCT125N is powered from VIN (+5V)
3. The choice of pins for driving the LEDs is somewhat arbitrary. Any other unused digital pins would work as well. A Teensy 3.2 is very fast at even bit-banging (https://github.com/FastLED/FastLED/wiki/SPI-Hardware-or-Bit-banging)
 
Last edited:
You'll also need to connect the Teensy's GND to the GND in common with the LEDs and power supply.

I'd also recommend powering the Teensy from your 5V Power Supply rather than USB Power. That way the Teensy can still control the LEDs when not connected to a computer.

I second other's recommendation adding a level shifter. This will make the circuit MUCH more reliable.

Here's a known good circuit:

Thank you very much Markonian. I'll do that too. Going to work on that today (pacific time). I'll keep you posted!
 
Ok now it's working!

I cut Vin from VUSB as shown here: https://forum.pjrc.com/threads/1922...ng-VIN-from-VUSB-Teensy-3-0?p=44024#post44024. My Teensy is no longer powered via USB.
I then connected the 5V from my Power supply to the Vin and the Ground from the Power supply to AGND. Now both Teensy and the LPD8806 are powered with 5V by the same Power Supply.

Also, something that confused me more is that in the Fastled Library, the 'Red' color is green and the 'Green' is red. Blue and White are ok though.

Thanks for your help guys. I'll post here if I have other issues. Cheers
 
Note, generally you want to connect the ground of your power supply to one of the GROUND pins (either on the opposite side of the Teensy from VIN, or in the back row). The AGND pin is an analog ground, and it is used for improving the accuracy of analogRead operations (you use AGND for pins that you want to use analogRead with or when processing the digital/analog converter). I believe the difference is the AGND has extra filters on it, so it is a cleaner ground.
 
Hey it's me again. Everything is going pretty well apart 1 issue I can't understand.

I made a function to generate random lighted dots. Here:

void yotrandom(int r, int g, int b) {
for (int dot = 0; dot <= num_leds; dot++) {
choice = random16(2);
switch (choice) {
case 0 :
leds[dot].setRGB(r, g, b);
break;
case 1 :
leds[dot].setRGB(0, 0, 0);
break;
}
}
FastLED.show();
}

It works well 70% of the time but gives me a total black sometimes.
The weird thing is if i change case 1 like this:
leds[dot].setRGB(0, 0, 1);
... it works perfectly.

I just can't do 0, 0, 0, without glitch.

I tried
leds[dot] = CRGB::Black;
but it's the same glitchy result

Any help would be appreciated.
Cheers
 
Check your for loop. Is num_leads the number of leds, or number of leds -1?

That <= will mean you may be writing zero off the end of the array. Try just <
 
Last edited:
Yeah num_leads it's the number of leds. I want to go with <= to stop once the entire led strip is set. If I go <, it will repeat the action indefinitely. I don't want that.

Anyway, it's more like a bug. As I said, it works perfectly well when r=0, g=0 b=1 (whatever r or g or b value is at least 1) and get glitchy when r= 0, g=0 b= 0 or CRGB::Black;
 
Last edited:
From my read of
for (int dot = 0; dot <= num_leds; dot++) {
you start at 0 (led 1) and keep going to num_leads, which is last led+1 in the strip due that 'start at 0' thing.

So good odds that set pixel command is hitting a memory location that's used for something else that shouldn't be zero.

Welcome to the world of manual memory protection.

There is quite possibly something else going on but going outside the array won't be helping anything.
 
I think you're right.
I am going to stop using <= for all of my functions. I did that because it stopped looping the function (what I want) but it seems not to be the proper way to do it.
Gonna dig another way to do that!

I'll keep you posted.

Thanks again for your help.
 
There are lots of ways to do it, but the fastled Cylon examples uses:

void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds.nscale8(250); } }

have fun. Next trick is when you want to slide an effect down a strip by copying everything up one. Lots of ways to make that do something unintended.
 
There are lots of ways to do it, but the fastled Cylon examples uses:

void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds.nscale8(250); } }

have fun. Next trick is when you want to slide an effect down a strip by copying everything up one. Lots of ways to make that do something unintended.


That's rad! Thanks Gremlin.
 
Status
Not open for further replies.
Back
Top