Questions about LED strips

I've been searching for some time on projects with LED strips and I'm having trouble with some calculations.


1. How can I calculate which resistor and which transistor (using the direct connection or Darlington connection) should I use for an unaddressable LED strip of given length?

In a simple RGB LED strip, that is not addressable, we have 4 lines (VIN, R, G, B). The lines R, G and B will be controlled via an ESP8266. The ESP8266 is a 3.3V device that can only provide 12mA on GPIO pins. To be able to provide enough current to fully light up a channel (~20mA for every 3 LEDs) I need to use transistors to raise the current to the point I need.

These are the calculations I already know:

  • amps needed: (#LEDS / 3) * 20mA
  • watts needed: V * I => 12V * (#LEDS / 3) * 20mA

What I still don't know how to calculate:

  • With an NPN transistor's datasheet, find the base resistance I need to use that will make the emitter output enough current to fully light up a channel in the LED strip
  • If a single transistor will not be able to achieve the desired current, how do I calculate the same as above but using a Darlington pair?

2. How many LEDs can 1 Arduino (specifically an ESP8266) control before we see some kind of lag?

An addressable LED strip has 3 lines (VIN, GND, DATA), VIN and GND can be wired in parallel but DATA needs to be wired in series if we have one single controller. I'm tasked with building a LED panel that would have more than 2000 LEDs (yes, that massive) and I'm a little afraid one data source will make the last LEDs take too long to receive the command and lag behind.


This is what I have researched so far:

My question on StackExchange that confused me more than helped: https://arduino.stackexchange.com/questions/52532/rgb-led-strip-is-too-dim

My topic on power supply that cleared how to calculate the power needed: http://forum.arduino.cc/index.php?topic=546221

  1. How can I calculate which resistor and which transistor (using the direct connection or Darlington connection) should I use for an unaddressable LED strip of given length?

Provide a link to the datasheet of the strip you're planning to use! A transistor is probably not the best choice here, a MOSFET might be the better match.

  1. How many LEDs can 1 Arduino (specifically an ESP8266) control before we see some kind of lag?

The bigger problem usually is the 5V power supply. You cannot have 2000 pixels in row, after 100-200 of them you won't have enough power to light the LEDs. You have to make multiple strips because of the power anyway so you can have one pin per strip to control it. The speed on the data line depends on the strips used (once again, why don't you provide links to the datasheet?) but even the faster versions cannot have more than about 400 Pixels to get an update rate of 50Hz. As you didn't provide information about what you think is a lag, we cannot go into more detail.

pylon:
Provide a link to the datasheet of the strip you’re planning to use!

This is for the transistor I have right now (TIP31): https://www.hobbytronics.co.uk/datasheets/TIP31.pdf

pylon:
A transistor is probably not the best choice here, a MOSFET might be the better match.

Can you elaborate on that? I’ve never used a MOSFET, how do they work? Are there many MOSFETs available? How do I choose which is best?

pylon:
The bigger problem usually is the 5V power supply. You cannot have 2000 pixels in row, after 100-200 of them you won’t have enough power to light the LEDs. You have to make multiple strips because of the power anyway so you can have one pin per strip to control it. The speed on the data line depends on the strips used (once again, why don’t you provide links to the datasheet?) but even the faster versions cannot have more than about 400 Pixels to get an update rate of 50Hz. As you didn’t provide information about what you think is a lag, we cannot go into more detail.

I didn’t buy the LED strips for the panel yet. I’m in the research phase.
As you stated I can’t have the whole strip powered by one single power source. I need one at every ~200 LEDs.

In this video build your own flexible LED Display at 3m39s it shows that one power supply not strong enough to power everything. I’m ok with having a couple of power sources along the panel

What it didn’t see is how many data sources were used to control the strip. Because the wiring I assume it is just one data line shared with all screen lines and yet it can play a youtube video fine (no visible lag)

This is what I’m asking, how big can we make the panel before it starts to show visible lag. How far can one data line reach before a section starts to lag behind and make the video deform?

I agree a MOSFET is probably a better choice because they can carry more current with less heat. (The calculations/approximations are easier for a MOSFET.) But with a MOSFET 3.3V may not be enough to turn it fully-on and you'll probably need a transistor or another MOSFET (and a higher voltage source) to drive it.

With an NPN transistor's datasheet, find the base resistance I need to use that will make the emitter output enough current to fully light up a channel in the LED strip If a single transistor will not be able to achieve the desired current, how do I calculate the same as above but using a Darlington pair?

I assume you know Ohm's Law?

The Base-Emitter saturation voltage is about 0.7V, so as an approximation we can assume (pretend) that you'll have ~5V across the base resistor and we can calculate the base current from Ohm's Law.

A transistor is a current amplifier. The current gain is the Beta specification on the datasheet. If the Beta is 100, we need at least 1/100th of the collector-emitter current into the base. For example, if we need 10 Amps, we'll need at least 100mA into the base. 5V/0.1A = 50 Ohms. But since we want to make darn-sure we fully-saturate the transistor, we'd want to use 25 Ohms or less.

With a Darlington the Betas are multiplied and the TIP121 is specified at 2500 (so you can use a higher-value base resistor).

  1. How many LEDs can 1 Arduino (specifically an ESP8266) control before we see some kind of lag?

I don't know but I'd be concerned about that too... There are 3 factors...

  • How fast can the LED strips operate? What's the data-rate/bitrate and how many bits/bytes does it take to "command" an LED?

  • How fast can the Arduino transmit serial data?

  • How much other processing is the Arduino doing and how much does that slow-down data transmission? (That would have to be done experimentally... Run something like 100,000 or 1 million loops and check the millis() timer to see how fast it's running.)

Another factor could be memory... The current on/off state of 2000 LEDs requires 2000 bits (250 bytes) or with 8-bit dimming it's 2000 bytes. Of course, the LED strips have their own memory so depending on what your doing you might not need to save that in RAM. Or, you may need to save multiple "patterns" and you may need even more memory.

Also, if you put a bunch of neopixel strips in a string a failure or bad connection anywhere along the string will shut-down ALL of the following LEDs.

This is what I'm asking, how big can we make the panel before it starts to show visible lag. How far can one data line reach before a section starts to lag behind and make the video deform?

I did that calculation in my answer at the end but as you didn't specify which type of pixels you have/plan to use I simply used the faster version. With that version you might see the delay at about 400 Pixels. But as you didn't define what a visual lag is I simply used a safe value of 50Hz. I don't know if an ESP8266 is able to handle about 5 pins simultaneously updating in the fixed frequency the pixels need. I doubt that there are ready made libraries that can handle that without flickering.

There are plenty of 3.3V MOSFETs that can handle serious current (and all that in a SOT-23 package - that’s the downside - but they do neatly fit in between three hole of perfboard :-)). My ESP8266 is switching 40W worth of 12V LED strips without issues. Almost double that should be possible based on the specifications of the MOSFET, haven’t had the need for it so didn’t try.

Types I used: PMV16XN and IRLML2502. The dual MOSFET FDS9934C works fine, too, at 3.3V gate levels.