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?
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.
There are lots of LED strips that you can send commands down the line to. "Close together" is your call.
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.
1.) Thank you... I always get confused when I read 'matrix'..
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.5
2.0
2.5
3.0
3.5
40
12.2
11.8
11.0
10.6
9.69
30
17.8
17.1
15.8
15.0
14.0
20
29.8
28.0
25.9
24.5
22.6
10
66.7
63.7
59.3
55.4
51.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)
"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.
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?)
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.
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
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/
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.
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)
Is there another/next small 'feat' to try or get used to? with the sdfatlib
D10 is the default pin used in the ATMega328 hardware. From Section 19 of the data sheet:
"The interconnection between Master and Slave CPUs with SPI is shown in Figure 19-2 on page
170. The system consists of two shift Registers, and a Master clock generator. The SPI Master
initiates the communication cycle when pulling low the Slave Select SS pin of the desired Slave.
Master and Slave prepare the data to be sent in their respective shift Registers, and the Master
generates the required clock pulses on the SCK line to interchange data. Data is always shifted
from Master to Slave on the Master Out – Slave In, MOSI, line, and from Slave to Master on the
Master In – Slave Out, MISO, line. After each data packet, the Master will synchronize the Slave
by pulling high the Slave Select, SS, line."