22

I've been experimenting with an 8x8 LED matrix controlled by an Arduino Uno. As I think is typical, the matrix uses a common anode for each row, and a common cathode for each column.

At the moment, I've got all the matrix pins connected directly to IO pins on the Uno, and I haven't had any problems lighting the LEDs one-by-one. Going through the whole matrix like this makes updates a little slow though, meaning the LEDs aren't as bright as I'd like.

As far as I know, I can't safely light up an entire row at once, because an individual pin on the Uno isn't capable of sourcing enough current to drive 8 separate LEDs at the same time (requiring at least 10mA each to be bright enough).

It occurred to me that the reverse might be safer. If I light up an entire column at a time, then each pin only has to source enough current for one LED, which should be no problem. However, it relies on one pin potentially sinking the current from all 8, totalling at least 80mA.

Is this possible, or am I going to fry my board?

4
  • What exact display are you using (datasheet) and are you using series resistors with it? Maybe you fry hour display rather than your Arduino.
    – jippie
    Feb 12, 2014 at 12:10
  • There's no part-number on it so I don't have the exact datasheet. I've assumed each LED has a forward voltage of 2V, and am conservatively using 390 ohm series resistors at the moment (while testing). That means I'm driving them at around 8mA each I think. Feb 12, 2014 at 12:17
  • that should be just fine.
    – jippie
    Feb 12, 2014 at 12:19
  • Could you go into a little more detail about what you are doing, please. The reason why I'm asking is because I want to do the same thing, and I'm a newbie. I am RTFMing and your question was the highest hit for my search. I am [email protected]. thank you. Nov 7, 2019 at 2:42

2 Answers 2

17

am I going to fry my board?

Pretty likely outcome. Here's why:

The Arduino Uno uses the atMEGA328 microcontroller, which has an absolute maximum rating of 40 mA source or sink per GPIO. Also, the total current through the supply or ground rails (i.e. the total of all current OP wants the GPIO pins to sink, or source) is rated to a maximum of 150 200 mA.

Realistically, the current graphs in the atMEGA328 datasheet do not even go all the way to 40 mA, hence it is safest to restrict the current to perhaps 20 mA total per GPIO.

In other words, whether a GPIO is used as source or sink, the limits remain pretty low, and in practice, should be kept much lower than the absolute maximum ratings. Even below absolute maximum, running a microcontroller to too high a temperature reduces its life expectancy.

Solution:

Use either BJTs, MOSFETs, or some driver IC such as the ULN2003 to actually drive the current through the LEDs.

2
13

I'm going to steal my answer from when I answered this question on the last arduino SE attempt.


This is a bit complex. Basically, there are a number of limiting factors:

The IO lines from the microcontroller (i.e. the analog and digital pins) have both an aggregate (e.g. total) current limit, and an per-pin limit:

enter image description here
From the ATmega328P datasheet.

However, depending on how you define the Arduino "Pins", this is not the entire story.

The 5V pin of the arduino is not connected through the microcontroller. As such, it can source significantly more power. When you are powering your arduino from USB, the USB interface limits your total power consumption to 500 mA. This is shared with the devices on the arduino board, so the available power will be somewhat less.
When you are using an external power supply, through the barrel power connector, you are limited by the local 5V regulator, which is rated for a maximum of 1 Amp. However, this it also thermally limited, meaning that as you draw power, the regulator will heat up. When it overheats, it will shut down temporarily.

The 3.3V regulated output is able to supply 150 mA max, which is the limit of the 3.3V regulator.


In Summary

  • The absolute maximum for any single IO pin is 40 mA (this is the maximum. You should never actually pull a full 40 mA from a pin. Basically, it's the threshold at which Atmel can no longer guarantee the chip won't be damaged. You should always ensure you're safely below this current limit.)
  • The total current from all the IO pins together is 200 mA max
  • The 5V output pin is good for ~400 mA on USB, ~900 mA when using an external power adapter
    • The 900 mA is for an adapter that provides ~7V. As the adapter voltage increases, the amount of heat the regulator has to deal with also increases, so the maximum current will drop as the voltage increases. This is called thermal limiting
  • The 3.3V output is capable of supplying 150 mA.
    • Note - Any power drawn from the 3.3V rail has to go through the 5V rail. Therefore, if you have a 100 mA device on the 3.3V output, you need to also count it against the 5V total current.

Note: This does not apply to the Arduino Due, and there are likely some differences for the Arduino Mega. It is likely generally true for any Arduino based off the ATmega328 microcontroller.

1
  • Thanks for the summary! It answered my question super fast!
    – Avogadro
    Nov 7, 2022 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.