Programming RGB lighting

Anyone know of a way to wire these lights to the robot so they can be powered and programmed through the cRIO in Labview?

Here’s the link for the diagrams:

What lights are those?

I imagine decorative lights typically get wired to a Spike for power, and controlled as a Relay.

You may receive better help if you post a link to which specific type of LED lights you are using.

Some RGB light strips have no computerized control, so you’ll have to bit-bang them to get custom colors. Others have have communication protocols (like serial or I2C), potentially with individually addressable lights.

Sorry forgot to include link:
http://www.amazon.com/LEDwholesalers-Controller-2034RGB-3315-3215/dp/B0040FJ27S/ref=pd_bxgy_hi_text_y

they are leds with 4 pins that using pwm allow them to display any color you want by mixing internal red blue and green leds

i think you could connect just 1 led you could use 4 different dio pins but not knowing the max current draw on a dio i cant say for sure

My issue is:
1: How do I use four different DIO pins to program it?
2: I don’t know how to exactly program the lights or even how to define them in begin for that matter.

I didn’t find a guide that explained how to control it, but if it truly is PWM, the PWM is available in the I/O palette, but the PWM term used in FRC is hobby servo PLM generation. General PWM duty cycle is different.

If it wants PWM, you may be able to use digital lines and a timed loop, or you may need to use an external circuit.

If you can post a link to the documentation for the lights I’m sure someone can help get it working.

Greg McKaskle

Hers a link of a bunch of diagrams of the four wires that go into the light strip:

In the digital ouput pallete, there are some VIs for generating what appears to be general PWM (there is both a duty cycle and a frequency). I have not tried them however.

Not getting into the specifics of your situation, but in general:

An RGB LED can display most any color by varying the amount of Red, Green and Blue light emitted. For example, if you show 100% red and 100% blue, you get purple.

A 4-pin RGB LED - a raw LED, not one with a controller - has one pin for red, green and blue, plus one common pin. This common pin can be anode or cathode, depends on the device.

ALL LEDs require a dropping resistor, even if the supply voltage is lower than the lED voltage. Google “thermal runaway of LEDs” to see why. You might need to put a resistor in each color’s control line, or maybe one in line with the common.

To make a color - white, let’s say (which is R, G and B in a certain percentage of each, not 100% each) you control the three control pins with a duty-cycle of between 0% and 100% – for white you use R=0.3, G = 0.59, and B = 0.11 (relative to absolute brightness - YMMV)

So turn on the Red pins with a 30% duty cycle, green with a 59% duty cycle, and blue with an 11% duty cycle. To change the color, change the duty cycles.

If your Digital Output pins don’t “so” duty cycle, you can “bit bang” one anyway. See how fast it can deliver a signal of 10101010, and then change that signal as necessary (e.g, 25% is something like 11000000, 50% could be 11001100 or 11110000)

Hope this helps understand the “why”

To actually control the color of these LEDs, you will have to manually generate the duty cycle for each color in your code using the generic duty cycle (0-100%) functionality to three output pins on the Digital Sidecar (one for each primary color). In essencse, you replace the giant control box on these LED light strips with the FRC control system, and wire directly into the four wires going into the LED light strip.

In addition, the signal pins on the DSC will likely not be able to provide enough current for lighting bright LEDs; in this case you have to use a signal amplifier, such as a homebrew solution using transistors and other discrete components or a COTS solution such as s solid-state relay. Mechanical relays (such as a Spike) will likely not be able to switch fast enough.

Edit:
To actually pink which color you want to generate, look up HTML hexadecimal color charts. Hexadecimal is a base-16 number system, where 0-9 are the same, but A=10, B=11, and so on until F=15. So for example, FF in hexadecimal would be 255. The sequence is 2 digit red, 2 digit green, 2 digit blue, so the hexadecimal color #FF6600 is 255 (out of 255) red, 102 (out of 255) green, and 0 blue.

To convert these three numbers to a generic duty cycle, divide by the large possible number (255). So it becomes

Red: 100%
Green: 40%
Blue: 0%
**
Which will generate the color orange.**

For the pwm which color goes where in the PWM(the red, green, and blue wire)? and where does the common wire go(the black wire)?

You will have to put each color onto a separate PWM output channel. Each color needs to be pulsed at a different frequency to generate different colors. The reason you have to pulse the wires to generate different colors is because the digital circuit only goes on or off, there is no in between value. So if you pulse on and off really quickly, you create the “average color” that is seen by the human eye. To achieve this, you should pulse at least 60 times per second, ideally at least 100, to make the colors look smooth.

For the remaining black wire, the wiring diagrams in the link above seem to have some units with this labeled positive, some are not labeled at all. Depending on whether the remaining wire is positive or negative will affect how you need to wire not only this wire, but also the signal amplifiers for the RGB lines.

But… check the control box that comes with these LED lights. See if there are any additional ports on this unit, such as a serial/UART, I2C, SPI, etc. Sometimes these RGB LED light sets have additional input ports, to allow an external controller to communicate directly to the unit to command it what to do. If this is the case, then it becomes simpler to implement it.

So for the pulsing how do I choose a color? Is it just the rate at which I pulse that particular color? I see what you mean be by on or off through my DIO blocks. I also understand hexadecimal through my web design class so that no issue for me.

The duty cycle (the ratio of how much the output pin is on versus off) for the three RGB lines determines the output LED color.

If the strip you are using is 4 wires RGB and Power/Ground, you cannot power it directly off the DSC you will need transistors because the DSC cannot handle that much current.

I talked to some mentors and we are going to power it off a DIO with some solid state relays.

Solid state relays will not allow you to mix colors you would need transistors
SSR’s only work on and off

What do you think a solid-state relay is made out of? (power FETs, SCR’s, Triacs, etc are all types of transistor.)

The LEDs intensity is controlled by PWM (Pulse Width Modulation) which IS an ON/OFF function.

They are on the right track here.