PDA

View Full Version : LED Matrix Question



mekohler
- 25th September 2007, 17:15
My grandfather and I are undertaking a project to build a table lit by a 5 x 5 matrix underneath (composed of LED's). The schematic we followed is here:

http://www.injektilo.com/PICHelp/schematic.png

We used an exe to convert the "frames" of a "word" into a string of numbers and then another exe to convert it to a .bin, which is loaded into the EEPROM (24LC64).

For example, to spell TEST, the first frame is T, the 2nd E, etc...and the .txt output is:

1 1 31 1 1
0 31 21 17 0
0 23 21 29 0
1 1 31 1 1

This is then converted to a .bin:

http://www.injektilo.com/PICHelp/sequences.bin

Now we need to control the EEPROM to feed the LED's but we don't know how. We found this picture of someone who did the same project with the same schematic:

http://www.injektilo.com/PICHelp/PICT0003.JPG

Its obviously a microcontroller which connects to the 10 ports in the upperleft of the schematic (next to the 24LC64 EEPROM)...but I can't make out the connections on this circuit and I don't know how I would program it to access the EEPROM bits and "push" them to the Matrix one after the other, and cyle...so the table would read T, then E, then S, then T, then T, then E, etc.

I know this is alot, but we are so close to finishing and this is the first time we have done anything with PICs. Thanks for all the help guys.



Marcos



P.S. - The 4 chips above the expanders (PCF8574A) are http://www.electronelec.co.uk/uln2803a.htm

SteveB
- 25th September 2007, 18:01
Both the EEPROM and the PCF8574A use the I2C communications. At the bottom-right of the schematic you will note two pull up resistors on the lines that connect the I2C bus to the 5 chips.

So, the micro controller will use I2C to address the desired device as needed. EEPROM for storage and retrival of the data. PCF8574A for the actually setting the values for each element of the matrix.

That's the simplified overview.

HTH,
SteveB

mekohler
- 25th September 2007, 19:30
Both the EEPROM and the PCF8574A use the I2C communications. At the bottom-right of the schematic you will note two pull up resistors on the lines that connect the I2C bus to the 5 chips.

So, the micro controller will use I2C to address the desired device as needed. EEPROM for storage and retrival of the data. PCF8574A for the actually setting the values for each element of the matrix.

That's the simplified overview.

HTH,
SteveB

Ok, so I am correct in the assumption that the microcontroller is connected to the left of the EEPROM on the schematic? I've been told that this is an intermediate to advanced programming level for the PIC? Is there anything you recommend me reading so I can program this? Or any sites that offer custom program solutions for $$$?

SteveB
- 25th September 2007, 21:11
Ok, so I am correct in the assumption that the microcontroller is connected to the left of the EEPROM on the schematic?
Yes, this is correct. The pin arrangement is as follows:

1- N/C 10- N/C
2- N/C 9- N/C
3- Data 8- Clock
4- N/C 7- N/C
5- +5V 6- GND


I've been told that this is an intermediate to advanced programming level for the PIC?
Yes, but not insurmountable for a beginner, if approached in a building block manner. The basic communication in the circuit is not too complicated. The algorithms for the display may be a little tougher.


Is there anything you recommend me reading so I can program this?
Well, I can only speak for myself. I read through Myke Predko's book, "Programming and Customizing PICmicro Microcontrollers." (It is a little dated, and deals with assembly, but good initial explanation on the internals of the PIC. He also uses "psuedo code" a lot, so it's not too bad a transition). After that, get into the datasheets, for both the PIC, and other components. For PBP, there are examples all over the place for specific tasks. MeLab's own site has a nice set of example files.

A quick summary:
a) Know the PICmicro controller. (What can it do, and the basics of how)
b) Understand how the components work together in the circuit (Like the I2C comm)
c) Use PBP to get the PIC to do it’s job.

Rather simplistic, and very much my own experience/opinion.


Or any sites that offer custom program solutions for $$$?
I can’t really speak to this. Others may help.

SteveB

Dave
- 25th September 2007, 22:06
mekohler, I might be blind but, I don't see any schematic, only an overlay for a PC board....
I may be able to help as I have used PCF8574A's for many products in the past.

Dave Purola,
N8NTA

mekohler
- 25th September 2007, 23:02
mekohler, I might be blind but, I don't see any schematic, only an overlay for a PC board....
I may be able to help as I have used PCF8574A's for many products in the past.

Dave Purola,
N8NTA

You are correct, I didn't upload the schematic. That is here:

http://www.injektilo.com/PICHelp/schem.bmp


I have a feeling that jumping straight into this form of the project might be too difficult (considering my time constraints). I have come across a more common LED Matrix layout, and I have uploaded the pictures and code here:

http://www.injektilo.com/LEDMATRIX/

Again, I won't be using a 5x7 display, but a handmade 5x5 one. If I use this, it seems as though all the work is done for me (hehe).

My only question is....I want to replace each SINGLE LED with 5 LED's in PARALLEL (since I need to shine this through a diffusive plexi material, so I need the brightness and spread of light). Since they are in parallel they will each receive the same voltage as the single LED...but what about current? Would I need one resistor for each LED in the "parallel cluster" ?

My friend says: the important bit is that each LED should have its own resistor. Otherwise only the LED with the lowest internal resistance will light.

If so, what equation governs the value of each resistor? Argh! I just want to get this project I started over with before I move and then start my serious and gradual study of PIC programming.

Sorry for the change of course (or possible change). Again thanks for all the help guys!

Ioannis
- 26th September 2007, 07:58
No, you cannot parallel LEDs Diodes or Bipolar transistors (only FET). Since each of them is not a resistor the current cannot be shared among them. You sure need a resistor in series.

But you already have post this as in the link http://www.injektilo.com/LEDMATRIX/8%20Led%20Matrix%20Example.JPG

Ioannis

Dave
- 26th September 2007, 12:34
mekohler, Why not series connect the LED's and use only 1 resistor. 1.8 volts x 5 = 9 volts. The driver you have is open collector so you can use 12 volts for the LED source and use say a 150 Ohm resistor in series and that will give you 20Ma. for the string.

Dave Purola
N8NTA

Ioannis
- 26th September 2007, 12:43
Thats what I meant but was not very clear. Anyway the link http://www.injektilo.com/LEDMATRIX/8...%20Example.JPG is just that in picture! Seems to be the best choice right now.

Ioannis

mister_e
- 26th September 2007, 13:45
seems to have a problem with the link :(

i think it could be http://www.injektilo.com/LEDMATRIX/8%20Led%20Matrix%20Example.JPG

now let's show the schematic <IMG SRC="http://www.injektilo.com/LEDMATRIX/8%20Led%20Matrix%20Example.JPG">

T.Jackson
- 26th September 2007, 15:17
No, you cannot parallel LEDs Diodes or Bipolar transistors (only FET). Since each of them is not a resistor the current cannot be shared among them. You sure need a resistor in series.


Depends on the junction drop. If you have two LEDs perfectly matched, say 1.75V ea (or thereabouts) - both will share equal current. Tolerance levels are considerably quite remarkable nowadays. No need to spend hours with your meter looking for matched BJT pairs for that destined to be perfect amplifier.

mekohler
- 26th September 2007, 15:48
Thanks for the help guys.

I think I settled on constructing the matrix like this:
http://www.injektilo.com/LEDMATRIX/8%20Led%20Matrix%20Example.JPG

And the schematic is:

http://www.injektilo.com/LEDMATRIX/CIRCUIT-Edited.jpg

Let me know if you see any problems. Also, the book I am learning from recommended using the74LS174 decoder. and has provided example code.

sayzer
- 26th September 2007, 16:14
You seem to have good progress.

Here is a similar approach.

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2045&d=1190816000">

mekohler
- 26th September 2007, 18:12
Thanks!

If I'm only using RC0 - RC4 as my outputs on the PIC (ommitting RC5)...the declarations of PORTC = 0b111111 and PORTC = 0b011111 do the same thing, bcs the low 0 or 1 bit isn't connected to anything, correct? I can leave it like that, or should I omit that bit and just use 0b11111?

sayzer
- 27th September 2007, 08:47
In PBP, PORTC = %11111, for instance, will set RC0, RC1, RC2, RC3 and RC4.

This should be the same in your "0b11111" example. Since you do not care about RC5, and possibly RC6 and RC7, then you can use one of your three "PORTC = 0b111111" or "PORTC = 0b011111" or "0b11111" examples.

They will all set RC0, RC1, RC2, RC3 and RC4 anyway.

Ioannis
- 27th September 2007, 09:00
Depends on the junction drop. If you have two LEDs perfectly matched, say 1.75V ea (or thereabouts) - both will share equal current. Tolerance levels are considerably quite remarkable nowadays. No need to spend hours with your meter looking for matched BJT pairs for that destined to be perfect amplifier.

Sure technology advances forward but just to be sure, i'd put a small resistor there. You never know...

Ioannis

T.Jackson
- 27th September 2007, 10:31
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2046&stc=1&d=1190881148" align="center" border="1">

Diagram above depicts two 1A power diodes paralleled together in attempts of obtaining 2A. As you can see, only a minor difference in drop (300mV in this case) - will mean that one of them is going to be working harder. In the case of what's illustrated above, D2 will be working around 5% more than D1.

If anyone doesn't agree with this, by all means speak up.
<br/>

Dave
- 27th September 2007, 13:28
mekohler, I don't think your design using an 74LS174 will be able to drive the current you are anticipating using. Even with only 20 Ma. per led string in parallel, thats 40Ma. An normal 74LS series part can at best case source 5Ma. You are going to need a high power sourcing device such as a PNP transistor to source the required 40+ Ma. I beleive after your design has been prototyped you will find that if you are multiplexing the displays at any kind of rate you will lose almost all of the intensity. Therefore you will have to increase the current to the display system. Most wallboard displays you see in stores for advertising use anywhere from 100 to 500 Ma. as the display is multiplexed and switching at high speeds. I suggest looking at Allegro semiconductor as they have a variety of sourcing drivers available...

Dave Purola,
N8NTA

mekohler
- 27th September 2007, 13:59
mekohler, I don't think your design using an 74LS174 will be able to drive the current you are anticipating using. Even with only 20 Ma. per led string in parallel, thats 40Ma. An normal 74LS series part can at best case source 5Ma. You are going to need a high power sourcing device such as a PNP transistor to source the required 40+ Ma. I beleive after your design has been prototyped you will find that if you are multiplexing the displays at any kind of rate you will lose almost all of the intensity. Therefore you will have to increase the current to the display system. Most wallboard displays you see in stores for advertising use anywhere from 100 to 500 Ma. as the display is multiplexed and switching at high speeds. I suggest looking at Allegro semiconductor as they have a variety of sourcing drivers available...

Dave Purola,
N8NTA

Actually, it is labeled incorrectly. My book says to use 74S138:

"In this application I used a 74S138 decoder to provide the column negative power supply select. The selection of the S technology decoder was selected over the more common LS technology to sink the most current (LED's fully lit) as possible"

Does that make any difference? The low level output current for the 74s138 is 20mA...still, according to you that is way too low. The ULN2803A is the transistor array for the "rows", which http://www.electronelec.co.uk/uln2803a.htm says outputs current to 500mA

Should I just place a second ULN2803A after the decoder?

T.Jackson
- 27th September 2007, 14:17
Those LEDs in the matrix arrays are very efficient. You'll get "satisfactory" light output from only 2-3mA for ea LED. The 74LS138, if you sink current from it, it might be adequate enough.

Dave
- 27th September 2007, 18:34
mekohler, Like I said in my earlier post, What are you going to use to source the current to the paralleled led strings?

Dave Purola,
N8NTA

mekohler
- 27th September 2007, 21:14
mekohler, Like I said in my earlier post, What are you going to use to source the current to the paralleled led strings?

Dave Purola,
N8NTA

I'm new to all of this. I thought thats what the ULN did. Pretty much what you see in my last post with the 2 pictures is all I have. I wouldn't know what else to add and in what config.

T.Jackson
- 28th September 2007, 06:36
There is no need to buffer the rows (the PIC end) - this isn't the weak entity. It's the columns that may need the boost.

mekohler
- 28th September 2007, 06:54
There is no need to buffer the rows (the PIC end) - this isn't the weak entity. It's the columns that may need the boost.

agreed. would adding another ULN to the column make a difference

T.Jackson
- 28th September 2007, 07:10
Personally, I think the diagram that Sayzer posted might be right down your alley for what you need. (it looks quite correct) Bout the only thing I'd add to it is - some current boosting for the columns (if I wanted the display really nice & bright) Handful of BJT's or couple of UNL2003 would do nicely.

mekohler
- 28th September 2007, 08:24
Personally, I think the diagram that Sayzer posted might be right down your alley for what you need. (it looks quite correct) Bout the only thing I'd add to it is - some current boosting for the columns (if I wanted the display really nice & bright) Handful of BJT's or couple of UNL2003 would do nicely.

The only thing he does differently is use a 4 to 16 decoder though (?).

T.Jackson
- 28th September 2007, 10:16
It's best to start by building / learning from other people's “know-to-be-good” circuits before you endeavor in developing your own. Eventually, you'll begin to see all these circuits as nothing more than pieces of a jigsaw puzzle. The jigsaw being your "target", your end-goal, where you will collate the pieces that you gather, modify, or develop over time. No point reinventing the wheel unless needed.

Best of luck with it.

Wilson
- 29th September 2007, 13:54
Diagram above depicts two 1A power diodes paralleled together in attempts of obtaining 2A. As you can see, only a minor difference in drop (300mV in this case) - will mean that one of them is going to be working harder. In the case of what's illustrated above, D2 will be working around 5% more than D1.

If anyone doesn't agree with this, by all means speak up.
<br/>

I cannot see where the 300mv difference in drop is. Looks a bit like 30mv

T.Jackson
- 29th September 2007, 14:12
You're right, one too many 0's - thanks for pointing it out. I'll see If I can mod the post.