View Full Version : Teensy 3.0 resistors and DC current per I/O pin

12-11-2012, 07:25 PM
I didn't see the maximum current per I/O pin listed in any of the Teensy 3.0 like I see with the Arduino Uno R3 (40 mA per pin, and 50 mA for 3.3v). I downloaded the electrical characteristics datasheet for the K-20 family that is on the PJRC site, and it seems the limit is 25 mA. Is this correct?

My main question is converting resistors from designs for 5v systems like the Uno to the Teensy 3.0. As a software guy, I still am feeling my way to understanding the electronics side of things, but given Omm's law where current = voltage / resistance, I would imagine I would want to scale the resistors similarly (paying attention to the maximum current draw, and adding in the resistance for the device I'm attaching).

The Arduino examples uses a 10K ohm resistor for a button press (where you are not using the builtin pullups), would I use a 6.8K ohm resistor to give roughly the same current through the pins? The current of 10k on a 5v system would be ~ 5 mA, which should be safe.

For LEDs, I often times see people using 220 ohm resistors, would I want an 150 ohm resistor for the Teensy 3.0? On my question about opto-isolators, it was recommended that I use 330 ohm resistors.

Thanks in advance.


12-11-2012, 08:37 PM
Most chips have a recommended maximum and an "absolute" maximum per-pin current. It's good practice to avoid going over the recommended max. If you do use more, it's best to do so for brief times.

On AVR chips (running at 5 volts) it's 20 mA recommended max and 40 mA absolute max. When AVR runs at 3.3 volts, the recommended max is 10 mA (that Arduino Uno 50 mA number is a power supply, not an I/O pin at all).

On Freescale's chip, it's 9 mA recommended max and 25 mA absolute max.

For pullup resistors, the current flows through the resistor and the pushbutton, but virtually no current flows through the input pin. The pin merely senses whatever voltage is created by the resistor and pushbutton. Almost any resistor works fine. Higher values have less current while the button is pressed. For very high values, like 1M or more, the voltage can become very sensitive to noise pickup from other sources, but if the wire is short (or the ground wire to the button is located very close to the signal wire) it's rarely a problem.

For resistors on LEDs, you do use Ohm's law for the resistor, but the trick is to deduct the LED's voltage before computing the resistor value. Different LEDs have different voltages, mainly depending on the color. Inside the LED, the electrons suddenly lose energy causing photos to be emitted, where the wavelength of the light corresponds to the amount of energy change. That's why LEDs have an approximately constant voltage, which depends on the color. Blue LEDs are usually about 3.2 volts, red are usually about 1.8, and infrared are usually about 1.3. So to get 10 mA of current, first to subtract the LED's voltage from the voltage output by the pin, and then divide by the desired current. Some people make the mistake of forgetting to subtract the LED voltage, which gives wrong results. The electrons don't care. For your optocoupler, the LED is probably infrared, so you'd have 2 volts across the resistor. For 10 mA, you'd use 200 ohms. Using 330 ohms would result in only 6 mA.

12-11-2012, 09:04 PM
Thanks for the information, particularly for the 9 mA value. I figured the 25 mA was probably the maximum (and I see the 20 mA for the UNO at 5v). It might help to put that on the summary sheet in http://www.pjrc.com/teensy/index.html for the next person.

Yes, I figured you needed to subtract the voltage of the object before calculating the resistance, but I didn't have any values on hand when I asked the question, since I posted from work.

I do wish some of the places I've bought components from would give these values on the packaging rather than having to trawl the internet to find the datasheet. But that is a general rant. :cool:

12-10-2013, 12:22 AM
On Freescale's chip, it's 9 mA recommended max and 25 mA absolute max.

This implies that all the Teensy3 output pins are set to Kinetis high drive? According to the Kinetis doc, pins can source or sink 9 mA in high drive and 2 mA in low drive.

On a related note, Arduino has no way to specify pulldowns, but Kinetis supports this. What is the easy way to control the pullups/downs on Kinetis pins, and is there a way to find out which pins already have startup or config code set to make them pulled up or down?

12-10-2013, 01:28 AM
My take on the ratings is that following recommended maximums means that the device behaves reliably at all times, while merely staying within the absolute maximum ratings means that you won't permanently damage the device, but that it may behave erratically until you reset it.

12-10-2013, 02:02 AM
Typical value conditions assume 25C and 3.3V.

Some of these operating boundary nuances are defined in K20 Sub-Family Data Sheet, Rev. 4 5/2012.
Typical values are provided as design guidelines and are neither tested nor guaranteed.
Min and Max are what you can see over allowed ranges of temperature, voltage, pin loading, and process variation.
See 3.5, page 6 which shows an exponential increase in permanent damage, expressed in ppm over some time. So exceeding any rating puts you at increased risk of device failure. The more often your transgression, the more likely is eventual harm.
Then there is this chart showing operating "requirement" vs "rating", where you can see that exceeding the "operating rating" can be expected to be immediately fatal. 1174
However chart 3.5 shows that this is actually an increase in the probability of failure, not guaranteed immediate failure.

Also note that operating anywhere out of "normal operating range" means you can experience "possible decreased life" and "possible incorrect operation" (neither of which are tolerable in most of the systems we design) even though there is no permanent device failure.

Bottom line: if you want your system to operate reliably for a long time, never exceed the "operating rating" limits, even briefly.
Also: never design to typical specs if you want your device to work always (not just under "typical conditions").
Also: design your system to fail "gracefully" if the impossible happens. This sounds easy but can be a challenge. Counter-Example: Consumer Reports tested the Fisker electric car and it just quit dead rather than having a "limp home" mode: http://www.consumerreports.org/cro/video-hub/featured/featured-videos/100000-fisker-karma-breaks-down/17387256001/1496201987001/ and coincidentally they are now bankrupt: http://dailycaller.com/2013/11/25/chinese-buying-bankrupt-fisker-at-taxpayer-loss-gov-says-it-could-have-been-worse/