LED displays are commonly packaged as arrays of LEDs organized in rows with shared positive terminals and columns with shared negative terminals, or vice versa. Here is a standard illustration, along with its diagram:
These exhibits can be very useful. To control a matrix, you connect its rows and columns to your microcontroller. The columns are connected to the LEDs’ negative terminals (see Figure 1), so a column needs to be in a high state for any LED in that column to illuminate. The LEDs are linked to the positive terminals of the rows, so a low current in a row is necessary for a single LED to illuminate. If the row and column have matching high or low levels, the LED will not be activated and will stay unlit.
Circuit
The 16 pins of the matrix are hooked up to 16 pins of the Arduino. Four of the analog pins are used as digital inputs 16 through 19. The order of the pins is assigned in two arrays in the code.
Two potentiometers, connected to analog pins 0 and 1, control the movement of a lit LED in the matrix.
image developed using Fritzing. For more circuit examples, see the Fritzing project page
Schematic:
Code
/* Row-Column Scanning an 8x8 LED matrix with X-Y input This example controls an 8x8 LED matrix using two analog inputs created 27 May 2009 modified 30 Aug 2011 by Tom Igoe This example works for the Lumex LDM-24488NI Matrix. See http://sigma.octopart.com/140413/datasheet/Lumex-LDM-24488NI.pdf for the pin connections For other LED cathode column matrixes, you should only need to change the pin numbers in the row[] and column[] arrays rows are the anodes cols are the cathodes --------- Pin numbers: Matrix: * Digital pins 2 through 13, * analog pins 2 through 5 used as digital 16 through 19 Potentiometers: * center pins are attached to analog pins 0 and 1, respectively * side pins attached to +5V and ground, respectively. This example code is in the public domain. http://www.arduino.cc/en/Tutorial/RowColumnScanning see also http://www.tigoe.net/pcomp/code/category/arduinowiring/514 for more */
Hardware Required
- Arduino Board
- (1) 8 x 8 LED Matrix
- (2) potentiometers
- hook-up wire
- breadboard
For more detail: Arduino Row-columm Scanning to control an 8×8 LED Matrix Code