Our team has the idea of putting 12 volt LED strip lights on our robot to signal what kind of game piece we’d like the feeders to give us, but we do not know how to control them.
These lights have one 12V power supply, then 3 ground pins for Red, Green, and Blue. They are meant to be controlled by PWM.
Ideally, we would use the outputs of the digital sidecar to control the PWM, but rule <R62> states that custom circuits can only be connected to certain things, none of which could be an output for PWM. However, if you read the rule, it mentions that “sensor inputs, custom circuits…” can only be connected to those, so we were wondering if the circuits weren’t inputs if they could be used.
The only way to control LEDs that I know of is with a Spike relay. Since each Spike contains two relays, two Spikes should be able to control the three colors.
OK, first of all be absolutely certain that your lights are not too bright. No sense in blinding anyone…
An RGB strip light is really intended for display of “any” color, by finely varying the intensity of the three primary colors using “pulse width modulation” - but this is a DIFFERENT PWM than what is used to control Jaguars and servos. The PWM outputs of the Sidecar won’t work for you.
In this case, you just want to display 3 colors (Red, White, Blue). Why not run to Radio Shack and buy an LED in each color and just connect those? Lighter, cheaper, simpler to implement. Just be sure to use a dropping resistor to bring the 12 volts down into the LEDs range - the package or an Internet resource should help you there.
Controlling would be via a Spike, or you can verify that the rules allow a Digital Output from the DSC to be connected to an LED, because that would be even simpler.
For that matter, you can even use a Spike as the indicator: It shows Red, Yellow and Green. But sometimes your alliance partner might not recognize that you’re trying to signal them if-you-know-what-I-mean.
For Lunacy we had a LED light strip to signify that a ball was ready to shoot. They came from a car supply place and were controlled by a Spike. We used blue, but they come in red, blue and white, about 12 LED’s in a 24" strip. Can you post the link to your tri-color strips?
A strip of LED’s will be easier to see rather than a single LED as you rocket across the field.
We wired it the same way you would wire the compressor. Compressor on, LED on. It sounds like your strip has a common power feed, so you would do +12 to that. You would connect the other end via the spike to ground. I’m still thinking you want three spikes to make it easy. Spikes connect to the relay points.
You could even go wild and have it be solid on for the low, slow flash for the med and fast flash for the high so your robot partners know where you going.
So the jaguar outputs are similar to standard servo outputs and don’t just turn on and off depending on how fast the motor should turn? I guess that makes sense, because the jaguar has those special abilities rather than just being an h-bridge.
We might just go with that, but we’re under the weight limit. I was also thinking of having some sort of victory dance with them.
Well, the LEDs are hard-wired to +12V and just need to be controlled by grounding them. If we attached one lead to the green and one lead to the blue, we could get blue by running the “motor” one way, which would provide +12V to one side (making nothing happen for lack of voltage differential) and GND to the other side (making the blue light up). However, the spike probably wouldn’t let us make each side GND (it would just disconnect them if we turned it off) or 12V (why would it?)
Haha great idea!
What wiring up MOSFETs instead of spikes? It’s a custom circuit anyway, and MOSFETs weigh aabbbooouuttt 1% of what a spike weighs and 6% of what it costs, and is much easier to control.
Yes it will. In LabVIEW, the Relay Set is an enumerated type with 4 states: On (both sides 12v), Off (both sides gnd), Forward (one side 12v, one side side gnd), and Reverse (other side 12v, and other side gnd).
The spike is really two relays, and the three-pin cable contains two digital lines (fwd and rev) plus ground. The first coil (fwd) switches m+ between GND and 12v, and the second coil (rev) switches m- between GND and 12v. The output is never disconnected. Hope that makes sense
Thanks for the link to the Adafruit site, those LED’s look great.
Output devices like motors, compressors, etc need to be controlled by Victors or Spike like devices. You could always ask the GDC for approval to build a custom circuit to drive the LED’s. Since it’s part of your game play, you can’t use the decoration rule. You could see if the Victors will drive them to the bright/dim that you want and see if the GDC will let you put a non motor on the device.
We went with the Spikes to make sure there were no inspection issues.
I assume you’re looking at <R03>? That’s a weird rule -
Wouldn’t Jaguars and Spikes be COTS electronics? Although it does say you can use anything in the KOP, so that rule would take preference? I’ll probably ask the GDC if lights are considered output devices.
Victors are another good idea, but we can just make our own PWM in the robot code for the spikes.
I think I will just stick to LED’s of one color per spike for simplicity. Really noob question, but what vi would I use for a spike? The only thing I’ve used a spike for is the compressor, which has it’s own set of vi.
under utilities I found “FRC LEDs.vi”. It allows a choice of 2 LED types, FPGA LED and User LED. The state is either on, off, or toggle. Is this anything close to what I want?
While the Spike has 4 output states, last year the WPILib C++ Relay class only allowed 3 states. The state where both outputs were switched to +12v was not allowed. I guess they did not consider it useful. In the off-season we tried including the Relay class code in our project and modifying it to allow the 4 states and it worked. I have not seen the source code for 2011 (is it available?) but I am hoping they changed it to allow all 4 states. I don’t know how LabView or Java work.
I would propose that you ask the GDC if custom electronics can be used to run the lights.
If you get turned down then I would ask if a Spike controls the power to the custom circuit that drives the LED would be acceptable. The GDC is super safety minded and that is one of the reasons for the output via a Spike, Victor or Jaguar. The cRio safety code controls the output to them.
As far as the Spike vi goes, the one for the compressor is good. It wants the robot to be enabled and then uses the value from the pressure sensor to turn the spike on and off. You would feed inputs into the vi as if you were the pressure sensor.
Remember, it’s always faster to ask the GDC rather than fooling around in a CD thread collecting opinions on what the GDC will say.
There is a VI to set a relay. It is much better than trying to use the Compressor VI to set the relay. The compressor VI (in LabVIEW) creates a new thread, constantly getting the pressure switch and writing the relay. Under the WPI Robotics Library palette, go to Actuators->Relay and use the Relay Open and Relay Set VI’s.
The Spike relay is not rated for rapid ON/OFF operation if you are intending to make flashy lights. If the LED device you are using requires a simple ON/OFF power connection, and it draws less that 20 amps, the Spike is a perfect fit.