Go Down

Topic: What is the principle of dot matrix? (Read 202 times) previous topic - next topic

urarik

Nov 09, 2020, 05:55 pm Last Edit: Nov 09, 2020, 06:21 pm by urarik
Hello. I want to make a simple dot matrix using LEDs and several pins. (Just like this https://www.arduino.cc/en/Tutorial/BuiltInExamples/RowColumnScanning ). I thought it would be easy to imitate dot matrix: LOW output pin for rows, HIGH output pin for columns.

But I read this post. https://forum.arduino.cc/index.php?topic=413037.0
They said it is dangerous to use LOW pin as GND.

But doesn't dot matrix work this way?
Are there any other devices or functions in dot matrix?

MarkT

#1
Nov 09, 2020, 06:33 pm Last Edit: Nov 09, 2020, 06:36 pm by MarkT
Alas that tutorial is badly in error in an important detail:

You _need_ current limiting resistors on one set of wires, otherwise the LEDs and Arduino pins may
burn up.

[ Alas there are faults in some of the official Arduino tutorials like this and its frankly embarassing.
Many of the forum contributers have tried to have these fixed over the years, but its not always
easy or rapid process - we are not consulted about these tutorials (doh!) ]

Other than the lack of resistors, the principle is sound, although its typical to drive a whole row,
or a whole column simultaneously.  Often this means you need to bolster the relevant pins with
transistors or drivers of some sort to provide enough current for 8 LEDs simultaneously.

This isn't an issue you drive a single LED at a time though, with a resistor limiting the current to the pin's
safe current level (for instance 20mA for an Uno is nicely within the 40mA absolute maximum
rating).  However single LED at a time will be not very bright...

[ I note that this page at least has a warning:  https://playground.arduino.cc/Main/DirectDriveLEDMatrix/ ]
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

urarik

#2
Nov 10, 2020, 02:39 am Last Edit: Nov 10, 2020, 02:43 am by urarik
Thank you for your answer! I don't know whether I fully understand the content. So I have another question..
If I supply adequate current and resistors, is it okay to use LOW pin as GND?

aarg

Thank you for your answer! I don't know whether I fully understand the content. So I have another question..
If I supply adequate current and resistors, is it okay to use LOW pin as GND?
For what device? A row/column LED matrix has no ground connections.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

urarik

I thought dot matrix uses LOW OUTPUT pin as GND and scanning purposes. Does dot matrix dont need GND?

CrossRoads

Yes.

That is the same as 5V-high drive transistor-LED-resistor - low drive transistor - GND.
The transistors have an Rds (resistance drain to source)  of around 25 ohm.
If the LED have a Vf of ~2.5V, and you wanted say 15mA to flow thru the LED, then:
(5V - 2.5V)/.015A = 167 ohm. Minus the 25 ohm of each resistor leaves 117 ohm  current limit resistor needed.
120 is standard value.
(5V - 2.5V)/(25 ohm + 25 ohm + 120 ohm) = 14.7mA. Pretty darn close.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

aarg

#6
Nov 10, 2020, 03:11 am Last Edit: Nov 10, 2020, 03:12 am by aarg
I thought dot matrix uses LOW OUTPUT pin as GND and scanning purposes. Does dot matrix dont need GND?
No. It does require a voltage between the anode and cathode drives. It just happens that usually that is provided by an effective ground. The thread you linked to has nothing to do with scanning matrices, you can just ignore it for this question. That thread is talking about using a ground as a semi-permanent power sink for a device that is constantly on for periods of time.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

urarik

Yes.

That is the same as 5V-high drive transistor-LED-resistor - low drive transistor - GND.
The transistors have an Rds (resistance drain to source)  of around 25 ohm.
If the LED have a Vf of ~2.5V, and you wanted say 15mA to flow thru the LED, then:
(5V - 2.5V)/.015A = 167 ohm. Minus the 25 ohm of each resistor leaves 117 ohm  current limit resistor needed.
120 is standard value.
(5V - 2.5V)/(25 ohm + 25 ohm + 120 ohm) = 14.7mA. Pretty darn close.
No. It does require a voltage between the anode and cathode drives. It just happens that usually that is provided by an effective ground. The thread you linked to has nothing to do with scanning matrices, you can just ignore it for this question. That thread is talking about using a ground as a semi-permanent power sink for a device that is constantly on for periods of time.
Thank you for your answer!  I tried to understand the answer, and I think I did it to some extent. I'll study this further more. Thanks again!

Paul__B

It's a little more complex that this.  Let me try and explain it again.  :smiley-lol:

With the matrix, you need to switch a cathode LOW and an anode HIGH in order to light a LED.  But as MarkT points out, LEDs require a current-limiting resistor.

Since we will want to (presumably) have eight rows and eight columns in the matrix, let's for a  moment presume you have a matrix in which cathodes are column terminals and anodes are row terminals.  This is the "B" version of the common matrices.

Since we have eight rows, we will put one resistor in series with each row (anode) wire.  Given that the LEDs are red, they will have a voltage drop of around 2 V.  The Arduino drivers will lose about half a Volt at 20 mA and you have both an anode and cathode driver so you lose a volt between and have two Volts remaining across the resistor, so for 20 mA you use a 100 Ohm resistor.

This would be satisfactory if you only lit one LED at a time, but in practice, you usually want to light anything up to eight LEDs in the same column at once, so the column would then want to draw 160 mA which is not allowable (or even possible) for an Arduino pin.  So you actually need to make the resistors 1k2, limiting the current for all eight LEDs in a column to 16 mA - 2 mA for each LED.

But now the LEDs will not be so bright, and each column only gets one eighth of the time to be lit as you multiplex it.

If you actually want a nice bright display, instead of driving the matrix with an Arduino, you need to use the purpose-designed MAX7219 chip which controls the LED currents using a single "programming" resistor and performs all the multiplexing for you; you just write the patterns (in eight bytes) into its registers.

And these are (or were inexpensively before Covid-19) available as modules including the LED matrix itself on eBay or Aliexpress.  While you can experiment with just the matrices or a quantity of LEDs, resistors and the Arduino, these modules are the way to go when you want to use it for some purpose.  You can use the modules which come unassembled, ignoring the matrix provided, if you want to assemble your own matrix of LEDs or to control a large number of LEDs spread out over a piece of equipment, model or some other sort of display.

Go Up