How to Easily drive a an LED dot matrix display: 8x8 or 5x7 LEDs. (2024)

  1. Home
  2. PIC Projects
  3. Dot Matrix LED Display

Here you can find out how to drive a dot matrix LED display with 64 LEDs (8rows by 8 columns - 8x8 display) or less e.g. 35 LEDs (7 rows by 5 columns -5x7 dot matrix). The same principle is used for larger displays but you mayneed more processing power as this method requires the microcontroller toactively update the display every 20ms. Other more complex (expensive) chips dothis refresh for you (see the MAX7219).

Driving an led dot matrix is quite simple and this page shows you how to doit without a complex "helper" chip i.e. driven by the microcontroller a fewtransistors and a the 4017 Johnson counter.

It uses persistence of vision to letyou drive the 64 LED matrix with only 10 microcontroller outputs!

Normally you would need 64 outputs for 64 LEDs but by usingmultiplexing and a helper chip you can get away with 10 microcontroller pins.In this design two pins are use to communicate with the helper chip and 8 pinsdirectly drive the row elements of the 8x8 display. The helper chip is used toactivate each column in turn while the row pins generate the column pattern atthe active column..

LED Display multiplexing simply means turning onone led for a short period of time and doing this repeatedly for each LED.

If you do this fast enough then your eye will notnotice any flicker.

The 64 leds, arranged as 8 rows by 8 columns, are housed in a plasticcasing. The LEDs are no different to any other LEDs but the LED block saves ahuge amount of soldering as all the wiring has been done for you within theunit itself.

It is already wired up for multiplexing having only 16 connections (8 rowsare connected to 8 anodes of the LEDs and 8 columns are connected to 8 cathodesof the LEDs). So you can drive a row of LEDs by pulling the column connectionto ground.

LED display matrix 8x8LEDs

How to Easily drive a an LED dot matrix display: 8x8 or 5x7 LEDs. (1)

A dot matrix led display is simply a grid of LEDsarranged for use by multiplexing.

Specification

dot matrix led display driverRed 8x8 LEDs

Project details.

Dot matrix LED display Project
CompilerMikroelectronika MikroC CompilerFree!
Target16F88/16F84 (retargetable to other PICs that have an enoughpins).
Software levelEasy.
Software notesMultiplexing the display.
Hardware levelEasy.
Hardware notesNo special notes
Project version1.04
ProjectfilesEnter your details to getthe Download Link
and get the microcontroller newsletter:

(Your email is safe it willnever be sold or rented).
You will get All the C source code andhex file.

Note: Check your email for the project code download link.

Hardware operation

Dot Matrix LED Display schematic
(Click diagram to open apdf)


Multiplexing

If you tried to drive 64 individual LEDs you would need 64individual output pins (each led connected to a output pin on one side andground on the other).

Obviously that is a tall order so the way round it is to usepersistence of vision which is a way of describing how your eye works.

Your eye reacts slowly to changes in light intensity so that ifa light is turned on and off quickly enough then it does not notice that thelight is off. Basically your eye remembers a light pulse for a short time.

The approximate time is 20ms so if the light is turned on at afrequency >50Hz (1/20ms) then your eye will not notice any flicker atall.

Multiplexing uses this fact to reduce the number of pins neededto drive an LED display. You can do this by splitting the 64 led display into 8rows and 8 columns which lets you drive it using 8 row outputs and 8 columnoutputs. In fact the 8x8 led matrix block used here has all the leds arrangedin this way already.

Dot Matrix LED display :TC15-11SRWA

How to Easily drive a an LED dot matrix display: 8x8 or 5x7 LEDs. (3)

Note: The orientation of the led block should bepin 1 at the top left to view characters the right way up. However I found Iwanted to move the board around and look from the other side so there are twodefinitions that allow flipping and rotating the display. To view from adifferent position re-compile the code with these definitions active (See thecode).

Each row is driven in turn and as long as all of the rows aredriven within a time period of 20ms it will appear as though the LEDs are oncontinuously.

To turn a specific led 'ON', data is output to the columndrivers when a row is driven.

Helper chip

To save more pins it is common to use a helper chip and in thisproject it is a Johnson counter (a 4017). This generates a walking one everytime that it's clocked. Since you only want one row on at a time it is theideal chip for this application.

Note: In this project when the 4017has been reset it outputs a logic high at Q0 - which is not connected - soduring reset the 4017 does nothing. This allows you to use the column driverport for something else if you want to when you are not driving the LEDs.

To drive the 4017 all you need is two pins one for reset andone for clock.

So to fully drive the 64 led display you only need 10 microcontroller output pins.

You don't have to use a 4017. Ifyou have enough pins you could drive the led display directly e.g. using a16F877A. It all depends on your circuit and what resources you need to use.

How to Easily drive a an LED dot matrix display: 8x8 or 5x7 LEDs. (4)

Row current sink

To get more current through the LEDs you need to use atransistor at each row driver as the maximum current you can sink or source islow.

The row driver sinks all the current from each active row LED.To let the current flow you need to use a transistor at each row as the maximumcurrent you can sink or source is very low for an HC4017 (1ma).

I used a ULN2803 (an array of 8 grounded NPN transistors) -which is massive over design in terms of its collector current capability(500mA) but provides a convenient (and cheap) package which is useful forprototyping.

Note you can use individual NPNtransistors if you want to - normal standard transistors are OK as the maximumcurrent is about 60mA through a column.

Character Set

The most difficult thing about using the dot matrix LED displayis defining the characters. Basically for ASCII characters you need an array of128 blocks each having 8 column data numbers.

The usual way is to get out a piece of graph paper and defineyour characters by drawing blocks where a pixel is on. You then translate eachline into hex (binary to hex is very easy) and then transfer this informationto your program source code.

I have defined characters 0-9 which are cycled continuously.

Dot Matrix LED Display Software


Compiler project files

16F88-dot-matrix-8x8.mcppi

C Source files.

16F88-dot-matrix-8x8.c

Header files.

types.h
bit.h
charset8x8.h

Output files

16F88-dot-matrix-8x8.hex

Code description.

16F88-dot-matrix-8x8.c

This contains all the code except :

    • 8x8 character definitions in charset8x8.h
    • Bit manipulation routines found in bit.h
    • Type definitions in types.h

The code is simple and easy to follow - all the action happensin main().

It enters a continuous a continuous loop blinking an led onport A and driving the columns of the 8x8 led display and driving the 4017 (forrows). At each blink the next character is selected from the character set.

The code repeatedly executes the for loop and it must go fasterthan 20ms for 8 columns - so the code has to go faster than 20ms/8 = 2.5ms -which it does. So there is no visible flicker.

At each row (selected at each iteration of the for loop) thenext column data is output so that the entire character is displayed.

You can program the PIC in circuit through the ICSP connector.

Note: There are two controls for adjusting the display:

FLIPLR which swaps all the bits in each outputrow.

ROT180 which turns the display upside down.

You will probably get the display orientation wrong and these fix thatproblem in software!

×

Top of page

How to drive a Dot Matrix LED Display.
Specification
Project details.
Hardware operation
Multiplexing
Helper chip
Row current sink
Character Set
Dot Matrix LED Display Software
Compiler project files
C Source files.
Header files.
Output files
Code description.
16F88-dot-matrix-8x8.c

Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.


Privacy Policy| Contact| About Me

Site Map| Terms of Use

How to Easily drive a an LED dot matrix display: 8x8 or 5x7 LEDs. (2024)
Top Articles
Latest Posts
Article information

Author: Corie Satterfield

Last Updated:

Views: 6259

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.