8x8x8 multiplexed LED cube with an Arduino Mega 2560

Un4Seen:
OK, I have figured it out :slight_smile: As I wrote, one NDP6020P costs about 2.5$ at Farnell. The transport to Romania would be 5 Euro, regardless of what is in the package. So, assuming that I'd buy 15 pieces of NDP6020P (8 for the 8x8x8 cube, 5 for the 5x5x5 cube and 2 for spares), the total cost would be around 27E or 35$. That's more than the 1000 LEDs and about 33% of the total project cost :slight_smile: I there's no other choice, I'll go for it, but if there's some more widely available, less expensive MOSFET, I'd prefer that :slight_smile:

All the suitable but less expensive p-channel mosfets I found were in SMD packages - and they are MUCH less expensive. So I think your alternative is to download Eagle and design a pcb to hold a 74HC595 and eight SMD mosfets. Then get Itead to make 10 of them for $9.90. Add mosfets such as http://www.ebay.co.uk/itm/20PCS-AO3401-SOT-23-P-Channel-MOSFET-TRANSISTORS-/150653948679?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item2313acd307.

I ordered some of these from thaishine.com
N
Manufacturer Part No: IRF3205

Specification
Mosfet Type N-channel
Current Rating 110A
Rds (On) 8m?
Voltage Rated 55V

P
Manufacturer Part No: IRF9540

Description
MOSFET
Transistor Type:MOSFET
Transistor Polarity:P Channel
Drain Source Voltage, Vds:-100V
Continuous Drain Current, Id:-23A
On Resistance, Rds(on):117mohm
Rds(on) Test Voltage, Vgs:-10V

They were under $1 each in packs of 10.

I also found these (below), after I had ordered the above fets.

Mosfet Type: P-channel
Current Rating: 2.6A
Rds (On): 40 mOhm
Voltage Rated: 12V
Package: SSOT-3

Mosfet Type: N-channel
Current Rating: 4A
Rds (On): 100 mOhm
Voltage Rated: 60V
Package: SOT-223

They are smaller package, but probably suitable for my 1 amp needs. they may be suitable for 1.3 amp, you have to check.

Im not sure which one I got it from, thaishine also sells through ebay.
www.thaishine.com
www.taydaelectronics.com

I am way behind on those cubes, and I havnt had a chance to use the parts, but I assume they will be good for cubes/multiplexing.

dc42, are those tiny sot23 parts going to be able to handle 1.28 amps? they seem pretty small for that. I looked, but I didnt see any datasheet.

Wow, 4 amps from such a tiny package. I wish I had gotten those now.

Yes, see http://www.aosmd.com/pdfs/datasheet/AO3401.pdf. They are rated at 4A continuous (although 3.7A would be a more realistic limit when driven from 5V, since that is the current at which Rds(on) is measured for Vgs=4.5V) and 1.4W power dissipation (although I wouldn't want to dissipate more than a few hundred mW in one).

Guys, did I understand correctly, that the IRF9540 would be able to do the job and I could use it instead of the NDP6020P?
I've found them on eBay and for a good price too: http://www.ebay.com/itm/10pcs-IRF9540-P-Channel-Power-MOSFET-23A-100V-TO-220-IR-Free-Shipping-/180816152092?pt=LH_DefaultDomain_0&hash=item2a197b861c

It seems to be a fast switching P-channel MOSFET in TO-220 packaging, rated at 23A and 100V. What do you think?

Thanks,
Andras

Seems to be a logic level part

Will have at least 1V drop across it, see Figure 2.

TPIC6B595 will have 3-4 ohms of resistance, see Figure 7, at 20mA = another 0.07V

So as long as your LEDs have Vf <(5-1-.07) = 3.93V you should be okay.
Adust your current limit resistors accordingly.

Thank you, CrossRoads!

1-2 days ago we used a different calculation to obtain the value of the current limiting resistors. You wrote back then:
"Resistors = inexpensive resistors, 1/8W, carbon composition. Value will depend on the LED color & the current you want to put thru them.
If have a 5V source, and the anode transistor has 0.45V across it, and the cathode shif register has 0.25V across it, that leaves the remaining voltage across the LED and the resistor.
For and LED with Vf of 3.2V way, and using 20mA as the current, then:
(5V - .45 - .2v - 3.2)/.02 = 55 ohm. 56 ohm is a standard value."

If I understand correctly, now instead of the .45 voltage drop across the anode transistor we have the (at least) 1V drop across the IRF9540. In your earlier explanation you wrote that the cathode shift register drops 0.25V, but I think your current calculation is the correct one and it drops only about 0.07V. I use standard blue LEDs with a voltage drop of 3.3V. So, basically, if your old calculation was wrong and the new one is right, it means that the remaining voltage that needs to be handled is 5V - 1V - 0.07V - 3.3V = 0.63V. Our target current is 20 mA, so R = V/I = 1.18/0.02 = 31.5. In other words 33 Ohm resistors are fine.

Is my above calculation correct? If yes, I'll go for the IRF9540 MOSFETS. That's great news! :slight_smile:

Hmm, are your sure you interpreted figure 2 (http://www.irf.com/product-info/datasheets/data/irf9540n.pdf) correctly? It's the first time in my life that I try to read a diagram like this, but it seems to me that the IRF9540 drops 1V at 2A. In the case of the LED cube one IRF9540 handles 64 LEDs, which means that the current going through it ranges from 0.02A (1 LED lit up) to 1.28A (64 LEDs lit up). The way I read this figure 2, at 0.02A the voltage drop is 0 but I can't figure out from the diagram how much the voltage drop is at 1.28A... I don't really understand it, but can I really use 1V as voltage drop across the IRF9540 regardless how much current (0.02A to 1.28A) is passing through it?

Thanks,
Andras

After looking some more at the graphs, I reached the conclusion that we should try to read figure 1, not figure 2, because figure 1 is at 25 degrees Celsius, while figure 2 is at 175 degrees Celsius. so, looking at figure 1, the second graph line from the bottom is the one for 5V. I don't really understand why the grid lines on the graph are not distributed evenly, but assuming that the distance between the 1A and 10A values on the vertical axis is distributed linearly, it seems that the voltage drop at 1.28 is aroun 0.6-0.7V and the voltage drop at 0.02A is not even represented on the drawing but it should be less than 0.3V, possibly even 0? Am I making any sense here? :slight_smile:

CrossRoads:
Seems to be a logic level part
http://www.irf.com/product-info/datasheets/data/irf9540n.pdf

No, it is most definitely not a logic level part. Rds(on) is quoted at Vgs=10V only. It might just work @ 1.28A, it depends on whether the part you get has a higher or lower than normal gate threshold voltage, whether the 5V supply is a little higher or lower than normal, and on the temperature. Bad choice for this project.

I see... too bad :frowning:
Regardless, the previous line of thought regarding the calculation of the current limiting resistors for the LEDs has opened my eyes to an important fact: no matter what component here, the current passing through it will greatly vary (from 0.02A to 1.28A), which means that its voltage drop may also significantly vary. That means that if only a few LEDs are lit up, they will be brighter compared to the case when most of them are lit up. That's not good. In a LED cube all LEDs should have the same brightness. Inevitably, the question that comes to mind is: why are we trying to use 8 MOSFETS to switch the cathodes instead of using 64 simple transistors to switch the anodes? Wouldn't that be more simple and more cheap? Sure, they would take up more space, but we could use ICs like the ULN2803, which groups them by 8. Or am I wrong?

Thanks,
Andras

Un4Seen:
no matter what component here, the current passing through it will greatly vary (from 0.02A to 1.28A), which means that its voltage drop may also significantly vary

The key is to use a mosfet with low Rds(on). The voltage drop across the mosfet will then be so low that it will be insignificant compared with the voltage drop across the series resistor. For example:

NDP6020P: Rds(on) = 0.05 ohm max @ Vgs = 4.5V, hence voltage drop @ 1.28A = 0.064V

AO3401: Rds(on) = 0.06 ohm max @ Vgs = 4.5V, hence voltage drop @ 1.28A = 0.077V

In both cases, the voltage drop is tiny compared with the voltage drop across the series resistors (between 1V and 3V depending on the voltage drop of your LEDs), so you needn't worry about the brightness decreasing due to mosfet resistance as you turn on more LEDs.

I understand. Well then, it seems that I've got two choices: buy some NDP6020P or accept that I need to use SMDs :slight_smile:

http://www.fairchildsemi.com/ds/ND/NDB6020P.pdf

The voltages I used earlier were just something to show the calculations needed.
Glad it led to a discussion of the datasheet so you have a better idea if what to look for.
I have not seen arrays of P-channel MOSFETs.
Only a PNP part like this

You'd have to break out the anodes into groups so the part is not over driven.

There are several kinds, search digikey.com for
PMIC - MOSFET, Bridge Drivers - Internal Switch
and sort by package type, # of channels/chip.

dc42:

CrossRoads:
Seems to be a logic level part
http://www.irf.com/product-info/datasheets/data/irf9540n.pdf

No, it is most definitely not a logic level part. Rds(on) is quoted at Vgs=10V only. It might just work @ 1.28A, it depends on whether the part you get has a higher or lower than normal gate threshold voltage, whether the 5V supply is a little higher or lower than normal, and on the temperature. Bad choice for this project.

heh, well, I guess I have 10 of them I wont be able to use. I wish someone had posted something like that in my thread a few weeks ago when I asked. nobody posted anything one way or another, so i looked around at parts that I could order, and those seemed like the right option, but I guess I should get some of the ones you posted earlier.

If I do some 12v stuff (like putting LEDs on cars), would the be good for that?

Hippynerd:
If I do some 12v stuff (like putting LEDs on cars), would the be good for that?

Yes, if you give them 10V or 12V gate drive. With 5V gate drive they will probably be OK for switching up to about 1A.

Based on what i've read around here, it sounded like the RDS was the key issue when picking a mosfet, that and one big enough to handle the current. which was the criteria I used when looking for mosfets. Its like LED drivers, there are an overwhelming amount of options, and precious little information about why one would be good or bad for something.

So, what factors do you need to know to pick the right mosfet?

RDS, VGS? ??? ???
Are there any good websites that might help learn, and or pick out a good part? How about one for LED drivers, that sure would be nice!

First, determine the maximum value of Rds(on) that you can accept. This is typically determined by the maximum current you will be switching, and the power dissipation in the mosfet that you can accept. Unless the current is very high, then you will normally want to design for no heatsink. In this case I suggest limiting the power dissipation to 1W for a TO-220 mosfet, or 0.5W for one in a smaller package (but check the datasheet in case it is lower). Use lower values if ventilation will be poor, e.g. in a sealed box. Since the static power dissipation is I ^ 2 * R, you have Rmax = Pmax/I^2.

Now look for mosfets which have Rds(on) no higher than that value, specified at the gate-source voltage (Vgs) you will be using or lower, and the maximum current you will be using or higher. Also the drain-source (Vds) rating needs to be high enough for your application.

When using mosfets for low speed switching applications, that's usually all there is to it. In this particular example, there is an additional consideration that Rds(on) should be low enough such that the voltage drop across the mosfet does not cause the brightness of the LEDs to decrease significantly as more LEDs are turned on.

Thanks for that explanation, its a bit difficult to understand, since I have no idea of how much I can accept of several factors. It would be nice to have a table of applications, and specific parts with specific details that were easily compared to other parts. Watt/package size is a nice relationship, that seems easy enough to factor.

Lets use 20 mA x 64 LED as an example. Assuming its running on 5v, using constant current driver to sink, (that sounds like the direction he is heading), it should use up to 1.28A. With this design, he is only doing 12.5% duty cycle. How do we apply the math to figure out what specific specifications to look for, and ranges maybe? It seems like a simple table would be easy enough to make.

Hippynerd:
Lets use 20 mA x 64 LED as an example. Assuming its running on 5v, using constant current driver to sink, (that sounds like the direction he is heading), it should use up to 1.28A. With this design, he is only doing 12.5% duty cycle. How do we apply the math to figure out what specific specifications to look for, and ranges maybe? It seems like a simple table would be easy enough to make.

Let's look at power dissipation first. If we assume that the software works so that the 1/8 duty cycle won't be exceeded, and we go for 0.5W maximum power dissipation in the mosfet, then the dissipation while the mosfet is conducting can be up to 8 * 0.5W = 4W. So we need Rds(on) <= 4/(1.28 * 1.28) = 2.4 ohms.

However, the voltage drop would then be 2.4 * 1.28 = 3.1V, and we certainly can't tolerate that in a LED driver running from a 5V supply as there wouldn't be enough voltage left to drive the LEDs and series resistors. So in this case, maximum Rds(on) is determined by maximum allowable voltage drop. If we were not concerned about the LEDs getting dimmer as more are turned on, we might allow 0.5V, allowing Rds(on) of up to about 0.4 ohms.