Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
mondalaci
PostPosted: Mar 18, 2012 - 09:40 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

Freaks,

I'd like to create a 8x8 LED matrix using the smallest number of pins of my AVR. It'd be great to use two shift registers, one for rows and one for columns but it doesn't seem possible because according to my understanding shift registers can only source current, they cannot sink current.

How is this possible? I'm open to alternative solutions as long as the pin count stays as low as possible.

Thanks in advance.

Laci
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 18, 2012 - 10:00 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

The 74HC595 and others can both source and sink 25mA current. Some shift registers can do larger currents.

Use SPI to drive them. Use a separate /CS for each chip.

If you end up with 256 x 8 matrix or bigger, you can use daisy chained shift registers to drive the columns. You will need high current drivers for the rows.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
thavinator
PostPosted: Mar 18, 2012 - 10:04 PM
Hangaround


Joined: Jun 08, 2011
Posts: 301
Location: Maryland, USA

Depends on your shift registers and what sort of current you need for the LEDs. Vanilla logic shift registers will source or sink a small amount of current, there are also a number of power shift registers with integrated low side drivers, not sure about options for high side power shift registers. At least one of your shift registers must be capable of driving 8 LEDs at once.
 
 View user's profile Send private message  
Reply with quote Back to top
mondalaci
PostPosted: Mar 18, 2012 - 10:05 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

Thanks a lot, David!

I'm wondering why couldn't I see any projects featuring such a configuration. I could only see shift registers being used either for rows or for columns but not for both. Nobody wants to save pins?!

By high current drivers you mean a darlington array, for example?

Laci
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 19, 2012 - 07:37 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

For the reason that I gave you. Who wants an 8 x 8 matrix?

For a big array of 7-segments or LED 8x8 matrix displays, you are either going to multiplex or have a large number of shift registers.
You end up with largish currents on the common pins. Hence ULN2803 or similar.

Personally, I would multiplex and put up with the high-current drivers.
A single 8x8 can probably be driven directly by shift registers.

Think about it. Your shift registers involve two 595s and 4 MCU lines to control them. Buying an MCU with more pins could do everything with one chip.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
mondalaci
PostPosted: Mar 19, 2012 - 11:00 AM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

I'm in a situation where I have 4 MCU lines to drive the shift registers but not much more. Because of this it costs me less to go with my proposed solution rather than upgrading my MCU to have more pins.

Should the scenario below work?

* Using a 74HC595 for the 8 rows.
* Using a 74HC595 and a ULN2803 for the 8 columns.

The two 74HC595 is supposed to be daisy-chained therefore only having to use 4 MCU lines.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 19, 2012 - 11:31 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

Yes. You can actually daisy-chain both 595s and only use SS, SCK, MOSI. As you are multiplexing, you are presenting each pattern of 16 bits every period. 8 bits hold the rows, 8 bits hold the single column you are lighting.

If you were doing a 256x8 display, you probably use two chip-selects. For 8x8 there is little point.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
mondalaci
PostPosted: Mar 19, 2012 - 12:02 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

What I still don't understand is how can I make either of the 595s *source* current and the other *sink* current. I thought that 595s can only source current.

Laci
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 19, 2012 - 12:19 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

Read your data sheet. All chips can sink current. If they have totem-pole outputs they can source current too.

If you have sink-only devices like an 8051, you connect the row cathodes to the 8051. The common-anodes are connected to PNP column drivers.

AVRs or 595s can sink and source.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Chris-Mouse
PostPosted: Mar 19, 2012 - 02:23 PM
Hangaround


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada

Use a pair of cascaded shift registers to drive everything off one set of pins. Shift out the column data, then the row data, and finally send the latch pulse. Total, three pins. ( data, clock, and latch)

You could use a pair of 74HC595 shift registers, and connect the outputs of the shift registers to driver ICs to power the display. I'd suggest ULN2803 for the column drivers, and TD62783A for the row drivers. Both are available from DigiKey.
If you want to reduce the number of chips a bit, replace the ULN2803 and one of the 74HC595 ICs with one TPIC6B595 IC, also available from DigiKey
 
 View user's profile Send private message  
Reply with quote Back to top
mondalaci
PostPosted: Mar 19, 2012 - 08:43 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

David,

Thanks a lot for your explanation! Being a newbie to electronics I have to look up some of the concepts that you mentioned but I'm starting to see the light at the end of the tunnel.

Chris,

I've been browsing on Digi-Key and these are the actual component prices for 100 PCS:

74HC595 - $0.3
ULN2803 - $0.3
TPIC6B595 - $1.056
TD62783A - $1.53

Looks like the TPIC6B595 doesn't provide a good value in this scenario. (I know that pick and placing extra components cost money too but not that much.)

Is the TD62783A necessary for this circuit to work? If so, does it have a cheaper alternative by any chance?

Thanks a lot!

Laci
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Chris-Mouse
PostPosted: Mar 20, 2012 - 08:50 PM
Hangaround


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada

The TPIC6B595 would only be useful if you needed to reduce the size of the board, other than that, it is more expensive than separate chips.
I don't know of any other source driver than the TD62783A, but then I haven't looked all that hard either. If your LED supply voltage is 5v, you might be able to make a cheaper system using the 74HC595 to drive eight P type mosfets for the row driver. If you're using more than 5V for the LED voltage, then you'd have to use something as a high voltage buffer between the mosfets and the 74HC595.
 
 View user's profile Send private message  
Reply with quote Back to top
bluegoo
PostPosted: Mar 20, 2012 - 09:26 PM
Posting Freak


Joined: Aug 20, 2005
Posts: 1109
Location: Pool of Goo

or use ONE MAX7219 chip to do a 3 wire interface or a MAX7221 for the 4 wire SPI thing including the led display update
MAX7219
http://www.maxim-ic.com/datasheet/index.mvp/id/1339

The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors (µPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8x8 static RAM that stores each digit. Only one external resistor is required to set the segment current for all LEDs. The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and has slew-rate-limited segment drivers to reduce EMI.

MAX7219 <$1 on Ebay from lots of vendors
 
 View user's profile Send private message  
Reply with quote Back to top
mondalaci
PostPosted: Mar 20, 2012 - 11:24 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

Chris,

My LED supply voltage is 5V because my device is a USB peripheral and I use USB voltage. It also means that 100mA is the maximum current that I can surely source from the host. That makes me think about whether I really need any drivers.

100mA / 8 LEDs = 12.5mA per LED maximum. I've been browsing the data sheet of the 74HC595 and the maximum current rating is 20mA which is surely more than 12mA. I don't know whether this 20mA pertains to the device or per pin but in the former case would it even be necessary to use any drivers?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
mondalaci
PostPosted: Mar 20, 2012 - 11:32 PM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

bluegoo,

I'm in love with the idea of being able to use a single cheap IC to get the job done, but after taking a look at the product page of the MAX7221 on Digi-Key I'm wondering if you saw some Chinese knock off on eBay.

http://search.digikey.com/us/en/product ... -ND/948194

This baby costs more than 6 bucks per device for 100 PCS. Maybe it's created from pure gold, although its color suggests otherwise. Smile

(Only SPI can play in my situation.)
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 21, 2012 - 07:35 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

I use SPI to control a MAX7219. It behaves similarly to a 595 interface.

You won't go too far wrong with this SOIC-24 or DIP-24 from Ebay. Buy them with PayPal. I see no great problem with buying 'cheap' offers from China. I would not give them a credit card number though!

Note that a MAX7219 can drive some pretty high currents. Start it up with a low brightness.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
mondalaci
PostPosted: Mar 21, 2012 - 10:07 AM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

David,

There's no way I'll buy any parts from China ever again if not necessary because I don't like being spammed on a regular basis.

Octopart suggests that this IC is fairly expensive from more legit sources:

http://octopart.com/partsearch#search/r ... ;q=MAX7219
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
jan_dc
PostPosted: Mar 21, 2012 - 10:36 AM
Hangaround


Joined: Feb 09, 2011
Posts: 323
Location: Turnhout, Belgium

Having an 8x8 matrix with led's I would use NPN and PNP transistors as a (power) switch for the matrix. That way you don't need to worry about sink and source current of your shift registers.

An alternative might be using PNP transistors to source current to a line of LED's and use TPIC6C595 as drain. The TPIC6C595 can also drive the PNP transistors via a resistor.

 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
mondalaci
PostPosted: Mar 21, 2012 - 11:10 AM
Hangaround


Joined: Dec 05, 2008
Posts: 179
Location: Hungary

Jan,

Thank you very much for the schematic, I owe you one!

I have some questions:

1) Are there any NPN / PNP SMD tansistor arrays available for this purpose?

2) Is it necessary to use one resistor per LED? I'd like to minimize the number of components.

3) Isn't it feasible to only use resistors to rows or columns but not for both?

4) I'm assuming that the 74LS595N part is functionally equivalent to the 74HC595. Correct?

5) Shouldn't the 75HC595 be able to drive 12.5mA loads per pin without any drivers / transistors?

Thank you!
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Mar 21, 2012 - 11:20 AM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

mondalaci wrote:
David,

There's no way I'll buy any parts from China ever again if not necessary because I don't like being spammed on a regular basis.


Perhaps you have had a bad experience.

I can see little harm in trying 10 chips first. I would not place an order for 1000!

Cheap offers can occur quite legitimately. e.g. bankrupt stock, over order etc.

I agree that the price is very 'attractive'. I presume that Maxim-Dallas would not let a sub-standard batch onto the market.

So you either get full-spec or complete fake.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits