|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Programming RGB lighting
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 |
|
#2
|
|||
|
|||
|
Re: Programming RGB lighting
Hers a link of a bunch of diagrams of the four wires that go into the light strip:
http://www.elementalled.com/academy/...iring-diagram/ |
|
#3
|
||||||
|
||||||
|
Re: Programming RGB lighting
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: Programming RGB lighting
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" |
|
#5
|
|||||
|
|||||
|
Re: Programming RGB lighting
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. Last edited by artdutra04 : 15-02-2013 at 19:28. |
|
#6
|
|||
|
|||
|
Re: Programming RGB lighting
Quote:
|
|
#7
|
|||||
|
|||||
|
Re: Programming RGB lighting
Quote:
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. |
|
#8
|
|||
|
|||
|
Re: Programming RGB lighting
Quote:
Last edited by CooneyTech : 16-02-2013 at 09:55. |
|
#9
|
|||||
|
|||||
|
Re: Programming RGB lighting
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.
|
|
#10
|
|||
|
|||
|
Re: Programming RGB lighting
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.
|
|
#11
|
|||
|
|||
|
Re: Programming RGB lighting
I talked to some mentors and we are going to power it off a DIO with some solid state relays.
|
|
#12
|
|||
|
|||
|
Re: Programming RGB lighting
Quote:
SSR's only work on and off |
|
#13
|
|||||
|
|||||
|
Re: Programming RGB lighting
Quote:
The LEDs intensity is controlled by PWM (Pulse Width Modulation) which IS an ON/OFF function. They are on the right track here. Last edited by Doc Wu : 18-02-2013 at 15:45. Reason: Capitalization |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|