1
\$\begingroup\$

I'm trying to understand how to properly multiplex an 8x8 matrix (or any large amount of LEDs) http://arduino.cc/en/Tutorial/RowColumnScanning

However, I'm getting a bit confused, since I've found others like this: http://garagelab.com/profiles/blogs/arduino-scrolling-text-marquee-to-give-a-happy-christmas

That one says to use transistors for the current switching, but the first link doesn't even use any resistors (which I find suspect), nevermind transistors.

I don't really see why the transistors are needed, can anyone explain why?

Thoughts?

\$\endgroup\$

3 Answers 3

6
\$\begingroup\$

The transistors are needed if the current required to drive the LEDs is higher than the microcontroller can handle. This means either a single pin current rating, or the maximum rating for all the pins together (will be given in the datasheet)

Most typical 5mm and 3mm LEDS have a maximum current rating of around 20mA and can be driven directly from a microcontroller pin (10mA is fine for most applications)
However, if your microcontrollers maximum rated current is 200mA and you want to drive 20 LEDs at 15mA, then even though the individual pins can supply the current you are out of spec for the maximum current rating.

The LEDs should always have a current limiting component (e.g. resistor) in place when driven from a voltage source, so you are right to suspect the first link. It appears that it is simply relying on the pins drive not being high enough to cause damage to the micro or the LED, which is definitely not a good idea.

Here are the the Absolute Maximum Ratings for the ATmega328. Notice there is a per pin current rating and also a maximum total Vcc current rating:

Max Specs

Also see notes 3 and 4 on pg.314:

Notes

Also, you can get high power LEDs with current ratings of >500mA, so a transistor is obviously the only option in this case.

\$\endgroup\$
9
  • \$\begingroup\$ I'm using one of these: adafruit.com/datasheets/BL-M07C881.PDF The UltraBright Red variety. It seems that max current per LED is 30mA. It would seem that there's no way without the transistors though since you're driving one column at a time so it would be 8x30mA. But obviously people do it. I have a watch with an 8x8 matrix that uses no transistors, so it's possible... Am I figuring the current calculations wrong? \$\endgroup\$
    – Adam Haile
    Commented Feb 28, 2013 at 1:39
  • \$\begingroup\$ No, you can run the chip beyond the recommended specs, it's just that Atmel do not guarantee what will happen if you do. If it's only slightly over, and your conditions (e,g, ambient temperature, etc) are not likely to stress the chip, then you will probably get away with it. It's not the way to design a professional product though, always work within the recommended specs. \$\endgroup\$
    – Oli Glaser
    Commented Feb 28, 2013 at 1:45
  • \$\begingroup\$ Also, remember that with a matrix you don't have to have all the LEDs on at once if you are scanning through at e.g. 100Hz, so the current can be kept within specs. For example, if each LED in your watch uses 10mA, then if one column is scanned at a time the maximum possible average draw is 80mA. \$\endgroup\$
    – Oli Glaser
    Commented Feb 28, 2013 at 1:47
  • \$\begingroup\$ Ok, but wouldn't that mean that the current draw on the pin that controls that column would be 80mA which is > 40mA? And wouldn't this be the case regardless of the control pin being the current source or sink? \$\endgroup\$
    – Adam Haile
    Commented Feb 28, 2013 at 1:56
  • \$\begingroup\$ Yes sorry, you would have to split the scan up more if the columns are driven from pins also (I was thinking of transistors on each column for some reason) If both columns and rows are driven from the pins, then a maximum of 4 LEDs per column can be lit at any time. Ideally you would only light 2, as the 40mA is the absolute maximum rating, which is not recommended. \$\endgroup\$
    – Oli Glaser
    Commented Feb 28, 2013 at 2:01
0
\$\begingroup\$

Thats actually false, transistors are used as a switch. This lets you switch the cathode pins using a positive signal from an arduino such that each LED in the matrix can be individually controlled, allowing for the possibility of multiplexing. Simple.

\$\endgroup\$
-1
\$\begingroup\$

You should read this post http://www.theengineeringprojects.com/2015/12/scrolling-text-led-matrix-8x8-using-arduino-proteus-isis.html .... They have shown in detail how to interface arduino with 8x8 led matrix. They have used MAX7219 in order to do so. The code is also given there along with Proteus simulation.

\$\endgroup\$

Your Answer

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

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