Can Relay Outputs Directly Drive LEDS ? (for testing)

All 8 relay ports are in use this year (that’s a lot of Spikes & PWM cables !). We like to test our software out first on a table test board as much as possible. We would prefer to not have to dedicate 8 more spikes and pwms just to have visual confirmation of the state of the relay outputs.

If I read Kevin Watsons CPU to RC I/O mapping chart and the CPU spec also posted by KW, it appears each pin might be able to provide 25ma, enough to power a led (with an appropriate dropping resistor). We would probably limit it to 10-15ma (just enough to see reliably).

Anyone one know for certain this is doable or more importantly if its a bad idea ? I would hate to blow our test RC. (We asked Innovation First but did not hear back.)

I don’t understand why you don’t want to read the state of the spike with the LED already on there. I’m not sure if the signal from the relays goes to a negative voltage, if that’s the case then you wouldn’t want to wire a LED to the relay output.

You can always write a printf() to print out whenever a relay is forward or reverse.

if(relay1_fwd == 1)
printf(“relay 1 foward”);

You can also use the Digital I/O as an output, hence the O in I/O… Set it as an ouput and say digital01_out, or whatever the command is (its just like the in one but it says out) and set it equal to 1 for one, or 0 for off, just like relay ports! You can also use Relay ports, but I don’t remember if there is a rule that you can only plug up Spikes to the Relay Outputs or not…

For the price of an RC I would research the spec myself; however if an LED draws 15 mA and the output can source 15 mA or more, then the answer is yes.

While you are looking at those specs, also see what the output can “sink” - that is, how much current can it allow to flow when it acts as a ground (and not a power ‘source’). Most circuits can sink two or more times the current that they can source. If you want to do this, connect the anode of the LED to +5v, and the cathode (through a dropping resistor, maybe 82 to 120 Ohms) to the digital (relay) output pin.


[EDIT]Digital pins can only source 7 mA. I’d test them by allowing them to sink the current instead, maybe ask IFI

This IFI FAQ entry should be of interest.

One of the questions in the thread is:

It’s perfectly doable. On a testbed system, it might even be a good idea. The Spike input is opto-isolated, meaning it is essentially an LED. The specification calls for a 4mA control signal at at least 3V, so if you can manage to get enough light out of that, your test will be perfect.

I once put a three-terminal red/green LED on the relay output, with a resistor chosen to limit the current to about 10mA. It worked fine, and the LED matched exactly what one would see on the built-in LED of a Spike.

Thanks for the insights. Makes it a little less nerve racking!

Just so you know, the following was posted in IFI forum for the RC.
(Again, this was for just a table top test setup, not for the actual robot).

Yes, it is possible to drive LEDs directly from the Relay FWD / REV Outputs. Connect the anode of the LED to the FWD or REV Output. Connect the cathode of the LED to ground. The outputs can sink and source at least 8 mA. There is a 330 ohm series resistor between the VHCT logic outputs and each the FWD and REV header posts. Assuming the LEDs you are using can handle 15 mA of continuous current, direct connect them as described above.