Вы находитесь на странице: 1из 14

How to drive an led display matrix.

Driving a 64 LED display matrix is quite simple and just requires ONE TRICK!

(Note: Item Displayed is not the same as the circuit shown on this page)
(CLICK IMAGE to Buy This Kit)

Here you can find out how to drive an led matrix with 64 LEDs (8 rows by 8 columns - 8x8
display) or less e.g. 35 LEDs (7 rows by 5 columns - 5x7 dot matrix).

It uses persistence of vision to let you drive the 64 led matrixes with only 10
microcontroller outputs!
Normally you would need 64 outputs for 64 LEDs but by using multiplexing and a helper
chip you can get away with 10.
LED Display multiplexing simply means turning on one led for a short period of time and doing
this repeatedly for each LED.
If you do this fast enough then your eye will not notice any flicker.
Note: The unit used in this project is simply an array of 64 LEDs.

The LEDs are no different to any other LEDs but it saves a huge amount of soldering as all the
wiring has been done for you.

...Or you could wire it up yourself if you can't get hold of the module.
If you wire it yourself you still only need 10 control wires (just wire you leds the same as shown
in the module diagram).
LED display matrix 8x8 LEDs
Learn about the tool used for creating this diagram.

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

Steps to make our own dot matrix:

Step 1Plan
The first task is to plan the project.

I built the cuircuit on Eagle so I could see the connections and test the LED matrix. It also
enabled me to learn how to light the individual LEDs.

First thing to do is to add all the support stuff for PIC, so I need power supply, download socket
and reset. I also need to arrange the outputs in simple to use rows. This defined the size of the
PCBs so I spent as much time as I could reducing the size until I couldn't get it any smaller.

The next step was to place the 20 LEDs in the dot-matrix, connectign all the anodes in columns
and all the cathodes in rows. This is impossible to do without using link wires unless your using
double layer board or double sided board. I wasn't so I will be using link wires.
Step2PCB
Well it needed to be made some how.

I designed the PCB on the school computers, which had PCB Wizard 3. Great piece of software,
very easy to use but still very powerful. Unfortunately this means while I have the PCBWiz3
files, I don't have them in any other format, and the only pictures I have are the photo-etch
masks, always good practice to wrap them up in the photo-etch mask paper for later use, or just
documentation. Unfortunately they scanned in rather badly.

However as I redesigned the circuit on Eagle, I've gone and re-made the PCB.
image not found

out:{ top: 0.10457516339869281, left: 0.14107142857142857, width: 0.2875, height:


0.738562091503268, text:"The display board, you can see the long pads where I intend to
surface mount the link wires." }

The display board, you can see the long pads where I intend to surface mount the link wires.
pinski1

step 3Get the Parts


Once you know what your going to do you need the parts.

I used:

20 Diffused Blue LEDs


1 PICAXE 18X Microcontroller
1 serial socket
1 22kOhm resistor
1 10kOhm resistor
lots of black multicore wire
lots of red multicore wire

I used a PICAXE PIC as I've used them in school, they are very simple. I find them very simple
to program, and then download the program to. PICAXE BASIC is of course the only PIC
language I know as well, so that limits them. They are meant to be quite easy to find, although in
the UK you can just go to
Rapid Electronics - PICAXE

PICAXE manual - It is a .pdf


PICAXE chip data - also a .pdf

I bought the LEDs at the same time, now as I was going for a blue dot-matrix these were my
choice, and I paid for that, 48p per LED, so £12 for the whole lot, it was cheaper to buy in a pack
of 25. Of course if your going make it you can use what you want, although to use my PCB
layouts you'll be wanting a 5mm package.

I needed the 4k7 Ohm resistor for the reset, unless the reset pin (pin 4) is pulled high by the 4k7
ohm resistor then the PIC will constantly reset, which is bad.

I used the stereo socket, 10k ohm resistor and the 22k ohm resistor for the download socket, this
means the whole unit is self contained, which is very handy. Also prevents the PIC being ruined
becasue I keep having to pull it out and eventually end up snapping the legs off, what a way to
waste £4.75...

I had the PCBs etched at school so they were essentially free. However we use poor quality
boards so the tracks can be pulled off quite easily, but I didn't think that would be a problem, not
yet at least. Oh was I in for pain.
step 4Soldering
Once you have the parts, it's time to connect them all together.

The first board I began soldering on was the display board. There were a number of reasons, it
looked the most boring, it would be great fun to play with once I'd finished, and it would be
boring, wait, did I mention that ?

So once I'd cleaned up the tracks with some wirewool I began cutting and attaching link wires.
These were damn fiddly and quite hard to make and then fix in place, so in absence of a dutiful
ceramic-fingered assistant I used sellotape, which lead me to the discovery, not for the first time,
that burnt sellotape is nasty nasty stuff.

Once this was complete I started soldering the LEDs, I started from the top and worked my way
down doing them individually, until I got bored and started on whole rows at once. Towards the
end it got quite difficult as the LED leads stuck out quite a way. Once all 20 LEDs were
soldered, I attacked the back and snipped off all those pesky leads as far down as I could. And
true to my earlier thoughts grabbed a spare 6v battery pack and battery clip and began running
the wires up and down the connections lighting up columns. This looked pretty good on it's own,
infact, the rest of the project may have been worth it just for this look. Of course for some
strange reason whole rows were lighting up together but at this point I didn't quite notice...

image not found


560x420 : F0HP3XAK50EP27ULNG (1)

This is the back of the main board, here you can see the PCB layout, not to mention my
beautiful soldering.
pinski1
i

step 5Neaten it up
Once you've soldered the boards together it's time to neaten them up. There are a number of
things you can do.

Remove excess flux:


Flux helps the solder flow and make good contacts however it does look pretty nasty when dried
and is best getting rid of for that beautiful look. The best way to do this is you dab at the board
with a rag which you've soaked in acetone. Where abouts would you get acetone I hear you cry ?
Well you can get it some art shops, you can also buy it at some boating/marine shops as a part of
the fibreglass range, however the best source is in fact cheap nail varnish remover. So head down
to your nearest cheap pharmacist and start looking for the cheapest nail varnish removers. I'm
talking about 49p for 200ml, my past experience shows that this comes in pink bottles.

Clean up the edges of the boards:


This is as simple as sanding the edges of the board down so that they're smooth and flat. It's also
quite nice to round the edges.

And that's is about it for the moment.

step 6Programming
So you've made it, you've plugged the battery in, but wait, no, it's not working, or maybe you just
have to program it ...

Ah that'd be a good idea. Becasue of my forthought, I have a download socket already on the
PCB, so, just whack in the download cable, plug that into a serial port on your PC, get
Programming Editor, and get coding!

Of course it helps if you've programmed a PICAXE before, I've had about 4 years experience so
far, GCSE and AS/A level.

The first thing to do is to type:


main:

goto main

This just sets up the PICAXE for the program, put the important code between the main and goto
main, I do this so I don't forget to do it later. The next task is to set the outputs, which pins do
you want high, and which low. The long and time consuming way is to go:
high 1
high 2
high 3

low 1
low 2
low 3

Or you can be cool and set the states all in one line with:
let pins = %00001110

let pins = %00000000

This works by giving each pin a specific digit, so pin 8 is the fist digit, pin 0 is the last digit and
so on. We also need to be able to put a time delay in there so the pins are actually left on long
enough for the LEDs to light. There are 2 main PICAXE waiting commands, wait and pause,
wait 1 waits for 1 second, where as pause 1 waits for 1uSecond, which is what we need.

Those inclined to nit picking will have noticed that there are only 8 pins on the pins=%00000000
command. Yes, the ninth output on a PICAXE18X is infact the serial out pin. This requires a
completely new piece of code to set.
poke $05,%00000000

poke $05,%00001000

I'm not too sure why this works, or why it's nessesary, but I did get it from the friendly people at
the PICAXE Forum

So putting all that together gives us:


main: ' Letter A
let pins = %00011000 '
poke $05,%00000000 ' Set SERTXD line low
pause 1 '
let pins = %00100101 '
poke $05,%00001000 ' Set SERTXD line high
pause 1 '
let pins = %01000101 '
poke $05,%00001000 ' Set SERTXD line high
pause 1 '
let pins = %10001000 '
poke $05,%00000000 ' Set SERTXD line low
pause 1 '
goto main '

That should display the letter A on you dotmatrix display

step 7The finished thing


Here it is displaying a letter A.

And the second image is of a letter B in the dark, these are diffused blue LEDs with a freshly
charged 4x AA 2500mAh battery pack, quite bright. But not so bright as so you can't see the
display, perfect.
image not found

239x294 : FTMFDP5PHMERF7G3L8 (1)

This LED shouldn't be on, not at all, oh


dear, debugging to follow...
pinski1
i
step 8Improvements
It works, so now what, bask in the glory of a complete, and working project, no, not for a second.
How can I make it better, how can I make it cheaper how can I make it COOLER !!!

Well here's a few idea's that have been bouncing around my head.

SMD LEDs, okay, what if the leds were much smaller, that'd drop the total thickness of the
project by what, 5mm, smaller is better. Plus SMD is so much cooler looking, geek +5.

SMD PIC, whoa, more SMT goodness, geek +10 at least, okay it'd be un-removeable, but you
can still download programs to it while it's on the board. Oh and it'd drop the thickness of the
project, at the back by 5mm (don't forget the download socket though).

Professional PCB manufacturing, well, how easy woudl that be, sure it'd cost a bit, but it would
mean the boards are perfect, well, as perfect as you made them. You also get to play with fun
functions like multi-layers or double sided boards, imagine a double sided PCB, you wouldn't
need 2 seperate PCB then. Add to that SMD componants like resistors, LEDs adn PICs and
you've got a very classy, but expensive board. Here's a list from CadSoft, the people that made
Eagle, PCB Manufacturers .

Larger display, most displays are 5 by 7, mine's a 4 by 5, so making it larger would open up a
whole new range of display options. Of coruse you'd need more outputs, I only had 9 available,
but if you were to use a PICAXE28X you have up to 17 available outputs, thats an 8 by 8
display. Nice. However if you move away from PICAXEs onto other microcontrollers I'm sure
there are ones with different output pins. Another option is to Charlie-Plex the outputs, although
you'll need to be able to set output pins as inputs to get that working. I believe this is possible
with most non-PICAXE PICs, especially Arduino's.

Hopefully once my website ( TheDarkPlace or just The Dark Place) is up and running, I may be
able to sell kits of the 4 by 5 display, with a few options, such as 2 seperate boards, 1 complete
board and 1 complete board with 2 layers. That however depends on how many people like it.

Or you can just email me at: pinski1[at] gmail.com

Here's some pictures of the layouts.


image not found

273x383 : F30FQPKE28ERIE30ZL (6)

The display.
pinski1

The download socket.


pinski1

The PICAXE.
pinski1

The reset.
pinski1

This is the two earlier boards made into one. It is


much larger, but does simplify the construction
process.
pinski1
The power.
pinski1
i