Pages: 1 [2] 3 4   Go Down
Author Topic: Multiplex IR LED's?  (Read 6815 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34502
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The top ones are supposed to be LED's and the bottom ones are sensors so that I can have a matrix of LED's lighting up when the sensors detect ir light
In that case scrap that circuit it will not work for LEDs.
Read:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
For basic information about a matrix.
Logged

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

Quote
The top ones are supposed to be LED's and the bottom ones are sensors so that I can have a matrix of LED's lighting up when the sensors detect ir light
In that case scrap that circuit it will not work for LEDs.
Read:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
For basic information about a matrix.
Why wouldnt it? Cant I just rapidly iterate through each of the leds and turn them on
Logged

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

Quote
Cant I just rapidly iterate through each of the leds and turn them on
Not really the refresh rate and the on / off ratio would be rubbish. With an on off ratio of 64 : 1 the LEDs would be too dim. The 4051 has too much internal resistance to compensate for this by boosting the current and all the current has to come from the arduino pins. So while it would function it would be rubbish.
Logged

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

Quote
Cant I just rapidly iterate through each of the leds and turn them on
Not really the refresh rate and the on / off ratio would be rubbish. With an on off ratio of 64 : 1 the LEDs would be too dim. The 4051 has too much internal resistance to compensate for this by boosting the current and all the current has to come from the arduino pins. So while it would function it would be rubbish.
Ahh I see

So instead of using the 4051 you suggest I use something from the 74LS series or use a shift register?
After reading your article thoroughly it seems the 74LS seems like you choice you suggest, but you also mention shift registers, and since I'm looking to reduce the output pins as much as I can, that looks like a better Idea as your article says I only need 3 pins which is amazing, I have to go to school now but I have one question before I go smiley-razz
Do shift registers take inputs or should I just use the 4051 for the inputs since the sensors dont need to refresh as fast as the LED's, or even, should I use a 74LS series incase?
Logged

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

Quote
Do shift registers take inputs
There are shift registers that output parallel data from a serial input and other types that output serial data from parallel inputs.
But these are digital inputs, for your sensors you need an analogue input so go with the 4051.
Logged

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

Quote
Do shift registers take inputs
There are shift registers that output parallel data from a serial input and other types that output serial data from parallel inputs.
But these are digital inputs, for your sensors you need an analogue input so go with the 4051.
Alright cool, smiley

I guess I can use shift registers and some transistors to make my matrix, I found an example here: http://www.instructables.com/files/orig/F7J/52X0/G1ZGOSRQ/F7J52X0G1ZGOSRQ.jpg

I find It kind of hard to follow your description but I think I know what you mean. Do I use the PNP current source or FET to power the LED's ad is it in a cmos chip or is it handmade? Also what do I do for a current sink, do I need one aswell as a current source? Ill draw a diagram up when I get home
Logged

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

Most instructables are very poor, that one is no exception. You should never use a common collector transistor configuration to source current, it shows the person who drew the circuit dosn't know what they are doing.
You can get away with just a current sink if you only source one LED at a time from each pin. Otherwise you need both source and sink drivers. A PNP transistor or p-channel logic level FET shoul be used for the source.
For the sink you can use NPN transistors or n-channel logic level FETs
Logged

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

Nvm my previous post I think I understand this now

Using these 74HC595's http://www.jaycar.com.au/productView.asp?ID=ZC4895&keywords=595&form=KEYWORD
And Hopefully if I can these ULN2803's http://australianrobotics.com.au/products/darlington-driver-8-channel-uln2803-dip (I might not be able to use it because I need to be able to pay by check)
if not this pricy one http://www.altronics.com.au/index.asp?area=item&id=Z3010

I was able to come up with a way that uses alot of shift registers and no multiplexing, and a way that uses heaps less shift registers and multiplexing

Anyway this is the multiplexing way I believe should work, I dont really know:


I guess to use this I will use the shift out command explained here (Not with same pins):
and here:
http://www.arduino.cc/en/Tutorial/ShiftOut

I believe I can make this so only 1 LED is on at a time, that should work correct? FOr instance, if I do:
void setup() {
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
}
void loop() {
  digitalWrite(2, LOW);
  shiftout(0, 1, MSBFIRST, 0);
  shiftout(0, 1, MSBFIRST, 1);
  shiftout(0, 1, MSBFIRST, 1);
  digitalWrite(2, HIGH);
  delay(10);
  digitalWrite(2, LOW);
}
And the pins are:
Data 0
Clock 1
Latch 2

That should output Column 1, Row 1, which is the bottom left, then If I change it to this:
  shiftout(0, 1, MSBFIRST, 4);
  shiftout(0, 1, MSBFIRST, 0);
  shiftout(0, 1, MSBFIRST, 3);

it would be Row 3 and Column 12, which is near the middle to the very right.

If this is correct I Yaaaay smiley-razz ( I have not put in resistors because the darlington array made me weary of how it works, if I did put resistors in, should I just need 1 per row/column, and have them at 90 Ohms [R=V/I, R=(5-3.2)/0.02, R=90], Or will they get hot?)

Also I figured out how to use the photodiodes, by this guy: http://www.instructables.com/id/Infrared-Proximity-Sensing-Coffee-Table-Module/

I guess you place them in reverse bias and they can be used as voltage dividers smiley

Thanks again MIke smiley-grin
Logged

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

Most instructables are very poor, that one is no exception. You should never use a common collector transistor configuration to source current, it shows the person who drew the circuit dosn't know what they are doing.
You can get away with just a current sink if you only source one LED at a time from each pin. Otherwise you need both source and sink drivers. A PNP transistor or p-channel logic level FET shoul be used for the source.
For the sink you can use NPN transistors or n-channel logic level FETs
Oh LOL I must have been typing my post at the same time as you smiley-razz

What do you mean by NPN transistors or N-Channel Logic level FETs, on your site you mention them as sources dont you? And yes I will only have 1 LED on at a time, yet it will be blinking supa fast so u cant tell smiley-razz
Logged

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

Quote
And yes I will only have 1 LED on at a time, yet it will be blinking supa fast so u cant tell
No you won't, there are too many to do this and the on / off ratio will be too high.

Do not use pins 0 & 1, these are used by the serial communications and you will have difficulty uploading sketches.

As the 595 can only supply enough current for 1 LED you will have to drive that circuit to multiplex by column rather than the more conventional row.

 
Quote
What do you mean by NPN transistors
A bit fundamental this one, I suggest you shouldn't be doing a project like this if you don't know.
For some education see:-
http://www.kpsec.freeuk.com/trancirc.htm

Quote
Also I figured out how to use the photodiodes, by this guy: http://www.instructables.com/id/Infrared-Proximity-Sensing-Coffee-Table-Module/
Most of the people who write instructables are in fact idiots. The only people more stupid are the people who read them, just look at some of the inane comments you get. Try not to get your facts from this source.
Logged

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

A bit fundamental this one, I suggest you shouldn't be doing a project like this if you don't know.
For some education see:-
http://www.kpsec.freeuk.com/trancirc.htm
Sorry that wasnt really what I meant, I do know what they do, just I keep getting confused, when you use them on your site, it looks very different to how I thought they are used

Most of the people who write instructables are in fact idiots. The only people more stupid are the people who read them, just look at some of the inane comments you get. Try not to get your facts from this source.
I understand this, you keep saying it smiley-razz, The only thing is that they have working examples sometimes, and that is easier to understand to see it in action than just to read text. I only keep linking back to examples from their because the way many people do it there looks much easier than other options, whether its good or bad is another question

No you won't, there are too many to do this and the on / off ratio will be too high.

Do not use pins 0 & 1, these are used by the serial communications and you will have difficulty uploading sketches.

As the 595 can only supply enough current for 1 LED you will have to drive that circuit to multiplex by column rather than the more conventional row.
Oh, well that seems like I always have much to do this smiley-razz

Ok, now Im really confused. I thought I am doing a column scan cuircut, do you mean row scanning or am I doing the matrix wrong? Can you give me an example? Or .... is it my example code?
Logged

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

Quote
f I did put resistors in, should I just need 1 per row/column,
You need the resistor in the line that is going to light up just 1 LED. In your case this is the lines from the first shift register. That first shift register should have the whole column of LEDs you want to turn on have a ones in the correct place for the pattern.
The other two should have the walking one on them.
We seemed to have switched now to an 8 by 12 array is this new? It never appeared in any of the other requirements.

 
Quote
he only thing is that they have working examples sometimes
I keep telling you that by and large they don't work, that is what leads many beginners astray and make us here pull out hair out. If you insist on looking at instructables then I am afraid I can't help you any more.

Quote
when you use them on your site, it looks very different to how I thought they are used
So your thinking was wrong then.

Quote
do you mean row scanning
No.

Quote
is it my example code
Yes it simply dose nothing very much. Also when posting code use the # icon next to the quote to stop the code being mangled by the forum software.
Logged

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

Quote
f I did put resistors in, should I just need 1 per row/column,
You need the resistor in the line that is going to light up just 1 LED.
Sorry I just switched because I didnt think that it would make much of a difference, I bought a pack of 100 LEDs because they were cheap, so I just thought I may as well use as many as I can. I can use just 8x8 though

Quote
he only thing is that they have working examples sometimes
I keep telling you that by and large they don't work, that is what leads many beginners astray and make us here pull out hair out. If you insist on looking at instructables then I am afraid I can't help you any more.
Sorry, I will stop looking there

Quote
when you use them on your site, it looks very different to how I thought they are used
So your thinking was wrong then.

Quote
do you mean row scanning
No.
My bad, Im still a noob at this smiley-razz

Quote
is it my example code
Yes it simply dose nothing very much. Also when posting code use the # icon next to the quote to stop the code being mangled by the forum software.

In your case this is the lines from the first shift register.That first shift register should have the whole column of LEDs you want to turn on have a ones in the correct place for the pattern.
The other two should have the walking one on them.
We seemed to have switched now to an 8 by 12 array is this new? It never appeared in any of the other requirements.
Sorry bout the code I forgot there was a button for it :3

Im really confused right now,If I want the matrix to turn on simply 1 LED (the bottom left) and keep it on, what do I do, do I make the first shift registers data [1,0,0,0,0,0,0,0], the first column(bottom left is selected) then at the same time have the second 1 in the row have [1,0,0,0,0,0,0,0] as its data, and the last all 0's

Then to make multiple LED's on, say a diagonal line from bottom left to top right, how would that work?
Logged

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

Like I say in my page you have an array containing the bit pattern of what you want to display. Then you have a refresh routine to put that memory onto the LEDs. You seprate the refresh program from what you want to display.
Have a read of that page again.
Logged

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

Like I say in my page you have an array containing the bit pattern of what you want to display. Then you have a refresh routine to put that memory onto the LEDs. You seprate the refresh program from what you want to display.
Have a read of that page again.
I understand what you are saying, but then what would I use to get enough amps flowing per column? Wont the shift register go kaboom if I power more than 1 LED, should I  be using current sources? If I do it this way 160mA can be flowing through each time, can the ULN2803's take that on 1 pin?

Do you mean have it do this (Psuedocode):
Code:
// if this is the byte data: byte displayData [ ] = { B11111111, B10000001, B10111101, B10100101, B10100101, B10111101, B10000001, B11111111 }; //Example taken from your site

loop start(){

if refresh is due then refresh

loop end}

refresh(){

byte tempData;

    for each column do this{
       
        tempData= displayData[columnNumber];
        write latch pin low
        shiftOut(datapin,clockpin,MSBFIRST,tempData);
        write latch pin high

    }

end refresh}

If this makes sense tell me, if not ill write it in arduino code, also FETs are way too expensive! So I wont be using them if I need a current source smiley-razz

Logged

Pages: 1 [2] 3 4   Go Up
Jump to: