controlling LED strips

I know there are many kinds of LEDs out there,
and for next season I thought it would be best for our team to buy one color LEDs which you can control each LED separately.

I’d like to ask for help with that…
How can I control each LED in LabVIEW?
(And if you know some electrical things) How is it connected to the robot?


I can’t really help with the LabView code directly, as my team uses Java.

But we used these strips for the first time this year:
They also have a newer version of the strips (NeoPixel) which use a different LED driver, long story short, you can get more LEDs for less money with the NeoPixel version. These weren’t available until recently though, so I have no direct experience with them.

I’ll describe how we implemented things and hopefully that can get you moving in the right direction.

The color and brightness for each LED in the strip we purchased can be modified through a “SPI-like” protocol. The cRIO should be able to talk to these LEDs directly, but a lot of work has been done by the people at adafruit to get the non-standard elements of the communication protocol working on an arduino. Since this library is tested and working, we decided to offload all the communications with the strips themselves to an arduino.

In our case there were a number of different light sequence which we wanted to play, or colors we wanted to display, depending on what was going on with the robot. for example, when our shooter was raised we would display a certain color, when it was lowered, a different color, when our shooter was up to speed we would flash the lights white, etc.
The ardunio was responsible for knowing how to set the LEDs to the right colors depending on what ‘mode’ we were in. There are plenty of good examples of code that controls the LEDs here.

So the next step is bridging the gap between the arduino and the cRIO. There are many ways which this could be accomplished (RS-232, Relay outputs from DSC, Digital outputs from the DSC, etc.). Probably the simplest way would be to use the digital I/O channels on the digital side car (DSC). For example one digital output channel on the cRIO could be assigned to the shooter position (raise/lowered) when the signal is high (5v) the shooter is raised, when it’s low (0v) the shooter is lowered. A wire between the digital output on the DSC and an input pin on the arduino is all you need to represent these two states. If you need to indicate more items, just add more wires. If you have a lot of data to convey, this can start to require quite a few wires, and digital output channels on the DSC play double duty as digital inputs. You may need these for encoders or other sensors on your robot (this is why we ended up using Relay outputs - since we had spares, same principles apply with them). So plan accordingly.

The last thing worth mentioning is power for these devices. The arduino itself needs to run off 5v. The 5V supply on the DSC is sufficient to power the arduino, but can’t supply enough current to power the LEDs. There are two pins near the end of the digital IO channels which is a spare set of 5v and gnd connections that’s convenient to wire to.
Read the spec for the lights you buy. It will tell you how much power or current they draw. The most current (worst case) will be drawn when all the lights are white and running at full brightness, so you should design for this to be safe.
We purchased some little 3Amp 5V power supplies off of ebay. I think they were around $5, but you could make your own from a bunch of linear voltage regulators (LM7805) you could buy from most RadioShacks if you are in a pinch. Regardless of which regulator you go with, the input wires of the supply will connect to the PD board (suggest a 20A breaker - or smaller if you have them). The output wires of the supply will connect directly to the LED strip.

If you have other specific questions, let me know. If you don’t get a reply, PM me as I don’t get on CD all the time during the off season.

I can’t help you with the programming but, Macetech has reasonably priced LED strips. They sell the strips by 1/2 meter increments.

Based on requiring timing of 100ns, you wouldn’t be able to use the NexPixel ones directly with the cRIO, so you’d have to use an arduino or another co-processor.

The problem is that I have zero experience with arduino, will it be hard to learn using it for the LED control?
Which kind of arduino should I get for this? I want it to be strong enough for image processing in the future.
And about the connection between the arduino to the DSC - is there a way to give a numeric output like the game time?
Thx a lot for the detailed answer :slight_smile:

We used the same LED strip from Adafruit as 2168 and attached it to our robot cart instead of the actual robot. We used an Arduino Uno board, powered by a 12V rechargeable battery provided by a mentor. Then we used the DC/DC power converter from the KOP for the LEDs, since they only take 5V.
For the programming, download the LPD8806 Arduino library. It gives a couple example sketches with which you can learn how to customize the LED sequences. One of our mentors had prior experience with Arduino, which helped a lot with more complex sequences. but basic control is pretty simple and fun to learn. There are a ton of additional resources and tutorials on Adafruit.

Is that necessary to buy the same LED strip model from Adafruit to use the LPD8806 Arduino library?
If so, what should I look for in a LED strip to be sure it works with the library?

I live in Israel and prefer buying a LED strip in Israel rather than paying more for shipment.

I didn’t actually buy my strip from adafruit. As long as the strip you buy uses the LPD8806 as the LED driver, the arduino library should work.

Which kind of arduino should I get for this? I want it to be strong enough for image processing in the future.

We used an Arduino uno r3 clone from deal extreme, simply because it was on sale for $15. The specific one we got is no longer in stock. Most arduino models should work though. The comments in the example code referring how to wire up the strand to the arduino list quite a few:

// You can optionally use hardware SPI for faster writes, just leave out
// the data and clock pin parameters.  But this does limit use to very
// specific pins on the Arduino.  For "classic" Arduinos (Uno, Duemilanove,
// etc.), data = pin 11, clock = pin 13.  For Arduino Mega, data = pin 51,
// clock = pin 52.  For 32u4 Breakout Board+ and Teensy, data = pin B2,
// clock = pin B1.  For Leonardo, this can ONLY be done on the ICSP pins.
//LPD8806 strip = LPD8806(nLEDs);

As far as doing vision processing on an arduino goes… I wouldn’t plan on it. They aren’t well suited for the computations required to quickly process images. Not if you’re using an IP camera at least. You could probably get something working with a camera that does some of the processing for you, like the CMUcam. Although it didn’t make it on to the robot, we had very good results using openCVon the original beaglebone this year. I believe other teams have gotten rasberrypi’sto work as well, although I can’t really speak to how well that worked out.

I decided to focus on one color LEDs first (non-addressable), I found that I can power a 12V LED strip with a spike. How fast can I blink the LEDs with a spike, I’ve read it’s limited.

And is there a way to dim the strip via PWM? Should the strip be 5V for PWM control?

The Spike is a mechanical relay. You’ll be limited by the physical response time of the contacts. (And you’ll eventually wear it out if you switch it too often, though it’s probably in the tens of millions of switching events.)

And is there a way to dim the strip via PWM? Should the strip be 5V for PWM control?

If you want 12 volt dimming, you can use a speed controller such as a Victor or Talon.

If I use a speed controller for the LEDs, how fast can I blink it while not breaking it?

BTW will it drain the battery?

A speed controller will allow virtually infinite levels of dimming. It’s ability to blink is dependent on how fast if can switch off and on. Different speed controllers have different specifications here.

In general. LED’s (in reasonable quantities) are fairly minimal in battery drain.

Ok, I’ll try different speed controllers to test that.

I’ve just thought about it, if the battery is more than 12V, would it damage the LEDs? (When the value for the controller is 1)

If you have 5V LED strips, then yes. I use 12V LED strips.

Just to make sure there aren’t any future misunderstandings…
Going along with your logic above, you wouldn’t just have a problem with the voltage level being too high when the controller is being commanded with a “1”. You would have a problem ALL the time.

It’s important to remember that the motor controllers don’t regulate the output voltage, they simply connect and disconnect the output to the battery (very quickly). For example when you command the motor controller to “0.5” it’s not sending you 50% of the battery voltage. Instead 50% of the time the motor controller is connected to the battery, and 50% of the time it isn’t (Call this the “off time”). What it’s doing during the “off time” how the controller is designed. It may connect both terminals to ground, or both to 12V, it may leave them both floating, or it may short the two together.

Also, if using a speed controller, you need to be careful that your output polarity never switches. Speed controllers are designed to allow you to run a motor in forward and reverse. So if you wire your lights to the speed controller and the polarity gets reversed (commanded the controller to a negative value), the light circuit may not take kindly to this. This may not be a concern if your LED circuit is literally just LEDs (Light Emitting Diodes), as the diodes themselves will prevent current flow in the reverse direction. But if the LED strip had any active components on it, they might let out their magic smoke.

For one color led strip with each led controllable,the digital addressable led strip is OK, such as what I used, 52 Pixel/M LPD8806 Led Strip, instead of RGB color LED, they were made of all WHITE color LEDs as I asked for. The strips are from:

AndyMark sells a kit AM-6245 with tri-color LEDs which are individually controllable. This might be an easy solution if you want something closer to off-the-shelf.