Go Down

Topic: Problem using Arduino Due with FastLED library(using WS2812B Strip) (Read 651 times) previous topic - next topic

cl894

Arduino IDE Version: 1.8.9
Hardware Model: Arduino Due R3
FastLED Version: 3.2

Setup/Wiring:
5V power supply, Din to pin 11(11k ohm resistor between the two), and GND is attached. (Super simple, but if you need a picture and diagram let me know)

All I am attempting to do is a simple LED test just to turn on one light anywhere on the strip.

My Code:

Code: [Select]

#include "FastLED.h"
#define NUM_LEDS 50
#define DATA_PIN1 11

CRGB leds[NUM_LEDS];

void setup() {
 FastLED.addLeds<NEOPIXEL, DATA_PIN1>(leds, NUM_LEDS);
}

void loop() {
  leds[5] = CRGB::Red;
  FastLED.show();
}


When I upload this, the 6th LED of the strip does not turn on at all, the first 2 LEDs on the strip turn on and flicker between random colors. I have seen many posts on this, some were left unanswered and some said it had something to do with FastLED and something which conflicts w the Arduino IDE? But have been able to find no solution.

Any help is much appreciated.

Cheers

cl894

Well I found the answer on my own so if you are having a similar problem then read below:

I tested the output voltage of my data pin wire going to the LED strip and found the voltages to be really low. I never thought of checking the operating voltage of the Arduino board (for the Due = 3.3 V) which I thought was 5 V because I just worked with other Arduino boards which all operated at 5 V and I just didn't even think about it.

Problem:
I am running the strip at 5 V and you can't simply run a 3.3 V board on a 5 V strip, I don't know the science behind it, find that else where, but it makes sense intuitively.

So the solution to this is to essentially add a transistor to bring that 3.3 V signal up to 5 V before it goes into the strip. Working on this circuit of the transistor now and if anyone is interested I can post a picture of it later or something.

Cheers


Grumpy_Mike

The problem is that a transistor must be able to work at a speed of 800KHz so the design requires the right sort of transistor. Also the transistor turns the signal upside down so you need to tell the library that this is the case.

For simplicity I always use two inverter gates from a 74HTC14.

cl894

The problem is that a transistor must be able to work at a speed of 800KHz so the design requires the right sort of transistor. Also the transistor turns the signal upside down so you need to tell the library that this is the case.

For simplicity I always use two inverter gates from a 74HTC14.
Ah ok, I just made a transistor amplifier, Im getting 5 volts out the end now but the signal still isn't getting through or something to the LED strip. Is this the frequency thing you speak of? I am using a BC558 transistor which has a bandwidth of 150MHz. Im relatively new to all of this transistor stuff (or at least practical application), so would this mean I would need some sort of filter on the emitter?

Thanks for the help!

Cheers

Grumpy_Mike

Quote
Is this the frequency thing you speak of?
Yes.
Plus the fact that this transistor is a PNP transistor and you can't make it work with a single transistor and a Due. How have you attempted to wire it?

Quote
which has a bandwidth of 150MHz.
That means little, as you will find out later. What matters is how you use it.

Quote
so would this mean I would need some sort of filter on the emitter?
No, not sure what you are thinking but you are on the wrong track here.

It doesn't come much simpler than this:-


As I said you can use the 74HTC14which is slightly better than the 74LS14.

Wawa

I am using a BC558 transistor which has a bandwidth of 150MHz.
Google "saturation recovery time" and "Baker clamp".
The wrong transitor circuit can slow down things a lot.
Take Grumpy_Mike's advice.
Leo..

Grumpy_Mike

From a PM about this thread:-
Quote
I really thank you for your answer here. It works! And could you give me a little explanation about why we use 2 gate ports to control (is this due to output current?) and others we connect consistently to GND through capacitor?
Each gate inverts the signal so we use two gates to get it the right way up again.

No the gate on pin 3 is connected directly to ground not through a capacitor, look at that bit again. This gives that gate a solid logic zero on the input. So the output will be a logic one fed into the next gate, that gate's output will be a zero and so on. This serves no function in the circuit and all the spare gates could be connected to ground, but it is easy to wire them up like this. The real reason is that you have to connect unused inputs on an IC to ground to prevent them oscillating and feeding that oscillation through to the gates that are being used. At low frequencies this does not matter but at high frequencies like this at just below 1MHz it becomes more important. So it is a tidy up exercise for the chip used here. If you could get a chip with only two buffers in or only one non inverting buffer you could use that, but it would be more expensive to buy these.

The capacitor is between the power supply and ground and acts as decoupling for the chip. See http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Go Up