Go Down

Topic: MAX7221 Led driver discussion (again) (Read 5 times) previous topic - next topic


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


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.
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.



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.



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.
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.


Nov 25, 2011, 06:56 am Last Edit: Nov 25, 2011, 06:59 am by xl97 Reason: 1

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

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.


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:

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;
//int chipSelect = SS_PIN;

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

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


Go Up