Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: nadav on Oct 12, 2012, 07:30 pm

Title: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 07:30 pm
Hey guys,
Im working on a project thats supposed to be ultra slim (about 3mm total). I'm looking for an 8x8 LED driver (or really any way to drive 64 LEDs) but in a package thats about 1mm thin, really anything thinner then 1.6mm.
So far, I've looked at the MAX72xx series and a few others, but they are to big. I've also looked at the AS1116 LED drivers from AMS, but I have no idea how I would get it up and running with the Arduino.

Any suggestions would be of great help.

Cheers,
Nadav
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 08:16 pm

Hey guys,
Im working on a project thats supposed to be ultra slim (about 3mm total). I'm looking for an 8x8 LED driver (or really any way to drive 64 LEDs) but in a package thats about 1mm thin, really anything thinner then 1.6mm.
So far, I've looked at the MAX72xx series and a few others, but they are to big. I've also looked at the AS1116 LED drivers from AMS, but I have no idea how I would get it up and running with the Arduino.

Any suggestions would be of great help.


What are you going to fix it to? A PCB is thicker than that...

Is an external chip needed? You can do multiplexing with the Arduino, it just takes more programming effort.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 08:19 pm


What are you going to fix it to? A PCB is thicker than that...

Is an external chip needed? You can do multiplexing with the Arduino, it just takes more programming effort.



Its actually going to soldered onto a 0.8mm PCB.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 08:28 pm
Also, an external chip would be ideal, since I would like to use as little as possible of the Arduino's pins...
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 08:33 pm



What are you going to fix it to? A PCB is thicker than that...

Is an external chip needed? You can do multiplexing with the Arduino, it just takes more programming effort.



Its actually going to soldered onto a 0.8mm PCB.


The chip package is mostly plastic. If you splay the legs out you can probably grind it down very thin by rubbing it on sandpaper. It won't be easy, you'll probably wreck a few while you're finding the limits...but it could work.

Where does the Arduino go? The AVR chip is bigger than the MAX7219. Can't you put it in the same place?


Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 08:35 pm




What are you going to fix it to? A PCB is thicker than that...

Is an external chip needed? You can do multiplexing with the Arduino, it just takes more programming effort.



Its actually going to soldered onto a 0.8mm PCB.


The chip package is mostly plastic. If you splay the legs out you can probably grind it down very thin by rubbing it on sandpaper. It won't be easy, you'll probably wreck a few while you're finding the limits...but it could work.

...or you could use the Arduino to do the multiplexing.




Thats actually just got me thinking, I may just use a second atmega in a qfn package as the driver, and use the first (main) arduino to send serial commands to the second...
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 08:43 pm

Thats actually just got me thinking, I may just use a second atmega in a qfn package as the driver, and use the first (main) arduino to send serial commands to the second...


If you're making your own PCB and can use qfn parts then that'll work.

You might even be able to use a cheap atmega (less memory, etc) which costs less than the MAX7219 (not difficult, given Maxim pricing).
Title: Re: Small 8x8 matrix driver?
Post by: JoeN on Oct 12, 2012, 08:47 pm
http://www.digikey.com/product-detail/en/MAX6960ATH%2B/MAX6960ATH%2B-ND/1512066
http://datasheets.maximintegrated.com/en/ds/MAX6960-MAX6963.pdf
http://pdfserv.maximintegrated.com/package_dwgs/21-0144.PDF

TQFN 0.8mm thickness - drives 1 or 2 8x8 matrices.  This part is available to sample.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 12, 2012, 08:49 pm
The surface plastic bodies are 1.2m ('328) to 2.5mm (MAX7219) thick.
You could always put a hole in the board and mount the parts(s) upside down in the hole; the top of the part would be seen from the bottom of the board, and the Tops of the legs would be soldered to the top of the board. (vs the bottom of the legs)
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 08:53 pm
Thats right, I forgot to mention that I will be having the pcbs made. So all of the parts will be fine pitch surface mount parts.
And yeah very true, do you have any recommendations on a specific atmega? Also, im thinking ill adapt the http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix (http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix) code, but do you have any ideas on how I would do the communication?

@JoeN: As for the MAX6955, I feel like it would be more effort then its worth to make a whole new library, though i'm still definitely considering it, thanks! Also the cost of the MAX6955, is quite a bit higher then that of an atmega...

@CrossRoads: I would do that, but the entire project is going to be about the size (though thicker) of a credit card. So I don't want to have holes milled into the pcb, since im essentially cutting into the "front panel" of the board.

Title: Re: Small 8x8 matrix driver?
Post by: JoeN on Oct 12, 2012, 08:55 pm

@JoeN: As for the MAX6955, I feel like it would be more effort then its worth to make a whole new library, though i'm still definitely considering it, thanks!


Who needs a library when you can just bitbang the bits that the chip wants at it?  That is what I did when I wanted to figure out how the MAX7219 worked.  Read the datasheet and you will find that the bits you have to send at these chips are simpler than you would expect.  They are just ones and zeros.  I thought every idiot could count to one, someone told me that once I forget the dude's name.

SAMPLE THE PART.  You can get two.  I know this for a fact.  If you don't end up using it, ...?

Hell, I'd send you one of mine, but I got them in SSOP package.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 09:00 pm


@JoeN: As for the MAX6955, I feel like it would be more effort then its worth to make a whole new library, though i'm still definitely considering it, thanks!


Who needs a library when you can just bitbang the bits that the chip wants at it?  That is what I did when I wanted to figure out how the MAX7219 worked.  Read the datasheet and you will find that the bits you have to send at these chips are simpler than you would expect.

SAMPLE THE PART.  You can get two.  I know this for a fact.  If you don't end up using it, ...?

Ill for sure sample it, nothing to loose there. Though i'm more of a hardware guy, so it still seems like quite a bit of effort for something that costs over twice that of the atmega.
Title: Re: Small 8x8 matrix driver?
Post by: JoeN on Oct 12, 2012, 09:03 pm
What quantity are you going to produce this in?  I guess we didn't ask that and it matters if it is going to be made in quantity.  You are right, that is an expensive chip, really more expensive than justified considering what you can get those old 7219s for.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 12, 2012, 09:05 pm
You could use a '168P, need 16 lines to the matrix and 2 lines for serial comms.
Make 8 bytes to represent the 8 columns of LEDs, 1 bit each row.
For each column, drive the anode, sink the cathode of the LED in that row if it is to be on.
Unsink the cathode, hit the next part.
In between columns, check for serial data coming in, update the bytes as needed and keep on going.
MAX7219 refreshes at 800 Hz.
If you leave each LED on for 500uS *  64 LEDs = 0.032mS, or 31.25 Hz refresh rate.

Better way would be to add part like ULN2803 (or transistors) and drive a while column at a time, bumps up the refresh rate a lot.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 09:11 pm
@JoeN: I'm probably going to have them made in batches of about 50 to 100, still a bit early to know for sure.

@CrossRoads: Thanks! That seems perfectly logical. Im still pretty new when it comes to serial, but I was thinking it would be better to send a whole frame to the second atmega, and have it display it till a new frame comes in.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 12, 2012, 09:32 pm
You could do that, only need 8  bytes, maybe a starting sync byte, ignore all messages until the synyc byte comes in.
Or a sync message every 10 frames or something similar.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 09:36 pm
Yep something like that, though im still not totally sure exactly how im going to go about it. Like I said, i'm not much of a software guy... Though I think I would need the end product to be something like this https://www.sparkfun.com/products/759 (https://www.sparkfun.com/products/759) (only much smaller).
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 09:47 pm

but do you have any ideas on how I would do the communication?


Depends on the speed you need.

Both will have serial ports (easy, but slow). Both will have SPI (a bit harder but fast).

Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 09:49 pm
I'd probably need SPI, though how slow is slow if I wanted to go the serial port route? Also the main atmega, would run at 8MHZ so it wont be super speedy anyways...
Title: Re: Small 8x8 matrix driver?
Post by: dhenry on Oct 12, 2012, 09:54 pm
Any smd avr with sufficient number of pins will do.
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 09:56 pm

I'd probably need SPI, though how slow is slow if I wanted to go the serial port route? Also the main atmega, would run at 8MHZ so it wont be super speedy anyways...


It's not really about "fast" or "slow", it's whether it's fast enough for your needs.

First you have to figure out how much data you need to send...

Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 10:00 pm
Well I figure since its an 8x8 matrix, I would need to transmit 64bit strings of data at a time (maybe a few extra bits to signal a new frame is coming in or things like that)
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 12, 2012, 10:01 pm
30 frames/second * 64 bytes/frame * 11 bits/byte = 21,129 bits per second.
Go to 90 frames/second (for "overhead") = 63K bits/second
Serial will not be a problem. Use 115,200 if you are concerned.
2 MBit/second SPI is not needed.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 10:07 pm
Sweet! That actually makes perfect sense. Now as to how I would do that, would I just do a Serial.write on one end and a Serial.read on the other? and when setting it up I would set Serial.begin to 115200?
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 12, 2012, 10:15 pm
Ok, The McGyver in me just had to know if you can really sand down a chip to that sort of thickness.

So I grabbed a dead MZX7219 and some sand paper, and... yes you can!

I easily got it under 2mm thick (actually 1.85mm) without exposing any silicon. With a 0.8mm PCB that meets your "under 3mm" goal.

(http://www.artlum.com/pub/thin7219.jpg)

(http://www.artlum.com/pub/bfaf.jpg)

It's probably not a good way to do it if you want to make a lot of them, but it can be done. :-)

Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 10:20 pm
Sweet, its good to know that I can be done! But i'm going to go with the atmega method. Since it is meant to be a production thing (hopefully). And im actually doing a layered pcb assembly à la EEV Blog so its going to be two .8mm pcbs, with a 1.6mm pcb core. The core will have all the places for the ICs and other parts milled out. And the Top and bottom will make it look good, also all of the parts will be on the top pcb. Then ill stick them all together with double sided tape (2mm around the perimeter of the board).http://www.youtube.com/watch?v=fk8GCKO5mw4 (http://www.youtube.com/watch?v=fk8GCKO5mw4)
Title: Re: Small 8x8 matrix driver?
Post by: JoeN on Oct 12, 2012, 10:39 pm

@JoeN: I'm probably going to have them made in batches of about 50 to 100, still a bit early to know for sure.


Yeah, I wouldn't use that circuit either then.  That is going to raise the cost quite a bit.  I think about this stuff from a hobbiest point of view that I can get 4 or 6 of anything as samples and if I need to buy a few more that isn't going to break the bank - all because I make these things quantity 1 or 2.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 12, 2012, 10:45 pm
Exactly, with the atmega, I can get the for about $3 from digikey, so its really great.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 12:43 am
Yup
$2.43
http://www.digikey.com/product-detail/en/ATMEGA168A-AU/ATMEGA168A-AU-ND/2271188
Same at mouser
http://www.mouser.com/ProductDetail/Atmel/ATMEGA168A-AU/?qs=sGAEpiMZZMvqv2n3s2xjse40PngS4U1xVADwi5G8n9Y%3d
Title: Re: Small 8x8 matrix driver?
Post by: JoeN on Oct 13, 2012, 09:42 am

Yup
$2.43
http://www.digikey.com/product-detail/en/ATMEGA168A-AU/ATMEGA168A-AU-ND/2271188
Same at mouser
http://www.mouser.com/ProductDetail/Atmel/ATMEGA168A-AU/?qs=sGAEpiMZZMvqv2n3s2xjse40PngS4U1xVADwi5G8n9Y%3d


$1.36 in the quantities he is talking about if this makes it to production.  Atmel prices their product pretty darn reasonable if you ask me.
Title: Re: Small 8x8 matrix driver?
Post by: fungus on Oct 13, 2012, 04:01 pm

$1.36 in the quantities he is talking about if this makes it to production.  Atmel prices their product pretty darn reasonable if you ask me.


Yep. The ATmega is probably cheaper then the MAX7219.

I bought a dozen ATtiny84s from Farnell las week for 94 cents each (Eurocents). They want 10 Euros for a single MAX7219.

Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 05:10 pm
Yep you really cant compare the two in terms of price. If/when I do finish the project, ill be sure to post the code so everyone else can take advantage of the cheaper driver.
Title: Re: Small 8x8 matrix driver?
Post by: dhenry on Oct 13, 2012, 06:09 pm
The whole concept of buying max72xx now makes zero sense to me.

Those guys go out of the market for a (very good) reason.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 06:23 pm

The whole concept of buying max72xx now makes zero sense to me.

Those guys go out of the market for a (very good) reason.


Well there is an advantage to it, especially in very large quantities, and thats the fact that you don't have to program an extra MCU. But yes, cost (and possibly even feature wise) the atmega is the clear way to go.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 07:14 pm
Not so clear - say your application called for DIPs instead of surface mount.
taydaelectronics.com has MAX7219 in DIP for $1.25.  I just bought 8, shipping was $1.80. Order also included 20 panel mount power jacks, 4 toggle switches, and a mess of resistors.

vs $2.78 (qty 25) for lowest priced 168 in DIP
http://www.mouser.com/ProductDetail/Atmel/ATmega168-20PU/?qs=sGAEpiMZZMtkfMPOFRTOl51o10QgrNfF
and $1.59 at digikey
http://www.digikey.com/product-detail/en/ATMEGA168A-PU/ATMEGA168A-PU-ND/2271215
both charge something like $6.95 for lowest priced shipping.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 07:19 pm
Hmm...good point, though I don't know how reliable they would be in orders of 100. Then again, they might be great. It's too bad they didn't make one of the MAX72xx's in a smaller package...
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 07:24 pm
It is available on 24-pin wide SO surface mount package - its just a little thicker than you wanted.

Or as bare die if you wanted it really thin.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 07:26 pm

It is available on 24-pin wide SO surface mount package - its just a little thicker than you wanted.

Or as bare die if you wanted it really thin.

A bare die would be great, though how would I go about soldering that (or having it soldered for me) in a cost effective and simple way?

Edit: I just did some googling, and it I think the bare die would be overkill for this little production run.
Title: Re: Small 8x8 matrix driver?
Post by: dhenry on Oct 13, 2012, 07:36 pm
Quote
It's too bad they didn't make one of the MAX72xx's in a smaller package...


I wonder why that's the case, ...
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 07:39 pm
Another advantage might be interface speed.
MAX7219/7221 can receive data at 10 MHz.  I use  mine at default SPI settings which I think is 4 MHz.
If your main processor was really tied up and you wanted to send stuff out at 8 MHz to get it out of the way quick. The master can do that, I think testing has has shown a 168/328 cannot receive that fast tho due to the slave having to sample (the CS pin?) or something along those lines.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 07:43 pm

Another advantage might be interface speed.
MAX7219/7221 can receive data at 10 MHz.  I use  mine at default SPI settings which I think is 4 MHz.
If your main processor was really tied up and you wanted to send stuff out at 8 MHz to get it out of the way quick. The master can do that, I think testing has has shown a 168/328 cannot receive that fast tho due to the slave having to sample (the CS pin?) or something along those lines.

Yeah, ideally that would be the way to go. But size and cost are really the most limiting factor.
Title: Re: Small 8x8 matrix driver?
Post by: dhenry on Oct 13, 2012, 07:49 pm
Quote
a 168/328 cannot receive that fast tho due to the slave having to sample (the CS pin?)


True, when implemented poorly.
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 07:55 pm
Quote
True, when implemented poorly."


False - max speed is a hardware function, not something  users have any implementation control over:

"In SPI Slave mode, the control logic will sample the incoming signal of the SCK pin. To ensure correct sampling of
the clock signal, the minimum low and high periods should be:
Low periods: Longer than 2 CPU clock cycles.
High periods: Longer than 2 CPU clock cycles."
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 08:00 pm
Still though, shouldn't 115200 baud serial be fast enough for this application?
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 13, 2012, 08:12 pm
Yes.  The above was only discussing reasons why the ATmega is not always the clear way to go.
In this case, your need for overall thinness, similar cost, and no need for ultimate in interface speed indicates the Atmega is the way to go, as long as your time to develop the max7219 function is not factored in.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 13, 2012, 08:42 pm
Gotcha. And yeah i'm still unsure 100% of how im going to go about implementing it...
Title: Re: Small 8x8 matrix driver?
Post by: dhenry on Oct 13, 2012, 09:55 pm
A max7219 clone is fairly simple. You need to implement two basic elements:

1) a display routine that is called from a timer isr to update the matrix in the background;
2) an interrupt based spi slave.

The two pieces are integrated in the main loop where the incoming data (common + data bytes) are processed.

The beauty of this approach is that the execution in the main loop is non-critical and support the full capabilities of the spi hardware.

Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 14, 2012, 01:53 am
Thanks everyone for your responses, but in the end I will be changing the design around a little so that I can have slightly thicker parts and will be using the AS1130.

Cheers,
Nadav
Title: Re: Small 8x8 matrix driver?
Post by: CrossRoads on Oct 14, 2012, 02:07 am
That part drives nothing at all like an 8x8 matrix.
That part is also thicker than you said your requirement was.

What a waste of time.
Title: Re: Small 8x8 matrix driver?
Post by: nadav on Oct 14, 2012, 03:34 am

That part drives nothing at all like an 8x8 matrix.
That part is also thicker than you said your requirement was.

What a waste of time.

No in fact it is thinner then the MAX7219, the SOIC package is only 2mm thick.
Also, I appreciate your answers but no one forces you to answer questions, if you feel its a waste of time, then you shouldn't do it.  No one needs to hear about how you think you've wasted your time on this.