View Full Version : LED RGB Lighting
We are trying to use RGB LEDs on our robot. We want to be able to change the color of all the LEDs when we program it to. We've heard that several teams are using AdaFruit Neopixel LEDs, but they require an arduino to control them. Is there an LED strip that we would be able to power/control just by using the DIO ports on the roboRIO?
When you control the colors, do you want individual LED control or just the strip as a whole? If individual, you're going to need to use something other than DIO. If strip level control is fine, you can hack something together using motor controllers or DIO.
If you're comfortable with the programming, you could attempt to port FastLED (http://fastled.io/) to WPILib. I think other teams have also previously been successful with controlling NeoPixels directly from the RIO.
With a 4 channel 12V relay module (e.g. http://www.lightinthebox.com/4-lines-12v-relay-module_p1257513.html?category_id=31494&prm=1.2.1.0), and an RGB strip of LEDs (e.g. https://www.sparkfun.com/products/12023), it should be straighforward. You would use three DIO ports, one each for red, green, and blue, to control three of the relays, each of which controls power to one of the colors. For this application, you want a "non-addressable" LED strip. This means that all of the LEDs of a given color all go on or off at the same time. Addressable strips would require a microprocessor or a fair chunk of CPU time to send specific colors to specific LEDs on a strip.
Edit: fixed first link. Also, note that I recommend NOT using the ground jumper for a 12V relay module - let the opto-isolator do its job!
Bkeeneykid
07-08-2016, 15:36
A slightly more expensive alternative to NeoPixels are Adafruit's own Dotstar lineup. They are slightly more expensive than NeoPixels, and don't come in as many varieties, but just simply use SPI and don't require the specific timing that makes NeoPixels so hard to use with the Rio.
Link: https://www.adafruit.com/categories/885
gerthworm
08-08-2016, 11:52
This year, we used Adafruit APA102 DotStar LED strips controlled off the SPI on the RIO. Incidentally, I'd prefer to use an external device (probably arduino) to not soak up processor time on something which probably isn't as important as actually controlling the robot. However, if you're interested, here's our driver for those from 2016:
https://github.com/RobotCasserole1736/CasseroleLib/blob/master/java/src/org/usfirst/frc/team1736/lib/LEDs/DotStarsLEDStrip.java
Not sure if it helps, but you can use a typical SPI to control the data line for neoPixels.
We did it for the HERO robot controller...
https://github.com/CrossTheRoadElec/HERO-Examples/tree/master/HERO%20NeoPixel%20Example
...basically just make each pixel bit a SPI byte. So if all you have is a SPI, you could get it to work.
Flipflop13
08-08-2016, 17:37
A slightly more expensive alternative to NeoPixels are Adafruit's own Dotstar lineup. They are slightly more expensive than NeoPixels, and don't come in as many varieties, but just simply use SPI and don't require the specific timing that makes NeoPixels so hard to use with the Rio.
Link: https://www.adafruit.com/categories/885
Pretty cool find. We used neopixles this year with an arduino co-processor, but if you can just plug them right into the rio that would save a bunch of effort.
Do you externally power the LEDs or use roboRIO power?
Bkeeneykid
08-08-2016, 17:38
Pretty cool find. We used neopixles in the past with an arduino co-processor, but if you can just plug them right into the rio that would save a bunch of effort.
Do you externally power the LEDs or use roboRIO power?
We personally haven't used the DotStars, but we used NeoPixel equivalents in the past. We used one of the 12V to 5V regulators on our 2014 bot to drive them there through a Arduino.
Our team uses LabVIEW to control the robot. We are looking to just change all the LEDs on the strip to different colors, instead of trying to control each individual LED.
Our team uses LabVIEW to control the robot. We are looking to just change all the LEDs on the strip to different colors, instead of trying to control each individual LED.
I really think this would be easier to do with an arduino - but that may just be because I've done it before. I believe you got an arduino voucher in the KOP - if you need any help with the programming, just let me know. You should be able to use a simple loop to change the LED colors on the arduino - probably even simple digital out signals to change the program from the roborio.
Our team uses LabVIEW to control the robot. We are looking to just change all the LEDs on the strip to different colors, instead of trying to control each individual LED.
In that case, refer back to my post (#4). We used a very similar system using spike relays in 2014 in java; there's no reason it would not work with DIOs using the relay module I listed. (Both the team and I have used these modules with Arduinos.) Using this or a similar 12V relay module with the common ground jumper removed, the DIOs only need to drive a tiny LED on an optoisolator (already ballasted with a resistor on the module), and you can use unregulated 12V to drive the relays and the LEDs. Unless you have an unusually long strip of LEDs, you can power all three colors and the relays off a single PDP breaker.
I also recommend using an Arduino to control the lights. You can easily signal your color changes using I2C or just DIO changes.
An advantage to using a separate co-processor is that you can decouple the lights programming from the rest of the robot development. You can develop and test while the robot or the roboRIO is being used elsewhere. Being carefully mindful of the rules, you might be able to make lights programming part of your off-season training. Or, reprogram the lights after bag-day.
We ordered the Adafruit DotStar 32 led strip, and we are having trouble sending data to it over LabVIEW. It is powered through the 5V/2A port on the VRM and is connected to the SCLK, MOSL, and ground ports on the roboRIO. We are currently sending over an array that contains four 255s, 32 sets of 255 , 50, 50, 50 and then four more 0s. Does anyone have a LabVIEW library that already works with the DotStars? Any help would be greatly appreciated.
Bkeeneykid
21-08-2016, 16:50
We ordered the Adafruit DotStar 32 led strip, and we are having trouble sending data to it over LabVIEW. It is powered through the 5V/2A port on the VRM and is connected to the SCLK, MOSL, and ground ports on the roboRIO. We are currently sending over an array that contains four 255s, 32 sets of 255 , 50, 50, 50 and then four more 0s. Does anyone have a LabVIEW library that already works with the DotStars? Any help would be greatly appreciated.
First, I'm going to assume that you meant MOSI, saying I have no idea what MOSL is. The Adafruit guide mentions that the DotStars may not work with 3.3v signals, which the RoboRio provides. You can use a signal level shifter such as this one to change this: https://www.adafruit.com/product/1787
NOTE: I've never used the DotStars before, so this may not be a problem.
gerthworm
21-08-2016, 19:50
We are currently sending over an array that contains four 255s, 32 sets of 255 , 50, 50, 50 and then four more 0s.
As referenced in the other post, I am wondering if you're being hit by the same 128-byte limitation we found (4+4+32*4 > 128)... Not sure if labview gets around it or not? In any event, try sending only 16 of the sets for now - it'll only light up half the string, but would let you test if the 128 limitation is in play here or not...
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.