Wiring LED to Driverstation

I want to use the digital output on the driver station to activate an LED when a certain condition is met. I have an LED that is rated good for the driver station but I wired it wrong the first time and it always stayed on instead of turning on and off when I program it to.

How do I wire a 2 wire LED to turn on and off when I activate and deactivate the Driver Station Digital Output? I know my code activates/deactivates correctly because the Labview dashboard shows this, I just need to know how to wire up an LED to give me a big indicator.

Thanks.

Assuming a red LED:

Wire the + side of the LED to +5v pin, and the - side of the LED through a 330 Ohm 1/8 watt (or 1/4 W) resistor to the digital output pin. A “1” turns it off, and a “0” turns it on. You change the ground, not supply power.

Other colors need different ohm values.

Don

Thanks Don,

I have a few new questions given this information now.

Is the digital output pin you refer to the signal pin? I am using the standard 3 wire PWM cables and if I understand you I need to go from +5 V through my red wire of my PWM cable then through the LED than out of the LED through a resistor and then to the signal wire of my PWM cable?

Is this 330 Ohm resistor necessary if I spec’d my panel mount LED to not draw more current than the driverstation can handle? I used Digi-Key part L50141-ND (LED IND LIGHT 6V RED), does that require the resistor you mentioned?

If it does, can you point me to some documentation or website that explains why I need resistors with LEDs and why different resistances to different colors. I saw no documentation on the Driver Station that would send me down this path. I want to understand why I wire LED’s up this way to the DriverStation.

Thanks

That part includes a 150 ohm resistor. It is perfect for this application as it is.

However, if I’m reading things correctly, it costs more than five dollars per piece from Digi-Key! A discrete LED and separate resistor are much, much less expensive.

If it does, can you point me to some documentation or website that explains why I need resistors with LEDs and why different resistances to different colors. I saw no documentation on the Driver Station that would send me down this path. I want to understand why I wire LED’s up this way to the DriverStation.

LEDs, like all semiconductor diodes, have a voltage drop across them that is essentially independent of how much current is flowing. If you supply more voltage than that, they will pull as much current as the supply is capable of delivering, and will very likely overheat and die. The series resistor is chosen to drop the rest of the supply voltage across it at the current you wish to flow through the LED.

Different LEDs have different forward voltage drops, and work best at different currents. That’s why you will need different resistor values for different colors.

Section 3.1.6.2 Driver Station Digital Outputs of the 2009 FRC Control System manual says: “The DS digital output pins are driven directly by 5V transceiver (SN74LVC4245A device). Be sure to use caution as each pin can source/sink more than 40mA. It is possible to damage the device if too much current is driven on a single pin or the total current supplied by the device on all pins is excessive. Best practice should be to use a limiting resistor to prevent external loads from drawing excessive current, especially for LEDs, be sure to use a series resistor to limit the current.” The overview of Driver Station ports earlier in the manual also mentions them: “Digital Output pins 5V output level (8) – Provides 5V TTL for interfacing to digital devices and to drive LEDs (with current limiting resistors).”

Section 3.1.6.2 Driver Station Digital Outputs of the 2009 FRC Control System manual says: “The DS digital output pins are driven directly by 5V transceiver (SN74LVC4245A device). Be sure to use caution as each pin can source/sink more than 40mA. It is possible to damage the device if too much current is driven on a single pin or the total current supplied by the device on all pins is excessive. Best practice should be to use a limiting resistor to prevent external loads from drawing excessive current, especially for LEDs, be sure to use a series resistor to limit the current.” The overview of Driver Station ports earlier in the manual also mentions them: “Digital Output pins 5V output level (8) – Provides 5V TTL for interfacing to digital devices and to drive LEDs (with current limiting resistors).”

I read this which was why I got a resistor with a current drop like I did. My problem was figuring out which of the 3 wires from the digital output should I put to my 2 wire resistor. I didn’t want to mess up my DriverStation by wiring it wrong through trial and error.

That Digi-Key part is already wired, big, and ready for panel mounting so I figured why re-invent the wheel if they had a part I could use? :slight_smile:

So to repeat I go from red 5V from digital output through my LED and then to the signal pin on the digital output? Is this correct? And then my program can turn it off and on by cycling the digital output in code?

It will work that way, though the LED will be off for a “1” value and on for a “0”. Since the DS’s output can source current as well as sink it, I’d connect from the digital output through the indicator to ground instead. That way the LED will be off for “0” and on for “1”.

The way you connect it should depend on whether you want the LED to be on or off when the system is reset, before the cRIO software has a chance to control it.

I originally tried it this way, from the center pin (indicator, signal) through to ground in the direction where the signal wire went into the positive side of the LED and it didn’t do anything when I commanded it to. I thought I was just wiring it wrong. I may have to check to make sure the PWM cable was hooked to the correct pin. Couldn’t FIRST have bothered to label their pins, its so easy to miscount!

Thanks everyone, I imagine with the info here I can get it to work. I’ll let you know after I get a chance to try it tonight. I can’t exactly bring the control system to work so have to wait till the evening to play with it.

The top pin is signal.
The center pin is 5v.
The bottom pin is ground.

Wiring from the center pin to ground should leave the LED on constantly.

Could you point me to something that would tell me what resistances are required for which color? I am not extremely knowledgable about electronics design, but I can wire things up and solder them if given the design. This may be my first foray into design during the off season.

Read the spec on the LED – it should give you a current and a voltage rating. The voltage rating will probably be somewhere in the 1.5-3.0 volt range; the current rating will probably be somewhere in the 10mA-60mA range. Suppose you have a 2v, 30mA LED.

Suppose you have a typical 5v supply, like on the driver station. Some of that voltage is “used up” by the LED, and some is “used up” by the resistor. The current through both will be the same. If the LED takes 2v, then the resistor takes 3v, to make the total of 5 from the supply. The Voltage/Current/Resistance formula is “V = I * R” (where V = Voltage, I = Current, R = Resistance). In our example, the voltage drop across the resistor is 3v and the current is 30mA (or 0.03A – always make sure you get your decimal points right). 3v/0.03A = 100 ohms, so you would want a 100 ohm resistor.

I picked example numbers to make the math easy. If you get some value for a resistor and can’t find common resistors with that value, just pick something close. The brightness of the LED is related to the current through it. If you pick a resistor which is too small, then the current will be higher and the LED will be brighter (and burn out sooner, up to the point of burning out right away). If you pick a resistor which is too big, then the current will be higher and the LED will be dimmer.

Robert -

Wikipedia has a decent list of colors and voltages here. If you have documentation for your LED, I would go with that, but if you don’t this should give you some hints.

Robert,
As you can see from the above reference, most LEDs are near 2 volts when turned on. The exceptions are the blue and white and combinations of those. To make the resistance calculation, subtract the LED voltage from the power supply voltage. In our case, 5volts-2volts(LED)=3 volts. This is the voltage the resistor must drop. A good rule of thumb for most general purpose LEDs is 20ma. Using Ohm’s Law solving for resistance R=V/I=3/20ma=3/.02A=150 ohms. 150 is a standard value of resistance but if you can’t find one, 180 ohms is also a standard value. Using Ohm’s law for current I=V/R=3/180=.016=16ma. Although the LED would be not as brite at 16ma, you might never see the difference. As pointed out in the documentation, the output circuitry is limited to a maximum amount of current so using the 180 ohm resistor is better for the circuit but gives a dimmer output for the LED.