Pages: [1] 2   Go Down
Author Topic: Two 4051's to drive 8x8 LED matrix - interference  (Read 2201 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

I am relatively new to the electronics and hope to find an explanation/some tip on the following.

I am using 2 x 4051 multiplexers (one as mux, second - demux) to have access to all 64 led in my LED matrix using only 6 Arduino pins.
My code is running as I wish but there appear some parasite leds. Here is complete code

Code:
const int oA = 5;
const int oB = 6;
const int oC = 7;
const int iA = 10;
const int iB = 11;
const int iC = 12;

int pinOuts[3]={oA,oB,oC};  //mux control pins
int pinIns[3]={iA,iB,iC};   //demux control pins

// adresses of columns of Matrix
int ColVol[8][3] = { \
    {LOW,LOW,LOW},\
    {LOW,LOW,HIGH},\
    {LOW,HIGH,LOW},\
    {LOW,HIGH,HIGH},\
    {HIGH,LOW,LOW},\
    {HIGH,LOW,HIGH},\
    {HIGH,HIGH,LOW},\
    {HIGH,HIGH,HIGH},\
};

// adresses of rows of Matrix
int RowVol[8][3] = { \
    {LOW,LOW,LOW},\
    {LOW,LOW,HIGH},\
    {LOW,HIGH,LOW},\
    {LOW,HIGH,HIGH},\
    {HIGH,LOW,LOW},\
    {HIGH,LOW,HIGH},\
    {HIGH,HIGH,LOW},\
    {HIGH,HIGH,HIGH},\
};


//sample letter "H"
int H[8][8]= { \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 1, 1, 1, 1, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}, \
    {0, 1, 0, 0, 0, 0, 1, 0}  \
};


void setup() {
     for (int f = 0; f < 3; f++) {
       pinMode(pinOuts[f],OUTPUT);
       pinMode(pinIns[f],OUTPUT);
     }
}


void loop() {
 

  for (int i=0; i<8; i++)
  {
    for (int j=0; j<8; j++)
    {
      if (H[i][j] == 1)
      {
        for (int k=0; k<3; k++)
        {
          digitalWrite( pinOuts[k], RowVol[i][k]);
          digitalWrite( pinIns[k], ColVol[j][k]);
        }
       delay(1);
      }
     
    }
     
  }

}

if I don't use delay (1) vertical columns of the letter H have neighbors slightly lit up.

Has someone seen this before?
Any ideas how to have exactly wanted leds on?

Thanks in advance
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am using 2 x 4051 multiplexers (one as mux, second - demux)
That is not very normal, have you got a schematic of how you have wired it up?
Normally an 8X8 matrix is wires up using latches and buffers.
Using a 4051 for lighting up LEDs not not a good idea. The current is limited. It is designed for more of inputs.
See this for typical configurations:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot for rapid reaction!

I am going to put schematic using Fritzing. need some time.
Cheers
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot for rapid reaction!

I am going to put schematic using Fritzing. need some time.
Cheers
Can you not draw it with pen and paper, that package produces totally unreadable schematics.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I attach an image of how things are hooked. I decided not to draw exact matrix pin connections (for the sake of image clarity), I personally do not think that it would matter for my problem.
I really do not get how leds that are in LOW@ +ve terminal and LOW@ -ve terminal can have any current passing through.
Thanks again for your time!


* Demux 4051_bb.jpg (973.48 KB, 1755x1779 - viewed 95 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I personally do not think that it would matter for my problem.
Yes but it would make other people understand what you are doing a lot better.

Sorry I don't know where you got that design from but it is very wrong.
First of all there is no current limiting components, a resistor is the simplest way of limiting the current.

Next you can only light up one LED at a time. This means that each LED is only on for 1/64th of the time. That means it will be very dim, remember you do fading with PWM by adjusting the on / off ratio.

Quote
I really do not get how leds that are in LOW@ +ve terminal and LOW@ -ve terminal can have any current passing through.
Yes you are right about this.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was thinking that the pullup and pulldown resistors attached to pin 3 (common out/in) of mux/demux would limit current.
Leds are already dim if hooked up with those two resistors only.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry but have you any idea how hard it is to see what a circuit is doing without a schematic.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a new sketch. Hope it clarifies things.


* mux-demux.png (83.28 KB, 1052x744 - viewed 84 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks now I can see exactly what is wrong.

1) You should not have any resistors in the +5V supply to the chip.
2) A series resistor of 2K2 in the common input to the selector is way too high. This needs to be in the order of 100R or so.

Having said that read my other concerns about this design, especial the bit about having a 1 to 64 on / off ratio of the LED the LED is always going to be dim.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you,

I did as you suggested but unfortunately the parasitic leds are still on. And here I am agree that it has to do with 1/64 on/off ratio.
To give an idea what I mean under "parasitic" I attach some photos of letter H:
one without delay( in the innermost loop) - columns #1,3,6,8 are not supposed to light up.
and two photos with delay (1) - you can see that these column get dimmer.
With even higher delays these column dissapear but the trade-off is that I get noticeable blinking.
I am asking myself now, if it is possible to have neat letters (static or scrolling or whatsoever) using two MUXes.


* delay 0.JPG (518.41 KB, 1296x968 - viewed 30 times.)

* delay 1.JPG (561.15 KB, 1296x968 - viewed 26 times.)

* delay 1 copy.JPG (391.45 KB, 1296x968 - viewed 31 times.)
« Last Edit: April 06, 2013, 01:26:04 pm by rodneysfan » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33292
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This comes about because when you write the three bits to change the data line selected you do this one at a time. So suppose you go from 011 to 100 you go through the intermediate stages of 010, 000 and 100. This addresses very briefly the wrong data lines and so can light up the wrong LEDs. Without a delay this intermediate state is a significant fraction of the time the targeted LED is on. As the delay gets longer this fraction gets smaller.

Ways round this:-
1) Use the data enable line to turn the data selector on and off while changing the address.
or
2) Use direct port addressing to change all the data select address lines at the same time. Although there will still be a slight amount of time with the wrong addresses due to propagation delays through the chip.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot!

I just read an article about direct port adressing, definitely an option to try out.
And data enable line you've mentioned, I guess you meant INH (inhibit) pin ? I will try and get back with feedback.

Have a nice Sunday
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2865
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you read the data sheet? the part about on channel resistance from a single ended supply? The applicable data sheets are supplied.

* 74HC4051.pdf (121.48 KB - downloaded 18 times.)
* CD405X.pdf (193.33 KB - downloaded 13 times.)
« Last Edit: April 06, 2013, 06:55:57 pm by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 142
Posts: 5290
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not use a chip that's designed for the job, like the MAX7219 ?

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1] 2   Go Up
Jump to: