![]() |
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? Thanks! |
Re: controlling LED strips
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: http://www.adafruit.com/products/306 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. |
Re: controlling LED strips
I can't help you with the programming but, Macetech has reasonably priced LED strips. They sell the strips by 1/2 meter increments.
http://macetech.com/store/ |
Re: controlling LED strips
Quote:
|
Quote:
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 :) |
Re: controlling LED strips
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. |
Re: controlling LED strips
Quote:
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. |
Re: controlling LED strips
Quote:
Quote:
Code:
// You can optionally use hardware SPI for faster writes, just leave out |
Quote:
And is there a way to dim the strip via PWM? Should the strip be 5V for PWM control? Thanks |
Re: controlling LED strips
Quote:
Quote:
|
Re: controlling LED strips
Quote:
BTW will it drain the battery? |
Re: controlling LED strips
Quote:
In general. LED's (in reasonable quantities) are fairly minimal in battery drain. |
Quote:
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) |
Re: controlling LED strips
Quote:
|
Re: controlling LED strips
Quote:
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. |
| All times are GMT -5. The time now is 03:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi