PDA

View Full Version : Table LED Matrix, Weeks of debugging, column problems



mekohler
- 6th November 2007, 22:33
1) I successfully constructed a programmable LED matrix using this schematic: http://www.injektilo.com/LEDTable/CIRCUIT.jpg

Which worked prefectly.

2) My next step was to make the real version, where each LED in the original version would be replaced by 6 LED's in parallel. All of this was going to be mounted in a table under some stained glass etc.

3) I was told I would need to modify the schematic a little, by adding transistors to each column and row, like this:
http://www.injektilo.com/LEDTable/NEW%20CIRCUIT.JPG

Note: 4.7k's are actually 2.2k

4) The rows work fine and independant, but when ONE column is programmed to be on, all the others go on as well! Video of it in action:
http://www.injektilo.com/LEDTable/Debug%20xvid.avi

I was told this:

"what happen when you have a voltage difference between the emitter 12volts(column transistors) and 5volts when the 74ls line are not active the transistor base sees this as more negative and turns the transisitor on and is on all the time. What we need on the base of the column transistor is to get it up to 12volts the same as the emitter until the 74ls pulls it to ground and then turns the transisor on. The problem is can we put the base at 12volts which puts 12 on the lines of the 74ls and should only be a max of 5volts to hold it high."


So far, I have tried removing the 2.2ks from the columns but that made the 74ls get really really hot really really fast. So I replaced the fried 74ls with a new one and re-added the 2.2k's. Then I was told to try adding a 100k resistor between the Base and emitter of columns but that didn't work either (I think, my soldering job on that may have been shoddy bcs there is little room to work with)

Any advice? This is my last problem as my table has been constructed. I hope I don't have to start from scratch or something. I spent so much time making the LED bundles and circuits. Help!


Edit: someone suggested: "if you add a 8.2V zeners in series with each of the base resistors for the column PNP transistors, and use a 22k between base and emitter to turn the transistor off, you will be good. This way the transistors will be turned properly off when not activated, even if the voltage difference is 7V. The zener voltage is a bit higher than necessary, to cancel any leak problems with the zener. They tend to start leaking a bit before they turn on. You still hav almost 4 volts to drive the transistor.

Without the zener, all transistors is on all the time and will light the complete row you activate with the row transistors."

Ioannis
- 7th November 2007, 09:08
I have three suggestions.

1. Replace all 2222 transistors and their base resistors with a single ULN2004 chip.

2. Replace 74LS138 with a HC138 type.

3. Add an NPN to drive the PNP transistors since there is current flowing from the emitter-base junction of each PNP transistor. I had this problem too. Put res. from +12 to base of PNP. Then res. from PP base to collector of NPN. Emitter of NPN to ground. Base of NPN with res. to driver.

Ioannis

mekohler
- 7th November 2007, 18:12
I don't think using the ULN2004 chip would require recoding. Would the replacement of the 74LS require the coding for the PIC to be different? Should I use an inverter, and if so, can you recommend one? I have been working on this for so long I am losing my mind haha. Here is the sample code I am using



#include <pic.h>


__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS &
UNPROTECT \
& UNPROTECT & BORDIS & IESODIS & FCMDIS);

int i, j, k, n, Dlay, CurLetter;

const char Letters[] = {

0b0000001, // A
0b0000001,
0b0000001,
0b0000001,
0b0000001,

0b0000010,
0b0000010, // B
0b0000010,
0b0000010,
0b0000010};

main()
{
PORTA = 0; // All Bits are Low
PORTC = 0b000001; // Start With Top Left
CMCON0 = 7; // Turn Off Comparitors
ANSEL = 0; // Turn Off ADC
TRISA = 0b101000; // RA5/RA3 Inputs
TRISC = 0;

CurLetter = 0; // Start With "A"

while (1 == 1) // Loop Forever
{
for (Dlay = 0; Dlay < 25; Dlay++)
for (i = 0; i < 5; i++)
{
j = Letters[(CurLetter * 5) + i];
k = (j >> 2) & 0b010000;
PORTC = j & 0b111111;
PORTA = k + i;
for (n = 0; n < 259; n++); // 4ms Delay
}

CurLetter = (CurLetter +1) % 2; //Increment Letter
}
}


If you have the time, a quick schem would be great. I am new to all of this, this is my first project. thanks!

Ioannis
- 9th November 2007, 08:34
The ULN chip is inverter! Of course you will have to change the data driven to output of PIC. Just reverse 1's and 0's.

Ioannis

jukeman
- 25th November 2007, 23:06
Does the 74LS138 and 74HC138 see data in different ways. Is it truly a drop in replacement?

mekohler
- 26th November 2007, 02:44
Before I go about trying to implement some of the suggestions, can anyone explain to me why my row's, when activated, only go to .98V? Also the ouput to my decoder from the PIC is at a constant 1.98, 1.98, .98 V (3 ouputs controlling 5 columns). Why is this so? I posted the code in a few posts back.

jukeman
- 26th November 2007, 03:09
Is there a pnp driver just the opposite of the ULN2004?

Ioannis
- 26th November 2007, 07:36
Before I go about trying to implement some of the suggestions, can anyone explain to me why my row's, when activated, only go to .98V? Also the ouput to my decoder from the PIC is at a constant 1.98, 1.98, .98 V (3 ouputs controlling 5 columns). Why is this so? I posted the code in a few posts back.

How are you measuring that voltage? By Multimeter or Oscilloscope?

Ioannis

mekohler
- 26th November 2007, 19:25
Voltmeter. I have the ground pin connected to the ground of my PSU and the + to the ouput of the respective pin on the PIC. Could it be something in the coding? I am also using the Return output of my PSU for ground.

Ioannis
- 26th November 2007, 20:33
You cannot measure the pulses with just an voltmeter. You need for sure an oscilloscope.

The measurement is an "average" of the pulses. So that value sounds OK on a voltmeter.

Ioannis

jukeman
- 28th November 2007, 02:00
Ioannis,

I was working with Marcos on this and I am a little confused with the code and it using the decoder 74LS or HC138! We have the circuit working but the thing I noticed is that the PIC does not just give the 74LS138 just single HIGH and LOWS on the address lines. I used a logic probe since I don't have a scope at home and I am getting pulses. I also get pulses out on the outputs of the 74LS138. I can confirm this because I can see it when the leds light they have a pulse to them. In my experience working with electronics and looking at the data table for the 138 that it does not require a data stream but just highs and lows. The signal(pulses) I am getting is very fast. In my theory it should not require that fast of pulses for what we are doing. I should also be able to see the highs and lows at least from the 138 outputs that controls the column output lines.

I have attached a pic of the circuit and the code. If you could explain the code I would appreciate it. I am more of a VB6 programmer not a microprocessor programmer though I am learning.

If the code can be changed to not have those pulses going on it would make for a better circuit.

#include <pic.h>


__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS &
UNPROTECT \
& UNPROTECT & BORDIS & IESODIS & FCMDIS);

int i, j, k, n, Dlay, CurLetter;

const char Letters[] = {

0b10000,
0b00000,
0b00000,
0b00000,
0b00000,

0b01000,
0b00000,
0b00000,
0b00000,
0b00000,

0b00100,
0b00000,
0b00000,
0b00000,
0b00000,

0b00010,
0b00000,
0b00000,
0b00000,
0b00000,

0b00001,
0b00000,
0b00000,
0b00000,
0b00000,

0b00000,
0b00001,
0b00000,
0b00000,
0b00000,

0b00000,
0b00010,
0b00000,
0b00000,
0b00000,

0b00000,
0b00100,
0b00000,
0b00000,
0b00000,

0b00000,
0b01000,
0b00000,
0b00000,
0b00000,

0b00000,
0b10000,
0b00000,
0b00000,
0b00000,

0b00000,
0b00000,
0b10000,
0b00000,
0b00000,

0b00000,
0b00000,
0b01000,
0b00000,
0b00000,

0b00000,
0b00000,
0b00100,
0b00000,
0b00000,

0b00000,
0b00000,
0b00010,
0b00000,
0b00000,

0b00000,
0b00000,
0b00001,
0b00000,
0b00000,

0b00000,
0b00000,
0b00000,
0b00001,
0b00000,

0b00000,
0b00000,
0b00000,
0b00010,
0b00000,

0b00000,
0b00000,
0b00000,
0b00100,
0b00000,

0b00000,
0b00000,
0b00000,
0b01000,
0b00000,

0b00000,
0b00000,
0b00000,
0b10000,
0b00000,

0b00000,
0b00000,
0b00000,
0b00000,
0b10000,

0b00000,
0b00000,
0b00000,
0b00000,
0b01000,

0b00000,
0b00000,
0b00000,
0b00000,
0b00100,

0b00000,
0b00000,
0b00000,
0b00000,
0b00010,

0b00000,
0b00000,
0b00000,
0b00000,
0b00001};

main()
{
PORTA = 0; // All Bits are Low
PORTC = 0b000001; // Start With Top Left
CMCON0 = 7; // Turn Off Comparitors
ANSEL = 0; // Turn Off ADC
TRISA = 0b101000; // RA5/RA3 Inputs
TRISC = 0;

CurLetter = 0; // Start With "A"

while (1 == 1) // Loop Forever
{
for (Dlay = 0; Dlay < 25; Dlay++)
for (i = 0; i < 5; i++)
{
j = Letters[(CurLetter * 5) + i];
k = (j >> 2) & 0b010000;
PORTC = j & 0b111111;
PORTA = k + i;
for (n = 0; n < 259; n++); // 4ms Delay
}

CurLetter = (CurLetter +1) % 25; //Increment Letter
}


Thanks,
Kevin

Ioannis
- 28th November 2007, 08:03
Besides the factor that I don't understand the data block at the beginning of the snippet and also that I don't program in C, your code seems that is doing what is supposed to do.

There are 2 loops one inside the other, scanning the matrix with 4ms from col to col so a total of 20ms is achieved to scan the whole matrix. I cannot understand what is bothering you exactly. The pulses you mention have to be there! Otherwise cannot the display cannot be scaned. Am I missing something?

Ioannis

mekohler
- 28th November 2007, 18:35
Finally got the damn thing working. I still don't understand the oscilloscope bit but oh well.

http://www.youtube.com/watch?v=kuMaE_b4Wg4

Ioannis
- 28th November 2007, 20:01
And the problem was?

Ioannis

jukeman
- 28th November 2007, 23:40
The problem was what he was wanting to do with a simple circuit in the beginning!

Watch the video link and you will see the leds flashing instead of staying on steady, it's just like they are running from a pulse width modualtion setup with a low frequency and you can see them flash.

I guess from the way you talk to me that I don't know what I'm talking about, it works don't it. I just don't like the flashing. They should either be on or off and not flashing! Why does it need to scan the matrix were not running video across it, come on i'm not a newbe here!

Ioannis
- 29th November 2007, 08:54
Hey Kevin, cool down. I am trying to help here.

You may know little, much or everything, I don't argue about that.

I am pointing out some cases that I susspect or have opposed during my experiments and would like someone have pointed me when I was awake all night to spot them...

Anyway, seeing a matrix, one guesses that scanning is needed. I did not quite understood from the beggining that finally only one element should stay on at a time.

The programm in C was writen to scan the matrix. For a completely different application than yours.

For your case, yes, if you want to just light one element at the time, only the col and row that corresponds to must be ON. There is no need for scanning resulting the flickering you see.

So the programm should only set the corresponding bits at proper level (0 or 1) and wait for a few seconds. At C I don't know how though.

Ioannis

mekohler
- 1st December 2007, 22:33
Im concered that the LED clusters are not as bright as when I tested them individually, and they are barely shining through the diffusive glass I have over them.

Kevin suggested to change the program to not run pulses. Is anyone familiar enough with this to help me?

Here are some measurements:

Voltage:

1) From PSU Ground to a single LED Cluster (6 LED's in parallel with a resistor) COLUMN input: 5.25 V

2) From PSU Ground to single LED Cluster (6 LED's in parallel with a resistor) LED Cluster ROW input: 3.85 V

3) From ROW input to COLUMN input of a single cluster: .86V (I dont think this means anything, since this is an incorrect way to measure V)

Current:

4) Removing one LED cluster in the all lit column and connecting column output of LED below and column input of LED above to the meter: 2.53 using 20mA setting/resolution

5) Removing one LED cluster in the all lit row and connecting row ouput of LED to the left and row input of LED to the right to the meter: 12.17 using 20mA setting/resolution

mekohler
- 3rd December 2007, 03:05
Update: I still have row 1 and column 1 on for testing. I removed one of the clusters in the first column and tried lowering the resistor values of 300 to 150, 47, and no resistors. The brightness obviously goes up as I go down in R, but even at no resistors the cluster is not as bright as an extra "test" cluster detached from the table and connected to a 9V battery.

I used this extra cluster connected to a 9V battery for my intial table construction, as it was bright enough for the glass, and I assumed it would be getting 12V, so I knew for sure it would be sufficient.

Any ideas?

nomad
- 3rd December 2007, 13:23
the plain fact is it is a matrix. in order to control each led without having a separate output for each led it needs to switch from row to row or col to col. in other words scan the matrix. if your seeing hy flash, then it is not scanning fast enough. by adjusting the scan rate and pulse width you can control the brightness. as loannis said it's doing what it's supposed to be doing. with a scope you can actually see the pulses and determine if they are too short or too far apart or anything else that is happening with them. if you just want them all on or off take out the pic and insert a switch.

nomad
- 3rd December 2007, 13:29
you will never get the matrix as bright as your test cluster. to switch say 5 rows only one is on at a time. so each row is on only 20 percent of the time max.

nomad
- 3rd December 2007, 13:41
i'm not a C programmer but it looks like the line that says 4ms delay is your delay between rows. you could try making 259 a smaller number. i think that would get rid of your flicker but may make it even dimmer.

mekohler
- 3rd December 2007, 15:47
i'm not a C programmer but it looks like the line that says 4ms delay is your delay between rows. you could try making 259 a smaller number. i think that would get rid of your flicker but may make it even dimmer.


There is no visible flicker in person. It only showed on the camera because of the fast framerate it captures at. The only problem is brightness.

Update: I tried increasing the delay...that helped brightness a little but made the flicker noticeable to the human eye

Ioannis
- 4th December 2007, 09:00
Yes, that's the price one has to pay, I 'm afraid. You cannot scan the matrix without a little flicker.

On the other hand, you may increase the current that LED's draw. Do you have the data sheets about that LEDs? Are they capable to withstand more than 20mA?

On a recent project I used Kingbright LED 5mm @ 20mA. They were really bright! They are 10000mcad and may replace car lamps (that's what I intend to do soon).

Ioannis

T.Jackson
- 4th December 2007, 15:09
i'm not a C programmer but it looks like the line that says 4ms delay is your delay between rows. you could try making 259 a smaller number. i think that would get rid of your flicker but may make it even dimmer.

The faster the better is what I concluded with all the research I did in this area. Forget about any sort of delay on top of pulse width control. Just scan the thing like a bat out of hell.

mekohler
- 5th December 2007, 14:54
Yes, that's the price one has to pay, I 'm afraid. You cannot scan the matrix without a little flicker.

On the other hand, you may increase the current that LED's draw. Do you have the data sheets about that LEDs? Are they capable to withstand more than 20mA?

On a recent project I used Kingbright LED 5mm @ 20mA. They were really bright! They are 10000mcad and may replace car lamps (that's what I intend to do soon).

Ioannis

Here you go! http://superbrightleds.com/specs/r3_specs.htm

Looks like it's 50 mA, what would your solution be?

Just connected to a 9V battery with the appropriate resistors they are too bright to look at directly. In my table, however, that is not the case :[ . There isn't any way to account for the scanning/duty cycle?

Thanks to all of you for the help so far

Ioannis
- 6th December 2007, 08:46
If you take a closer look at the spec's you presented, you will notice that the 1/10th duty cycle current is 200mA. That is, your ON pulse must be 100usec and the OFF width 900usec. Little tough, but you can do it. No flicker then!

So, choose the approrpiate timing to be that 1/10th ON and the resistors to give that 200mA and ... wear your sunglasses!

Also there is also the power dissipation of the LED, 125mW. You must never exceed this limit.

Ioannis

mekohler
- 7th December 2007, 08:52
I see what you're saying but I am at a complete loss right now

he Dlay loop is just the time delay until I move on to my next pattern/letter on the WHOLE table..in my real code it is modified to read the value off a pot so I can control the speed of patterns.

the i loop is to scan all 5 columns

the n loop is the delay between scans I believe...if I increase the n value then you can notice a flicker in the table as it scans...so If i program it to spell "Hi"...you can see the H flash on and off over and over, then it goes to I and flashes that on and off over and over...if n <259 there is no visible flashing/scanning...not even sure I need this loop!


That is all I have control over, and besides lowering/raising the n loop delay, I am not sure what I can do.

Ioannis
- 7th December 2007, 22:28
Well, I see that we both are not good at C, so why don't you drop it and use the PicBasic Pro that we all do here?

I am sorry but cannot help you more with the C program.

The tips at my last post I believe are enough to get your display bright enough at scan speed specified. But after that, the coding is another matter.

Ioannis