# Help figuring out appropriate transistor for LED Cube

#### jerseyguy1996

Joined Feb 2, 2008
206
I am trying to design my first LED Cube using STP16CPC26 LED drivers and an ATTINY85 microcontroller. I am using the TINY85 mostly because I have them and want to use them on something fun but I know it is not typical to use an 8 pin microcontroller in this type of application. My plan is that the first 5 bits sent from the microcontroller will specify the row of the cube to be turned on and the next 25 bits will specify the columns. If I am understanding the datasheet for the LED driver correctly it appears that they will sink current but not source current which (in my very limited understanding of electronics) suggests that I would need to drive PNP transistors with the LED Driver to light specific rows. I have included what I have so far in the attached schematic and Q1 through Q5 are the transistors in question.

The LEDs are driven at 20 mA based on a 1K resistor on R-EXT of the LED drivers which I think would mean that if all LED's in a row are lit that the transistor will have to supply 500 mA. I am horrible at reading transistor data sheets but it seems that all of the ones that I read show them sourcing closer to 10 mA at saturation so I am not sure how to get 500 mA. Can someone help me understand what I should be looking for to select an appropriate transistor for this application?

#### Attachments

• 42.6 KB Views: 27

#### thatoneguy

Joined Feb 19, 2009
6,359
The way I did mine was to only light one LED at a time per port.

My vertical layers were "Z", X was left to right, Y was front to back. Only one Z was enabled at any given moment, then I enabled the out x and y ports for that layer. Left them on while I went to next layer, once buffer was ready, disabled previous layer, put out new bits, enabled new layer. I did the output on an interrupt at about 1kHz, the entire array was mirrored in a RAM framebuffer which was manipulated using draw functions that were defined. When the interrupt happens, the framebuffer was put out to the LED cube. There wasn't any problems with the interrupt happening in the middle of drawing a line or lighting up a plane, as it was only 1/1000th of a second, so the function would finish and the result would look perfectly smooth. The entire cube was refreshed 200 times per second.

I used a PIC with more pins to direct drive the X/Y, but should be able to use shift registers for the high driver, since you only need a single 20mA port to drive one (x,y) LED (that flickers at 1kHz with high duty cycle to appear brightly lit), and the IC driver to sink all of the LEDs on that Z layer (few hundred mA max).

I structured mine like:

Rich (BB code):
zmax
|  / ymax
| /
|/_____xmax

Last edited:

#### nickelflipper

Joined Jun 2, 2010
280
Using the STP16CPC26 as a pfet high side driver should work fine for the 5 levels of the cube. Driving the gate low with a cmos output will turn on a logic level pfet, if the total gate charge (Qg) is low enough (say less than 25 nC?, the lower the better). For instance, I have used a 74hc138 to drive the gate to an irf7304. which had a led load up to 500ma. There should be many pfets with similar characteristics.

#### jerseyguy1996

Joined Feb 2, 2008
206
Using the STP16CPC26 as a pfet high side driver should work fine for the 5 levels of the cube. Driving the gate low with a cmos output will turn on a logic level pfet, if the total gate charge (Qg) is low enough (say less than 25 nC?, the lower the better). For instance, I have used a 74hc138 to drive the gate to an irf7304. which had a led load up to 500ma. There should be many pfets with similar characteristics.
Is pfet synonymous with p-channel mosfet?

#### thatoneguy

Joined Feb 19, 2009
6,359
Is pfet synonymous with p-channel mosfet?
Yes. It's just abbreviated, used to switch high side voltage/source current rather than switch/sink current for n-fet/N-Channel MOSFET, although you can switch current with an N-MOSFET if you use a high side driver, which makes things complicated, high side drivers and N-Fet are pretty much only used when driving large loads such as motors in an H-Bridge.

#### jerseyguy1996

Joined Feb 2, 2008
206
Yes. It's just abbreviated, used to switch high side voltage/source current rather than switch/sink current for n-fet/N-Channel MOSFET, although you can switch current with an N-MOSFET if you use a high side driver, which makes things complicated, high side drivers and N-Fet are pretty much only used when driving large loads such as motors in an H-Bridge.
So I revised my schematic to use the p-fet. Does the attached schematic look correct? Would I need weak pullups on the fet gates to insure cutoff or will the LED driver provide a high enough logic level to shut the fet off?

#### Attachments

• 47 KB Views: 38

#### jerseyguy1996

Joined Feb 2, 2008
206
The way I did mine was to only light one LED at a time per port.

My vertical layers were "Z", X was left to right, Y was front to back. Only one Z was enabled at any given moment, then I enabled the out x and y ports for that layer. Left them on while I went to next layer, once buffer was ready, disabled previous layer, put out new bits, enabled new layer. I did the output on an interrupt at about 1kHz, the entire array was mirrored in a RAM framebuffer which was manipulated using draw functions that were defined. When the interrupt happens, the framebuffer was put out to the LED cube. There wasn't any problems with the interrupt happening in the middle of drawing a line or lighting up a plane, as it was only 1/1000th of a second, so the function would finish and the result would look perfectly smooth. The entire cube was refreshed 200 times per second.

I used a PIC with more pins to direct drive the X/Y, but should be able to use shift registers for the high driver, since you only need a single 20mA port to drive one (x,y) LED (that flickers at 1kHz with high duty cycle to appear brightly lit), and the IC driver to sink all of the LEDs on that Z layer (few hundred mA max).

I structured mine like:

Rich (BB code):
zmax
|  / ymax
| /
|/_____xmax

I have actually set mine up like that with each pin of the LED driver only sinking current from one LED at a time but my horizontal layers are also being driven by the LED Driver so I need to drive a transistor on the high side to source enough current to drive potentially 25 LED's all at once.

#### thatoneguy

Joined Feb 19, 2009
6,359
I have actually set mine up like that with each pin of the LED driver only sinking current from one LED at a time but my horizontal layers are also being driven by the LED Driver so I need to drive a transistor on the high side to source enough current to drive potentially 25 LED's all at once.
You could switch it around, use 74HC595 Shift Registers for X and Y on the high side (4 outputs from uC), which would supply your individual layer, and then sink that entire layer using the driver, which would enable all the features of the driver, such as PWM on some layers for fade effects, etc.