# Specs on the digital I/O pins?

I know that for higher current things like relays, etc. that I need to use a transistor to allow a small amperage out of the digital outs to switch larger currents on and off.

However, I’ve been unable to find any maximum safe specs for the digital output pins as to how many mA they can deliver without risking anything burning out.

Can I drive 20mA across 8 LEDs without transisters? (1 LED/ digital IO pin)
What about a small piezo Alarm buzzer?

Also, is there a limit to the current that can be supplied by the +5V pins and the +3.3v pins? If I need extra current, will splitting the load between the two 5v and three 3.3V pins increase the capacity, or is it one overall limit to all the power pins?

You will find such advanced info in the processor’s data sheet.

Yes you can drive normal size LEDs directly with any IO.

Also, you can use the 3.3v and 5v pins to supply external circuitry, something about 200ma

Also on microcontrollers are usualy able to draw more current “to the ground” than to the high level, and it’s usualy safer. Just connect your led (with a resistor) between +3v3 and the pin, and light it by setting it to “0” (false), instead of doing the reverse as it seems sometimes more logicial to do

Nicolas3, thanks for that tip. I have one of those “wow” moments almost every day with these things where one of you electronics gurus suggests something I would have never considered trying. Would you consider that the “default” way to wire things or is there a guideline to follow when determining to draw to ground vs. to high?

Be careful…

According to the Electrical Characteristics section in the data sheet, you can work with the following:

High level output voltage: VDD - 0.4 = 2.9V @ 4mA

So, you’ll get 2.9V out on a pin when it is high. It can source (drive) 4mA only. This is enough for a Red LED, but not for other colours that draw more current.

Low level output current: 4mA

So, the Sink current is the same as Source. Traditionally micro controllers would be able to sink more than source - so you’d be able to source 4mA but you can sink 20mA. This is why it is a popular technique to put the LED connected to + and the “sink” it though the pin (open collector).

However, it does not work that way on this processor, so ignore it.

High level short circuit output current: 45 mA
Low level short circuit output current: 50 mA

This means it won’t blow up if you put a high-bright LED on there drawing 20 mA, but it is not good for the chip over time.

I/O latch-up current: 100 mA

This means at 100 mA (total) the processor will completely latch up. this could be 50 mA over 2 pins or 10 mA over 10 pins.

So, it is pretty well protected, but don’t over stress it.

Just for interest sake, the voltages are also very tolerant.

Input Voltage: 5.5V Max - on a 3.3V pin.

Input High level voltage: 2V - so anything over 2V will trigger a HIGH input.
Input Low level voltage: 0.8V - so anything below 0.8V will be considered LOW.

Bottom line… don’t drive too many LEDS directly - rather use something like a ULN2803 to drive LEDS, relays and even small motors with no fear of damage.