Go Down

Topic: flip flop it or 4051 it? (Read 3270 times) previous topic - next topic

Paranemertes

That's great, but don't I need 60 mA for each output? If all three LEDs in one rbg are on? I'm also trying to minimulize the wiring, using the flip flop as a shifter looks like a lot of unnecessary wiring. How about a transistor to drive the LEDs with each pin using the 595?
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

CrossRoads

Each of R,G,B needs its own driver, 20mA for each.  Individually. Otherwise, all 3 are on.
If you wirewrap the board, it will take very little time to wire the 8 signals across the chip for a couple of chips:
http://www.ti.com/product/sn74ac574
Output Drive (mA)    -24/24   
(vs 74HC595   Output Drive (mA)    -4/4)

Connect straight across the 574:
2:19
3:18
4:17
5:16
6:15
7:14
8:13
9:12
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

The '574 is also certainly less wiring than adding a transistor.
Here's the start of what I am envisioning.
'574 shift registers to source current into a column of anodes, and a transistor sinking current from that column (or a row, if you turn the whole thing sideways).
Another set of shift registers controls the transistors. Those can be 74HC595, are not as critical if mated with the right transistor.
Pick an NPN transistor that the shift register can drive into saturation, or use a logic level N-Channel MOSFET.
The OEs don't need to be wired to ground, they can be controlled by an Arduino output as well.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

OHHHH! i get it now, for some reason i had the idea in my head that D0 would be going to Q7, i see what you mean. Whoops, brain fart. forgot that each individual led in the RGB was controlled with an individual pin...

So it will act just like a shift register, like this tutorial?
http://arduino.cc/en/Tutorial/ShiftOut
except in that tutorial it shows the 595 driving leds....hmmmm.

So what does it mean about the OE bringing the chip into a high impedance state? It will still work with that connected to ground?

( nice diagram by the way, your pretty pro.)
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

CrossRoads

"your pretty pro"
Well, yes & no -  you just made me realize that Q1 needs to go to D1, Q1 to D2, Q2, to D2, Q3 to D4, Q4 to D5, Q5 to D6, Q6 to D7, and Q7 to the next chip as drawn.
So not quite straight across the chip, but 1 pin over.
All the Qs go to LEDs.
If the OE is grounded, then you will see some flicker as the data is shifted out.
If you take OE high while the data is shifted in, you will not see that flicker.

The you can write a loop that updates the anodes & cathodes to refresh the display
Code: [Select]

// code for an 24 x 16 array (8 RGB LEDs, 16 columns) as an example
// not all code parts shown, just the highlights
// set up an array for the cathode drives
byte cathodeslower[ ] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20,  0x40, 0x80, 0,0,0,0,0,0,0,0};  // walking 1 for lower 8 NPNs
byte cathodeshigher[ ] = {0,0,0,0,0,0,0,0,0x01, 0x02, 0x04, 0x08, 0x10, 0x20,  0x40, 0x80};  // walking 1 for upper 8 NPNs
byte anodes1 [16]; // array to hold 1st 3rd of RGB info
byte anodes2 [16]; // array to hold 2nd 3rd of RGB info
byte anodes3 [16]; // array to hold 3rd 3rd of RGB info
byte columncount;
byte oe = 2;
unsigned long updateTime=0;

void setup(){
pinMode (oe/, OUTPUT);
digitalWrite (oe/, HIGH);
SPI.begin;
}
void loop(){
// set up for blink without delay operation
if (millis() >=updateTime){
// yes, set up for next update
updateTime = updateTime +2; // update a column every 2 milliseconds, 16 columns at ~24 Hz rate
digitalWrite (oe, HIGH);  // turn off display
SPI.transfer (anodes1[columncount]); // update anodes
SPI.transfer (anodes2[columncount]); // update anodes
SPI.transfer (anodes3[columncount]); // update anodes
SPI.transfer (cathodeslower[columncount]); // turn on a cathode
SPI.transfer (cathodesupper[columncount]); // turn on a cathode
digitalWrite (oe, LOW); / turn display back on
columncount = columncount+1; // update for next column
if (columncount == 16){columncount = 0;} // reset if reach the end
} //end display refresh

// now the fun part, for you!
// read buttons, or whatever processing you plan to do for patterns, etc.,
// and update anodes1, anodes2, anode3 as needed
//
} // end void loop
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

wow your getting way ahead of me, i was going to look into the SPI library for the coding since i have no experience with this when i got to this stage. and hey at least you have the dignity to admit when your wrong and fix it. but moving the connections down one doesnt clutter up the circuit, so im happy. and Im just glad that you actually help, unlike 90% of this forum who just seem interested in being sarcastic snobs.

so how about a 2222 npn for the anodes with a 1k resistor? (I have lots of those on hand)I think i saw somewhere that they can handle an amp? isnt the max we figured out earlier to be 720 mA?
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

Osgeld

#21
Mar 22, 2012, 06:00 am Last Edit: Mar 22, 2012, 06:04 am by Osgeld Reason: 1
2222's your looking at 500-600mA per unit depending on make, 1k on the base works fine, though a bit wasteful if your counting uA

to get things up and working your probably ok
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

CrossRoads

The hardware design really needs to tie in with the software in a case like this.

Look at 2n2222 specs again, I posted it earlier - need a lot of base current to turn them fully on. I don't think thats the right transistor for turning on as many LEDs as you could have on at one time.
1K would limit base current to (5V - 0.7V)/1000 = 4.3mA
You need a lot base current with 2n2222.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

ok i see your point, what do you recommend? I don't have much experience with transistors either, so i don't really know what to look for... :~

hows this for a tentative layout? did i get the 574s hooked up right?
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

CrossRoads

Remove the pin 2 to 19 connections.
Add in 100nF caps on VCC pins to gnd. Got some fast data moving here.
Use these pins for SPI, none of that shiftout nonsense.
13 = sck
11 = mosi
10 = oe
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

ok great, how do any of these look for grounding the columns?
http://www.jameco.com/Jameco/Products/ProdDS/209234FSC.pdf
http://www.jameco.com/Jameco/Products/ProdDS/1560173.pdf
(sorry i dont really know what to look for, just have a general idea)

Quote
or use a logic level N-Channel MOSFET

what do you recomend?
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

CrossRoads

1st one:
rDS(ON)= 0.540 ?

2nd one:
rDS(ON)= 1.5 ?

1st one would be better.
However,
Drain to Source On Resistance (Note 2) Rds (ON), VGS= 10V, ID= 3.4A  Need a Logc Level part that switche full on at <5V.

I'd recommend something like this
http://search.digikey.com/us/en/products/NTD5867NL-1G/NTD5867NL-1GOS-ND/2401422
Lower Rds, Logic Level Gate voltage.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

very sorry for the delay in the reply, at a school tech competition.
That looks great, im working on a final prototype, do i hook up the MOSFETs the same as i would an npn transistor? not quite sure. Is there anything else i should take into account in my final design? Thanks.
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

CrossRoads

hookup mosfets the same way - 100 ohm resistor between arduino pin & gate, 10K resistor from gate to ground to ensure mosfet is off when arduino powers up.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Paranemertes

ok so i have a final version of the board. i attached a photo of the breadboard view and pcb view. What did i miss? what needs to be changed? I also included the file if you have fritzing, i dont think those pics are very good.

Also if everything is good what is a cheap alternative to fritzings fab service? I think this board would cost something like 200 bucks, which i dont have. Ive looked at your Bobuino, what did you use? thanks.
"It's Dr. Evil. I didn't spend six years in Evil Medical School to be called 'mister,' thank you very much."

Go Up