4x4x4 LED cube Plan B - advice on driver chip selecton please

PaulRB

Senior Member
Hi all,

Having more-or-less concluded that the speed of PICAXE basic isn't really up for high speed multiplexing of the type I was proposing before, plan B is to choose a driver chip(s) to take that processing load away and allow the PICAXE to concentrate on the pattern animation.

I would like to use an 08m2 or 14M2. Seems a waste of pins to use anything larger, eg. 20X2 (although that does at least have SPI interface). Would like to keep numbers of chips and other components low as poss for simplicity, even if that costs a fiver or two more.

Here are the options I have considered so far, could do with advice on which to choose, or other possible options:

1. SAA1064:

+ I2C interface, easy & efficient connection to M2 PICAXEs
+ selectable I2C address allowing up to 4 on same bus
+ 1:2 multiplexing for brighter LED illumination

- 2 chips needed for 64 LEDs
- large ICs (24pin, 0.6" wide)
- moderately expensive
- moderately easy to find
- external components needed - 1 timing cap per chip and 2 transistor anode drivers per chip.
- slower I2C speed only

2. MAX7219:

+ single chip could theoretically run all 64 LEDs
+ almost no other external components needed (apart from one resistor and the usual decoupling caps)
+ reasonably cheap (<£3 from UK eBay sellers, £1 from far East)
+ reasonably easy to find

- serial interface only - would need to "bit-bang" data from M2 PICAXE
- 1:8 multiplexing could result in dimmer LED illumination

3. MAX6958/9:

+ small chip (16 pin)
+ I2C interface
+ faster I2C speed
+ no other external components required

- 2 chips needed
- 1:4 multiplexing
- difficult to find (eBay drew a blank, DigitKey only UK supplier I found so far)
- expensive (>£4 then add VAT + postage)
- "A" and "B" variants would need to be purchased to allow connection to same I2C bus, as I2C address cannot be varied. Price above from DigitKey is for "B" variant. They want >£9 for "A" variant - the exact same chip except for literally 1 bit difference!!!

Opinions please? My current favourite is option 2, but the need to bit-bang the data is a shame - doesn't seem to be an I2C variant, like many other Maxim chips.

Paul
 

JimPerry

Senior Member
Option 4 - use Option 3 with seperate Picaxe controlled I2C circuits so the "cheap chip" could be used? :eek:

Talking through my backside - won't work :eek:
 
Last edited:

PaulRB

Senior Member
Option 2 looks best I think. Look under "Shiftout"/"Shiftin" in Manual 2 for SPI bitbanging routines (although slow)
Thanks Jamster, there are much better ways to code the shift out than shown in the manual, though still not nearly as fast as the X2 hardware shiftout.

I've read most of the forum threads on all 3 chips, and others.

My other concern about option 2 is the 1:8 multiplexing. It may be bright enough for 7seg displays, but will it be bright enough for a cube?
 

PaulRB

Senior Member
Right, after further thought, I think I should eliminate option 1. This is because 2 x SAA1064 would have a total of 32 anode connections. There's no easy/elegant way to construct the cube for that. Not because they're anodes, I can construct my cube for common cathodes or anodes, but the practical maximum is 16 when you think about it.

Option 3 would be perfect, except the max6958/9 chips would cost me £15 vs. £3 for the max7219. But I did say at the start I would pay a few quid extra... its just the thought of being ripped off for the "A" variant. If they were both £4, that would be fine. I'm going to keep looking.

Before anyone asks, no, I wasn't born a Yorkshireman. For those that don't know their reputation, they describe themselves as like a Scotsman with all the generosity taken out!

EDIT: Didn't read the DigiKey page carefully enough. The £4 price was for 5,000 units!

The MAX6958 A and B variants are available from both DigiKey and Mouser (UK websites) at around the same price £7.20 ~ £7.50 each, plus £12 for shipping!
 
Last edited:

westaust55

Moderator
SAA1064 is primarily intended to drive 2 or 4 digits in 7-seg displays. It uses internal multiplexing for 4 digits but can be used to drive discrete LED's thus in reality it is two 8 bit ports.
Outputs are current sinking only but have adjustable current output (3 to 21 mA in 3 mA steps) .
Nothing wrong with this chip and in fact I have some on hand to do some experiments with sometime (lots of new home, selling old house and camper trailer repair related tasks keeping me busy at the moment)
Package 0.6" wide 24 pin DIP package available
Futurlec price AUD$3-20 ea

MCP23017 is another option as an i2c comms connected device each with two 8 bit ports that can be addressed as two consecutive data locations (with appropriate setting).
Outputs are active driving both high (source) and low (sink)
Not specifically intended to drive LED's at higher currents so some interfacing transistors are likely required - at least for common lines if multiplexing.
Each I/O pin can drive up to 25 mA but the total for the chips is 125 mA source/150 mA sinking.
28 pin 0.3" wide DIP package available
Futurlec price AUD$1-20 ea
There are some example code snippets on the PICAXE forum for the MCP23017. I have used two to drive an 8x8 matrix of RGB LEDs = 192 LEDs in total.
 

PaulRB

Senior Member
SAA1064 is primarily intended to drive 2 or 4 digits in 7-seg displays. It uses internal multiplexing for 4 digits but can be used to drive discrete LED's thus in reality it is two 8 bit ports.
Outputs are current sinking only but have adjustable current output (3 to 21 mA in 3 mA steps) .
Nothing wrong with this chip and in fact I have some on hand to do some experiments with sometime (lots of new home, selling old house and camper trailer repair related tasks keeping me busy at the moment)
Package 0.6" wide 24 pin DIP package available
Futurlec price AUD$3-20 ea
Thanks Westy, I am familiar with these chips and have used in the past. You're right, nothing wrong with them for 7 seg displays, in fact unlike rival chips they can drive up to 18V for really big displays with high Vff - I have one driving a clock with 1.2" blue 7 seg displays. But I have discounted them for the cube for the 32 anodes reason above.

MCP23017 is another option as an i2c comms connected device each with two 8 bit ports that can be addressed as two consecutive data locations (with appropriate setting).
Outputs are active driving both high (source) and low (sink)
Not specifically intended to drive LED's at higher currents so some interfacing transistors are likely required - at least for common lines if multiplexing.
Each I/O pin can drive up to 25 mA but the total for the chips is 125 mA source/150 mA sinking.
28 pin 0.3" wide DIP package available
Futurlec price AUD$1-20 ea
There are some example code snippets on the PICAXE forum for the MCP23017. I have used two to drive an 8x8 matrix of RGB LEDs = 192 LEDs in total.
I'm impressed that your design worked at 8MHz, given that the PICAXE is doing the multiplexing. I found it ran out of juice at 32MHz. But that design isn't simple, there are a large number of resistors and transistors to wire up in addition to the chips. And I was looking to offload the multiplexing duties from the PICAXE.

Paul
 

hippy

Ex-Staff (retired)
I'd go for a MAX7219 or similar which is a one chip solution. I'd then declare it false economy to save a pound or so in not using a 20X2 which has both the fastest internal operating speed and high-speed SPI. The time taken thinking about bit-banging, let alone writing and debugging the code, will probably exceed the cost saved. The cost of having written this is probably greater :)
 

PaulRB

Senior Member
I'd go for a MAX7219 or similar which is a one chip solution. I'd then declare it false economy to save a pound or so in not using a 20X2 which has both the fastest internal operating speed and high-speed SPI. The time taken thinking about bit-banging, let alone writing and debugging the code, will probably exceed the cost saved. The cost of having written this is probably greater :)
Sage words Hippy. But for now, Plan A is back!
 

DDJ2011

Member
Clarification

Here are the options I have considered so far, could do with advice on which to choose, or other possible options:

1. SAA1064:
- 2 chips needed for 64 LEDs

2. MAX7219:
+ single chip could theoretically run all 64 LEDs

3. MAX6958/9:
- 2 chips needed
Hi All,

Perhaps I have missed something here in the thread, but I don't think that in a 4*4*4 cube you are trying to control 64 LEDs.

The structure as I understand it, is that each layer has 16 (4*4) LEDs , then there are four layers - this gives the final *4 in the 4*4*4 calculation.

So, you only need chips to control 16 columns of LEDs, plus something (another chip?) to control the layers.

So, options to control 64 LEDs are overkill, and not required...or am I wrong?

I hope not, coz I'm working on LED cubes now and learning that I have to control all LEDs individually would be a bit of a blow!

Cheers,

DDJ
 

PaulRB

Senior Member
Hi DDJ,

I don't think that in a 4*4*4 cube you are trying to control 64 LEDs.
Well, yes you are. 4 x 4 x 4 = 64. There's no getting away from it!

The structure as I understand it, is that each layer has 16 (4*4) LEDs , then there are four layers - this gives the final *4 in the 4*4*4 calculation.
Another possible configuration is 2 groups of 8 LEDs on each layer, times 4 layers high. You end up with a cube that's actually split down the middle with no mid-air connections between the 32 LEDs on the left and the 32 on the right.

The advantage to this configuration is that each group of 8 LEDS is a bit like a 7-segment display (8 segment if you include the decimal point). So you can use a chip or chips designed for driving 7-seg displays. They will do your multiplexing for you instead of doing it yourself with the PICAXE.

Paul
 

DDJ2011

Member
Hi DDJ,
Well, yes you are. 4 x 4 x 4 = 64. There's no getting away from it
OK - so you are controlling 64 LEDs, but you are really controlling 16 (4*4) columns times 4 layers (4*4*4). So you driver chips only need to handle 16 with transistors for the layer aspect.

I'm sure this is right - otherwise it would become unwieldy to solder the connections fo larger cubes. I'm starting with 3*3*3 red, with the intention of moving to a large (maybe 7^3 or 9^3) RGB to amuse my kids.

DDJ
 

PaulRB

Senior Member
you are really controlling 16 (4*4) columns times 4 layers (4*4*4). So you driver chips only need to handle 16 with transistors for the layer aspect.
That's just one design strategy, its no more "real" than any other. It's just a commonly used one. Don't be blinkered by what the Arduino crowd are all doing, think through the possibilities and pick a strategy that appeals to you, then go for it. The quality and speed of support you'll get here is at least as good as any other place on the net.

Keep us informed of your progress!

Paul
 
Last edited:

boriz

Senior Member
For speed, parallel wherever you can. It takes more then 8 times longer to bitshift 8 bits than to just set all the pins in a port with PINS=

So why not use 8 shift registers, each driven in parallel?

Speed is usually the limiting factor for Picaxe apps.
 

westaust55

Moderator
For speed, parallel wherever you can. It takes more then 8 times longer to bitshift 8 bits than to just set all the pins in a port with PINS=

So why not use 8 shift registers, each driven in parallel?

Speed is usually the limiting factor for Picaxe apps.
Shift registers (eg 74HC595 et al) still incur serial comms related delays.

Instead use say a 74HC373 octal latch with parallel load and parallel output.
Use a port as Boris suggests plus an extra line for each chip to latch the data into the 74HC373.
The parallel in on all can be across the same PICAXE port.

Tentatively faster/set data transfer but user still needs extra components for control of LED for current/voltage.
 
Last edited:

BeanieBots

Moderator
I'd pay good maney for some of those offal chips. Very useful in the workplace.
On the other hand, an octal buffer could work but you would need resistors and might need to use drivers to get the required current.
If I were doing it, I'd go for the MAX7219 and an X2 PICAXE because it would be by far the simplest hardware. Also, I've used them before and they can supply plenty of current.
 

boriz

Senior Member
Up to 8 in parallel will run at the same speed as one. 512 LEDs!. No more difficult to drive, just need more memory for the patterns. (And a bit more soldering *grin*)
 

PaulRB

Senior Member
Up to 8 in parallel will run at the same speed as one. 512 LEDs!. No more difficult to drive, just need more memory for the patterns. (And a bit more soldering *grin*)
Yes, I'm now convinced a picaxe could drive 8 x max 7219 in parallel like that. This evening, I had an 08m2 simulating driving a single 7219 at around 50 updates per second. So a 20x2 with its hardware spi and 64MHz clock should be able run 8 of them.
 

PaulRB

Senior Member
Plan B has taken a step forward!

The max7219 chips arrived and I got one working in less than 1/2 hour. Tested it by connecting up 6 leds.

Video: http://youtu.be/kWbRQzFVCm0

Code:
'08m2 4x4x4 LED Cube using MAX7219 Driver IC
'P. Beard Aug 2012

#picaxe 08m2

'These variables (w2 to w5) hold the current patterns for each layer in cube.
symbol	LAYER1 = w2
symbol	LAYER1LEFT = b4
symbol	LAYER1RGHT = b5
symbol	LAYER2 = w3
symbol	LAYER2LEFT = b6
symbol	LAYER2RGHT = b7
symbol	LAYER3= w4
symbol	LAYER3LEFT = b8
symbol	LAYER3RGHT = b9
symbol	LAYER4= w5
symbol	LAYER4LEFT = b10
symbol	LAYER4RGHT = b11

'Pins for serial communications with the MAX7219 IC
symbol	M7219DATA = PinC.0
symbol	M7219CLK = C.4
symbol	M7219LOAD = C.1


main:

	setfreq m4
	
	w0 = $0C01 : gosub send7219 'Switch on LED Driver
	w0 = $0900 : gosub send7219 'Set no decoding on any digits
	w0 = $0A0F : gosub send7219 'Set intensity to max
	w0 = $0B07 : gosub send7219 'Scan all 8 digits
	w0 = $0F00 : gosub send7219 'Display test mode off
	
	Do
		LAYER1 = LAYER2
		LAYER2 = LAYER3
		LAYER3 = LAYER4
		random LAYER4
		gosub updatecube
		pause 50
	loop
	
send7219: 'Send contents of w0 to the MAX7219 Driver IC

	M7219DATA = bit15 : pulsout M7219CLK, 1
	M7219DATA = bit14 : pulsout M7219CLK, 1
	M7219DATA = bit13 : pulsout M7219CLK, 1
	M7219DATA = bit12 : pulsout M7219CLK, 1
	M7219DATA = bit11 : pulsout M7219CLK, 1
	M7219DATA = bit10 : pulsout M7219CLK, 1
	M7219DATA = bit9 : pulsout M7219CLK, 1
	M7219DATA = bit8 : pulsout M7219CLK, 1
	M7219DATA = bit7 : pulsout M7219CLK, 1
	M7219DATA = bit6 : pulsout M7219CLK, 1
	M7219DATA = bit5 : pulsout M7219CLK, 1
	M7219DATA = bit4 : pulsout M7219CLK, 1
	M7219DATA = bit3 : pulsout M7219CLK, 1
	M7219DATA = bit2 : pulsout M7219CLK, 1
	M7219DATA = bit1 : pulsout M7219CLK, 1
	M7219DATA = bit0 : pulsout M7219CLK, 1
	pulsout M7219LOAD, 1
	return
	
updatecube: 'Update the cube LEDs

	b0 = LAYER1LEFT : b1 = $01 : gosub send7219
	b0 = LAYER1RGHT : b1 = $02 : gosub send7219
	b0 = LAYER2LEFT : b1 = $03 : gosub send7219
	b0 = LAYER2RGHT : b1 = $04 : gosub send7219
	b0 = LAYER3LEFT : b1 = $05 : gosub send7219
	b0 = LAYER3RGHT : b1 = $06 : gosub send7219
	b0 = LAYER4LEFT : b1 = $07 : gosub send7219
	b0 = LAYER4RGHT : b1 = $08 : gosub send7219
	return

end
Then 32 leds: https://www.youtube.com/watch?v=PcZ4hZyGYcQ&feature=youtube_gdata_player
 
Last edited:

boriz

Senior Member
Cool. Well done.

Though your last vid seems to have burned out all my optical sensitivity to blue light!
 

PaulRB

Senior Member
Last edited:
Top