Cube led 4x4x4 conections help

hi all i did a cube 4x4x4 folowing this tutorial

Everything is working fine , the lights of leds are not to bright, im using ultra violet UV led diode 3.2-3.4V

rigth now all column pins goes to 220ohm and columns
and layers pins to 100 ohm and layers

Now my question is i find very odd that this circuit got no transistors on it so i wonder if is function safely..

i was wondering if i put 16 transistors 2N2222A on eatch column arduino pin with 500 ohm to base
external 12V to collector put the column leds to collector going to emitter and ground.
and the 4 layers on analog pins A0,A1,A2,A3 connect to 4 transistors 2N2222A, pins to 10k ohm to base and layers connected to collector going directly to emitter and ground if this would be a correct way of doing and if the leds would be more bright...

thanks in adavanced...

encarnacao:
hi all i did a cube 4x4x4 folowing this tutorial

http://www.instructables.com/id/4x4x4-LED-Cube-Arduino-Uno/

Now my question is i find very odd that this circuit got no transistors on it so i wonder if is function safely..

No, I suspect not. The pins driving the layers are probably overloaded and this will shorten their life.

encarnacao:
i was wondering if i put 16 transistors 2N2222A on eatch column arduino pin with 500 ohm to base
external 12V to collector put the column leds to collector going to emitter and ground.
and the 4 layers on analog pins A0,A1,A2,A3 connect to 4 transistors 2N2222A, pins to 10k ohm to base and layers connected to collector going directly to emitter and ground if this would be a correct way of doing and if the leds would be more bright...

No, that would not work and the Arduino and Leds could be damaged by the 12V supply.

Stick to 5V. To increase the brightness, you need more current, not more voltage. The weak point in the instructables design is that all current for a layer comes from one Arduino pin. You are right about the use of transistors to overcome this, but you need to know a little more about transistors (such as the difference between and use of pnp and npn types).

Paul

the lights of leds are not to bright, im using ultra violet UV led diode 3.2-3.4V

Why use a UV LED?
How do you know it is not so bright, you can't see UV any light you can see is going to be non intended emissions due to what ever technique your UV LED uses.

im very new to this so im kind of lost so if you could explain me how to do the proper conections and what to use would be awsome

Mike, I suspect they are not "true" uv leds (such as you would use for pcb photo-etching etc) but those pink/purple leds that are often described as "uv". I have some and they do emit some uv light (you can see by the way they illuminate different surfaces) but most of the light is in the visible range.

http://www.ebay.co.uk/itm/Super-Bright-3mm-or-5mm-Ultra-Bright-UV-Ultra-Violet-Purple-LED-Light-Lamp-/321348375938

5mm 1000mcd Ultra Violet UV LED Diode 3.2-3.4V 20mA For DIY

those are the lights im using.

Ok, if you followed that instructable, then your cube layers are anodes, so you need "high-side" switch transistors between your Arduino outputs and the layers. Your 2n2222 transistors might be ok for this (used as emitter followers) but given the high forward voltage of your leds, I think some pnp transistors would be better. 2n2907 would be an example, or bc327. You can put 4K7 resistors between the Arduino outputs and the pnp bases. Their collectors go to 5V and emitters to the cube planes. You don't need resistors on both the columns and planes, so I suggest around 220R on the columns only.

My 16 columns is anodes(+) and the 4 layers catodes(-)

so that would make a diferent way of wiring :frowning:
im kind of lost here hehe
any way of correcting now or solution?

thanks in advanced Paul for your help

Add two shift registers, cd74AC164, to source current to your columns.
Then 4x NPN on N-channel MOSFET to sink 320mA current from the layers.

i would need to order the cd74AC164 would take me awhile to get anyway to do with transistors?

If you have some 2N2907 or BC327 try this then. So you have made a cube where the columns are connected to the anodes (positive of the LED’s) So you need a PNP (current sourcing) type transistor for each of the 16 columns. So as Paul suggested use some 2N2907 with a 4.7K (4K7) resistors between the base and the Arduino digital pin. Connect the emmiter to 5 Volts and the collector to the cube column through a 220 ohm resistor. See attached image.

yep go it

connect eatch of the pins (13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, A4, A5) to the columns anodes like the picture u showed.
the 5v to the emitter comes from arduino correct

and the layers pins (A0, A1, A2, A3) how i will conect them?

encarnacao:
the 5v to the emitter comes from arduino correct

Yes correct

encarnacao:
and the layers pins (A0, A1, A2, A3) how i will conect them?

Also correct.

And the code needs to send a HIGH to the Arduino digital pin controlling the transistor and LOW to the Arduino digital pins controlling the levels.

got confused on the part of the and the layers pins (A0, A1, A2, A3) how i will conect them?
same way with transistors or?

Just connect the four layers straight to pins (A0, A1, A2, A3) If you used transistors on these as well you would have to change the code that is supplied in the Instructable.

Also a lot of the codes you see online are not multiplexing and can therefore draw a lot of current from the Arduino pins. So many things to learn :sunglasses:

Pedro147:
And the code needs to send a HIGH to the Arduino digital pin controlling the transistor and LOW to the Arduino digital pins controlling the levels.

Don't worry about this bit yet, best to get it working first. 8)

yes i know Pedro alot things to learn is a huge world
i apreciate the help u all been providing :slight_smile:

by the way the code i was using is

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 100 // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 20 // multiplies DisplayTime to get ms - why not =100?

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
// TODO this could be a lot more compact but not with binary pattern representation
prog_uchar PROGMEM PatternTable[] = {

//1   //2   //3   //4   //5   //6   //7   //8   //9   //10  //11  //12  //13  //14  //15  //16     //row numbers, very useful
B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,10,//empty set 
  
  
//Code goes here, i started you off above





// this is a dummy element for end of table (duration=0) aka !!!DO NOT TOUCH!!!
B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 0
};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Note that analog inputs 0-5 are also digital outputs 14-19!
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
*/

int LEDPin[] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, A5, A4};
int PlanePin[] = {A0, A1, A2, A3};

// initialization
void setup()
{
int pin; // loop counter
// set up LED pins as output (active HIGH)
for (pin=0; pin<PLANESIZE; pin++) {
pinMode( LEDPin[pin], OUTPUT );
}
// set up plane pins as outputs (active LOW)
for (pin=0; pin<CUBESIZE; pin++) {
pinMode( PlanePin[pin], OUTPUT );
}
}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
// declare variables
byte PatternBuf[PLANESIZE]; // saves current pattern from PatternTable
int PatternIdx;
byte DisplayTime; // time*100ms to display pattern
unsigned long EndTime;
int plane; // loop counter for cube refresh
int patbufidx; // indexes which byte from pattern buffer
int ledrow; // counts LEDs in refresh loop
int ledcol; // counts LEDs in refresh loop
int ledpin; // counts LEDs in refresh loop

// Initialize PatternIdx to beginning of pattern table
PatternIdx = 0;
// loop over entries in pattern table - while DisplayTime>0
do {
// read pattern from PROGMEM and save in array
memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
PatternIdx += PLANESIZE;
// read DisplayTime from PROGMEM and increment index
DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );
// compute EndTime from current time (ms) and DisplayTime
EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;

// loop while DisplayTime>0 and current time < EndTime
while ( millis() < EndTime ) {
patbufidx = 0; // reset index counter to beginning of buffer
// loop over planes
for (plane=0; plane<CUBESIZE; plane++) {
// turn previous plane off
if (plane==0) {
digitalWrite( PlanePin[CUBESIZE-1], HIGH );
} else {
digitalWrite( PlanePin[plane-1], HIGH );
}

// load current plane pattern data into ports
ledpin = 0;
for (ledrow=0; ledrow<CUBESIZE; ledrow++) {
for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
digitalWrite( LEDPin[ledpin++], PatternBuf[patbufidx] & (1 << ledcol) );
}
patbufidx++;
}

// turn current plane on
digitalWrite( PlanePin[plane], LOW );
// delay PLANETIME us
delayMicroseconds( PLANETIME );
} // for plane
} // while <EndTime
} while (DisplayTime > 0); // read patterns until time=0 which signals end
}

if any changes need it let me know mate :)ty

No that code will not work without modification. Just to test the cube try the code from the Instructable. And it's best to post your code on the forum between the code tags See attached image

Pedro147:
Just connect the four layers straight to pins (A0, A1, A2, A3)

No, don't do that. That is how the cube was wired originally. It is the weakest point of the design, because the current from up to 16 leds could flow into each of those pins, overloading them. If the OP adds transistors to each column (=anode, the opposite to the instructable that was being "followed") then even more current could flow into those 4 pins, damaging the Arduino.

It would be better to add transistors to the planes/cathodes as a first step. Use your 2n2222 npn transistors with 4K7 between Arduino pin and base, collector to plane and emitter to ground/0V.

If the cube is still not bright enough, then the next step would be to add transistors or shift registers to drive the columns/anodes. This is because, once the plane transistors are in place, the next weakest point in the design is the overall current that the atmega328 can provide to the cube through its 16 pins connected to the columns. Each pin can provide 20~30mA, which would be fine, but there is also an overall limit of ~200mA for the whole chip, plus ~100mA limits for certain groups of pins. This means the current to each led needs to be limited to around 10mA, hence the 220R series resistors.

To use pnp transistors for this, again connect Arduino pins to base with 4K7, collectors to 5V, emitters to columns via the series resistors, as in Pedro's diagram. When this is done, the current to each led can be increased to ~20mA by using lower series resistors e.g. 100R.

Pedro147:
If you used transistors on these as well you would have to change the code that is supplied in the Instructable.

Correct. You will need to do this.

Pedro147:
Also a lot of the codes you see online are not multiplexing

I have never seen a cube design that did not multiplex! The result would be a bird's nest of wiring!

The important question is what multiplex ratio the sketch is implementing. A ratio of 1 in 4 would be best, but if the sketch implements 1 in 16 or even worse 1 in 64, that would help explain why the cube is not bright enough. Now that the OP has posted the sketch, we should be able to determine what ratio is being used.

UPDATE: the sketch appears to be using 1 in 4 multiplex ratio, so there's no scope to increase the brightness there. More current needed!

PaulRB:
I have never seen a cube design that did not multiplex! The result would be a bird's nest of wiring

Sorry Paul, my mistake. I was under the misapprehension that the principle of multiplexing was a function of the code as opposed to the wiring of the LED's. Just to satisfy my curiosity, how could a cube be wired with

PaulRB:
a bird's nest of wiring!

if you don't mind showing me or pointing me to an example. Thanks :sunglasses:

Pedro147:
I was under the misapprehension that the principle of multiplexing was a function of the code as opposed to the wiring of the LED's.

Both code and wiring need to be designed together to achieve multiplexing.

Pedro147:
Just to satisfy my curiosity, how could a cube be wired with if you don't mind showing me or pointing me to an example.

I don't think there are any examples of that - it would be a slightly crazy thing to do!

To light a 4x4x4 cube without multiplexing, you would need 64 outputs, one for each led. For example 8 x 8-bit shift registers. Each shift register output would need to be individually connected to a led, so 64 wires inside the cube, plus a common connection as a return path for the current. Compare that with the OP's design, where there are 16 column connections and 4 plane connections, 20 in total vs 65.