LED's on digital outputs

Today one of our mentors remarked on our fund raising drag racer VEX robots, and how they had LED’s to report the time in binary. He said you shouldn’t put an LED in the I/O without a resistor on it, as it’s not meant to drive a load, and could damage the microcontroller. I’ve never had a problem, but I do believe there could be merit to this. I thought the VEX had safeguard resistors on the GPIO bank to keep that from happening. And the signal pins don’t even operate on the full 5v. Any opinions?

That brings me to my next question. What about the LED’s that VEX sells on their website? There are no VEX resistors. And if there were, they would have to change their competition rules in order to use them, because you currently cannot modify any electrical components at all, in any way. I can’t see if there is a resistor on there or not, but I would really guess that there’s not, seeing as there are only two wires. If you were to use a resistor on the signal line, I doubt you’d be able to get one that would supply enough power for the LED to still light, so you’d end up having to use a transistor in there too to shunt power from the +5v bar.

Your Mentor is correct in that a Resistor is needed to Limit Current thorough the LED. Also, too much of a Load will damage the Outputs of a Microcontroller.

You are also correct in that the Vex has Resistors on the Outputs, they are 1K Ohms.

IIRC the PIC18F8520 has built in Resistors, that are Software Controllable, but I believe that IFI/VexLabs added additional one to the Vex Controller.

Built in Resistors… (See Above)

Start with looking at the Picture on Page 1 of the PDF in the ZIP File, VEX Sensor Test. This file and others can be downloaded from the Download Page.

I used LED for Range Indicators in on my Robot, Square Bot With Two Ping))) Ultrasonic Sensors. I used Bi-Color (RED/GREEN) LED’s, and inserted the Leads directly into the Header… Nothing Special required…

Although the Vex Controller provides the 1K Ohm resistors internally and you can directly connect LEDs to the Vex Controller’s outputs as long as you make sure the Cathode is connected to ground, in other microcontroller’s this is not an option since they don’t usually provide these resistors for the outputs and would burn them out.

I use either 200 Ohm or 470 Ohm networked resistors (DIP) from Digikey to drive the RadioShack LED bar with the Vex Controller and they light up just fine. This brings the total resistance Rt = 1000 + 470 to 1470 Ohms, which is still fine to drive an LED.

I think you mean “to large of a load”. The built in resistors are most likely Pull-up resistors and they limit no current.

Hmm… Turning this over in my mind 3 or 4 times, I am misusing the Terminology… (I will fix the post)

First, the Vex Analog/Digital I/O can be used for Input or Output.

Here is the Circuit for the Input Mode, see input Schematic.

The External 470K Ohm Pull up is so the the Input won’t Float when there is no input, as noted in the above link to Wikipedia. IIRC, the 1K Ohm is there whether it is Input or Output.

For Output, the Load (or Power Consumed) is Large when a lot of Current is required to Complete the Circuit. This can damage the Outputs of the Microcontroller.

Little Resistance is Much Current, and Much Resistance is Little Current…

The schematic you linked to is true for input as well as output. In other words, switching to an output doesn’t bypass the 1K current-limit resistor.

This design allows you to short-circuit any of the I/O ports directly to ground or +5V without causing any excessive currents that could damage the PIC.

It is safe to directly drive a typical LED from a Vex digital output port since the 1K resistor sets an absolute limit of 5mA; the most I’ve ever measured was 4.63mA. High-brightness LEDs may not be able to light well with this low current.

Cheers,

  • Dean