Pages: [1] 2   Go Down
Author Topic: MAX7221 Led driver discussion (again)  (Read 3921 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know this has been posted and there are tuts.. (which I have read/followed a bit), so i wanted to preface that I have read and searched a little bit.. just unclear on certain things. =)

I got my MAX7221 Led driver chip (samples) from Maxim the other day....

I got this chip/sample because it touted being able to control/address 64 individual leds as any given time. (awesome.. sounds perfect)

I also see it says it can be used to control 8 x 7-segment leds.....or 'matrix' set-ups.

space is a HUGE concern for this potential project/application.. as I am trying to shove the minimal Arduino clone/brain into a pre-existing toy.... with 1 (maybe 2) led STRINGS to be controlled/animated.

so less components the better.. so far, minimal Arduino footprint..and 1 (maybe 2) MAX7221 chips.. and my led strings.



questions:

1.) Since this is to be an led 'string'....  how does one wire this up?  Do I still follow the 'matrix' type schematics/wiring guides?  Since I still need each LED to be individually controlled/addressable?   If not a MATRIX wireing guide..then what do I use for an LED string..that needs individually controlled leds still?   (and keeping this in a strin layout but using a matrix wring is gonna be tough...no?)

2.) that being said above... are there any led STRIPS (not cubes..etc) that are very close together in spacing? pre-configured/wired to be addressable in a matrix/MAX7221 chip protocol.... in a retail format? (ie: store bought?)

3.) I always get confused on this aspect of project.. but properly driving them correctly?  Im assuming the Arduino will NOT be used in powering any of the LEDS.. as there is so many.. and there is NO telling what pattern or animation might be running (and hence how many or if all leds might be on) at the same time..  So how does one properly 'power' each led?  if say using blue/green accent leds with 3.3v @ 20mA?

20mA x 64 leds = 1280mA (close to 1.3A)
if I add/need another MAX7221 chip for an additional 64 addressable led strip..then thats another 1280mA needed....no?



Without throwing out a chip name/number or a general/vague description..  how do I over come these everyday concerns?

Thanks

Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1. You have to follow the matrix setup. How you arrange the LEDs on the ends of wires after making the matrix connection is up to you.
2. There are lots of LED strips that you can send commands down the line to.  "Close together" is your call.
3. MAX7221 takes care of driving the LEDs, you only supply 5V to it.  You are only writing data into a register that represents the 8 LEDs.  There are some equations in the data sheet that tell you how much power the MAX7221 will  drawing.

You are going into it too much.Select Iset resistor for a lower current per LED, if not bright enough with intensity set at Full, then raise it up some.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.) Thank you... I always get confused when I read 'matrix'..   smiley-razz

2.) Is there a specific search term I can use to find these 'commandable' led STRIPS at/under?

3.) I saw you give the MAX7221 chip +5v... and you also use an rSet/iSet resistor to set the upper limit of the led threshold..

but am missing the connection how this works.. vs something like where the Arduino can only give xxmA per pin.. and other do the same.. or even tieing them together only gives you xxxmA output..

Ive read/seen it enough to understand I need to at least ask or address this to try and understand before I get too far in and be SOL!  =)

so no matter 1 led or all 64 (or even 128) leds are 'on'...  theres no problem?


I think maybe you mean this chart in the datasheet?

Table 11. RSET vs. Segment Current and
LED Forward Voltage
vLed(v)
Iseg(mA)1.52.02.53.03.5
4012.211.811.010.69.69
3017.817.115.815.014.0
2029.828.025.924.522.6
1066.763.759.355.451.2

but I read this... what is defined as a 'segment'  (8 leds?)

The
MAX7219/MAX7221’s maximum recommended segment
current is 40mA. For segment current levels
above these levels, external digit drivers will be needed.

so only 5mA form the MAX7221 chip to each led? (if I had all on?)


Your probably right I am going 'too much' into it.. just trying to understand and learn is all..  (little by little)

thanks
Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Iseg is the 10,20,30,40 in left hand column.
The blue across the top is the voltage drop across the LED when it is on.

You set the current to any LED/Segment with 1 resistor, the MAX7221 then controls the current. Multiplexing occurs at ~800 Hz.

LED strips at Spark fun.
http://www.sparkfun.com/search/results?term=led+strip&what=products
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok... sorry (bear with me)..  Im trying to digest this. smiley-cry


I see the columsn names..not sure what its calculating or what I do with the results/number. (is this just get the resistor value? to use on ISET?)


ISET.. I undestand is the resistor I use to 'cap' the mA I want to give any 'single' led at any giving time.

In this case..20mA is the cap any LED would normally get and probably my target mA as well.


Im not sure about the blue.. vLED.. (Ive seen vF but not vLed before)..  but you mention/state its the voltage after the 'drop' when the led is lit.

a 'segment' = only 1 individual led.. (not a 'segment' of 8 leds)...

Im still missing the bridge on how it works when ALL leds need to be on.. 

(it only has 1 led on at at time..but does it so fast they all look lit?)



I think I'll stop here.. LOL  (before I get more confused)..



Thanks for the link to Sparkfun...  (the RGB strip is a nice idea too!)  I think Im in need of something smaller in length.. and more leds!

I'll have to check some of the retail conversion kits I have seen that I sorta mirroring to check the size of leds and number.

thanks
Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"ISET.. I undestand is the resistor I use to 'cap' the mA I want to give any 'single' led at any giving time." 

Yes.


"Im still missing the bridge on how it works when ALL leds need to be on.. 

(it only has 1 led on at at time..but does it so fast they all look lit?)"

Yes.  Switching is done at 800 Hz.  I have 64 "segments" here (bot more than 64 LEDs, as I have 3 LEDs/segment for the digits and 2 LEDs for the decimal points, which are spread around the display.

Haven't figured out a camera setting to get a good picture tho.


* display_pic3.jpg (179.74 KB, 912x684 - viewed 23 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much..

It wasnt quite clicking (until now).. about how multi-plexing really works to drive ALL leds at the same time.

(switching @ 800mz comment makes sense now)


so it can turn on/off 64 'segments'...  and what you declare/use as a segment is user defined.. (as long as it falls under the juice/threshold the chip can give/drive to any 1 'segment'...)


I am not currently doing this..  but what if your matrix had different colors?

or what if you were using an RGB strip?  how do you account for leds that would possibly have different vF?


(now I just need to either find a nice, smaller strip (like 6-10 in.) in length with many leds in that smaller length.)

or figure out some way to make it myself..and align them in a strip as I need.


Thanks!



(ps.  I never heard back from you after my last pm?)



Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Different colors - same current is applied to all.  I think mine are red, yellow, and orange actually.

last PM?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah discussing that freelance project....

(I think its still on my sentbox)

Sent to: CrossRoads on: November 07, 2011, 09:46:46 PM »

in reply to your:

Quote from: CrossRoads on November 07, 2011, 09:02:31 PM
"a package around 0.8-0.9 x 1.75-2.0 max"
Inches? cm? feet/yards smiley-mr-green




I can re-send if need be.  smiley-grin

Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No need, I looked, I still have the series of messages, I must have read them at work and couldn't see the pictures.

Let me review, you have a bunch of parts, need to look up the datasheets & understand what all needs to get connected.
I don't think it will be a problem doing it.
Eagle symbol availabilty needs to be looked at also.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok.. (back on this topic for me)  =)

I have my free samples from Maxim MAX7221 chip..

I do NOT want a 'cube' layout of my leds.. but more of an addressable LED strip..  (I think thats correct terminology?..yes?)

I think I originally had the 'orders' of leds wrong.. (meaning each 'section' of '8' leds went (from bottom to top) 8, 7, 6, 5, 4, 3, 2, 1...etc)

I switched just befor eposting this..  (thinking it was wrong) and needed each one to go from 1-8 in that order..

but I havent begun to mess with the software or any libraries for this..etc, so Im not clear/cure if there is a preferred order that helps when using the libraries/classes?

I 'think' Im only going to be using 4 sections of 8 leds (4x8 matrix?)

anyways here are both versions.. is there a preferred way to wire that may make it easier to follow/understand when doing shitOut() function/calls?..etc?

sorry for the long images..want to sketch it out in my head for the led strip visual.

Also I saw shiftPWM().. can this be used as well? instead of just plain shiftOut() off/on type?  (thinking a smoother larson scanner effect..etc) thanks



Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

With the MAX7221, you use SPI.transfer to write to each register that represents 8 LEDs.

There a couple of registers to write to start up - scan limit (how many digits), intensity (brightness), mode of operation.

// addresses for the MAX7221, and the values/ranges to write in

#define DECODE_MODE 0x09 // write data 0xFF, Code B Decode for all digits
#define INTENSITY_ADDRESS 0x0A // 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
#define SCANLIMIT_ADDRESS 0x0B // 0xFF, all 8 digits on
#define SHUTDOWN_ADDRESS 0x0C  // 0x01, normal operation (0x01 = shutdown) - powers up in shutdown mode
#define DISPLAYTEST_ADDRESS 0x0F // 0x01 = all lights on full, 0x00 = normal ops

Do 2 SPI.transfer's with register address and the data you want.

Heres the transfer for one of the 8 display registers.

  digitalWrite(SS,LOW);  // take the SS pin low to select the chip
  SPI.transfer(minutes_tens_address);  // select the Address, (I had 8 digits,wrote to them all like this
  SPI.transfer(number_to_display);      // select the data
  digitalWrite(SS,HIGH);   // take the SS pin high to de-select the chip

Don't need any library for this.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yikes!..

lol..  thats alot to digest (never played with SPI interface before... not the MAX7221 driver chip)..

I am still working on the physical/wiring of it all (in my head)..

so I can understand how to get it working with an led type layout for the matrix wiring..

is there a difference or benefit between the two diagram proposed?

And also 'are there' any libraries made for the MAX7221 chip for easy interfacing? (methods/functions to use) just curious.


I'll take a look at the code samples you provided when I get the actual code/testing part.

thanks
Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23596
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Time to buckle down then dude!
Your other project also requires SPI, for the uSD and for the DAC.
For the uSD, get familiar with fat16lib's SD library.
http://code.google.com/p/sdfatlib/
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

LOL....  

Im trying! smiley   Its alot to take in all at once. And lots going on!   smiley

I have this working: [SD library]

/*
  SD card test
 created  28 Mar 2011
 by Limor Fried
 */
 // include the SD library:
#include <SD.h>


wired it up.. and it read my sd card....etc.

info:

Initializing SD card...Wiring is correct and a card is present.

Card type: SD1
Volume type is FAT32
Volume size (bytes): 512135168
Volume size (Kbytes): 500132
Volume size (Mbytes): 488
Files found on the card (name, date and size in bytes):



and since you linked me to that library..

I tried that one as well:

sdfatlib:
SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10
The default chip select pin number is pin 10

Enter the chip select pin number:



I did have to edit this line though to match up with my wiring:
int chipSelect = 10;
//original
//int chipSelect = SS_PIN;

Is there a preference?  (and why? just curious)  smiley

Is there another/next small 'feat' to try or get used to? with the sdfatlib

thanks

« Last Edit: November 25, 2011, 12:59:42 am by xl97 » Logged


Pages: [1] 2   Go Up
Jump to: