How to use an RGB LED strip with a Vex Spike?

My team wants to put an RGB LED strip on the robot, and we have some Vex Spike relays to use (I’ve heard these would work, not sure). Our LED strip has a common anode, so one wire to take an input voltage, and then one wire for each cathode of the LEDs, so one wire for red, one for blue, and one for green. Our Vex Spikes have a Voltage in, ground, and PWM input, and then a M+ and M- output. How would I wire the LED strip with one (or a few) of these relays in order to control the light color? So far I’ve tjougjt of using one relay per LED cathode, but I’m not sure what to do with the remaining + wire. Any help would be greatly appreciated.

We just did this with two spikes, also with a common +12 and separate 0V lines.

We wired the red, green, blue, and black (common) to the four outputs of two spikes, then set the values to high or low as needed. If you do this, you will need not only to use kForward (+ is positive, - is negative) and kReverse (- terminal is positive, + is negative), but also kOn (both positive) and kOff (both negative). I’ll post a truth table for this in a few minutes…

Even better, here is our FunLightsclass (in Java) posted after this evening’s build. We don’t have the lights working properly, but we’re pretty sure it’s in how these methods are being called, not in this class.

It didn’t get recorded in the code, but it looks like we wired

  • Red: Spike 1, + terminal
  • Grn: Spike 1, - terminal
  • Blu: Spike 2 + terminal
  • Blk: Spike 2 - terminal

So by “red” do you mean the red (positive) wire, or the wire for the red LED? Our 4 pins are labeled +, B, R, and G.

Glad I went back and re-read this. Spike relays do NOT have a PWM input. The connector is the same, but the signals are VERY different - so different that I wish they didn’t have the same pins. The Spike relays must be connected to a RELAY port on the 'RIO, not the PWM port. The black is ground on both PWM and RELAY, but on RELAY the red and white wires are both data lines that may be at either 0V or 5V. For PWM, the red line is at a constant 5V, and the white line switches back and forth rapidly to provide control.

My bad assumption – On ours, the wires were color coded:

  • +: black
  • R: red
  • G: green
  • B: blue

That makes sense, thank you. I’ve always just associated black with ground, so I was a bit confused at that. Thanks for the help, this is exactly what I was looking for.