Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Un4Seen on Dec 26, 2012, 03:07 pm

Title: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 26, 2012, 03:07 pm
Hi Everybody!

I'm a new member in this forum, who has just received an Arduino Mega 2560 as a Christmas gift :) This means that I've never ever worked with Arduino before. but I have a big dream for about 2 years now, building an 8x8x8 LED cube and I'm going to try that as my first Arduino project. For this I need a little bit of help :) Please help me verify my theory about how I plan to construct it and give me useful advice if you can.

I'm an amateur when it comes to electronics. I've done some electronics projects in my life (like a binary LED clock controlled with a Raspberry Pi or a miniature locomotive driver which controls H0 locomotives with PWM signals), so know a few things, but there are quite many things out there that I don't know. In the last two years I have searched the Internet for how an 8x8x8 LED cube can be created. I've read many things, half of which I don't understand at all, so I'd like to create my cube in the simplest fashion possible, but not compromising the perfection of it. I hope to avoid using shift registers, latch circuits and other additional complications which I think will be possible, as it seems that I'm in a lucky situation because the Mega 2560 has a lot of I/O pins (54 digital pins + 16 analogue pins = 70 pins in total). That gives me enough pins to create the 8x8x8 cube with multiplexing.

Usually what people do is to connect the anodes of all the LEDs which are above each other, obtaining 64 columns and to connect the cathodes of all the LEDs which are in the same horizontal plane, obtaining 8 planes. This way you can light up the LEDs using multiplexing and you need 64+8 pins. But even the Arduino Mega 2560 does not have that many pins, so I had to find another way. And there is a pretty simple way to reduce the number of pins: divide each horizontal plane into two half planes. This way you will only need 64/2=32 pins to connect to the anodes and 8*2=16 pins to connect to the cathodes, a total of 32+16=48 pins! Well, the multiplexing software will have to handle the special kind of multiplexing which uses half planes, but that's OK (I've never written software for Arduino so far, but I'm confident that I can do it, I have more doubts about the hardware part :) ).

Based on the above approach, the LED cube can be made by dividing the cube into 16 zones (half planes). The anodes of the vertical LED columns are all connected together and the 32 resulting column groups are connected to a digital Arduino pin. The cathodes in each of the 16 half planes are also soldered together and each such group is connected to an Arduino digital pin. These 16 half plane groups are multiplexed from software, meaning that at any given time the current can only run through one half plane and the 16 half plane pins are switched very fast one after the other. Persistence of vision makes it possible for humans to see the cube as if all 16 half planes would be lit up at all times. This is the theory. To light up a given LED in the 8x8x8 matrix, we would have to pull the appropriate anode pin high and the appropriate cathode pin low, if I understood this correctly from other similar projects.

In theory it is that simple. In practice, however, it is far more complicated because of the Arduino's current limitations (global current limitation and per pin current limitation). I think the total current limitation of the 5V rail is 50 mA and in addition each pin has a maximum limitation of 40 mA. So it's clear that I'll need to power the LED cube from an external power source and that I'll need to add some transistors between the Arduino and the actual LEDs. I will use the signals coming from the Arduino pins to switch the transistor inputs and the transistor outputs will switch the actual, higher power LEDs. And this is the point where things start to become unclear to me. As we have established above, at any given point in time only one half plane should be lit up. that means that in the worst case 32 LEDs should be on at any given time. But as we all know, the multiplexing software can have bugs, which is likely to happen since it's my very first Arduino software. That means that we need to assume the worst: that it could happen that al 512 LEDs light up at the same time. That means quite an amount of current and we'll need some kind of hardware protection to limit the current and to protect the Arduino from such dangers.

But how much maximum current will be flowing exactly through the LED cube at a given time? To determine that, the fundamental question to be answered is: how much current is needed by a single LED? I'm planning to use standard superbright 5mm LEDs. Their datasheet states that they should be operated at 20 mA and people use this value most of the time. However, I have found that giving those LEDs 20 mA is a complete and utter waste of current. I've done some experiments and those LEDs are very bright even at 0.5-1 mA! Surprising, but true. SO I plan to limit the current through each LED with a resistor of appropriate value to 1 mA. I hope this can work with multiplexing (fast on/off switching of the LEDs), not just when the LEDs are continuously on. Please let me know what you think about this. If this can work, then at any given time no more than 32 mA should flow through the cube, or if the software has a bug and all LEDs light up, no more than 512 mA. Now this even questions the need to use transistors between the Arduino and the LEDs. The digital pins connected to the anodes would only be supplying 1 mA each and the digital pins connected to the cathodes would only be sinking 32 mA each. I'm thinking that I could add resistors to the anodes to limit the current to 1 mA and resistors to the cathodes to limit the current to 32 mA, for safety. Is this safe enough? Would this work?
If the above suggestion is unsafe, I plan to use ULN2803 ICs for switching the LEDs based on the signal coming from the Arduino pins. If I do this, I don't know if I should add current limiting resistors between the Arduino pins and the ULN2803 input legs, or the ULN2803 chips already include some current limitation mechcanism which will make sure that the current flowing through each of the Arduino pins and the total current flowing through all the Arduino pins is small enough. Between the ULN2803 output legs and the LEDs I plan to add current limiting resistors which would limit the current through each LED to 1 mA. Also, if I'm going for the ULN2803 based approach, I'm still thinking of avoiding an external power supply and taking the current from the Arduino's 5V rail. I'll still need to add a resistor to limit the total current taken from the 5V rail to a toal of 32 mA, in case the software goes nuts and turns on all the LEDs.

What do you think of my approach. Is this achievable at all? is it oversimplified? As I said in the beginning, I want to keep it as simple as possible, but I do not want to endanger my Arduino board in any way, so hardware protection against too big currents is a must have in all possible ways.

Thanks in advance for any good advice you might be able to give me!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: retrolefty on Dec 26, 2012, 06:05 pm
Quote
What do you think of my approach. Is this achievable at all? is it oversimplified? As I said in the beginning, I want to keep it as simple as possible, but I do not want to endanger my Arduino board in any way, so hardware protection against too big currents is a must have in all possible ways.


My advice is:

Start with a smaller cube, say 5x5x5. You will learn a lot about both the electronics and the software that will put you into a much better chance at being successful when you scale up to 8x8x8 cube.

Your desire to not use shift registers is a poor choice and makes your project require more components and complexity then it needs to. There are special 16 bit serial shift registers that also include programmable constant current outputs that solve the led current control problem. Datasheet: ( http://www.onsemi.com/pub_link/Collateral/CAT4016-D.PDF )  I can't emphasize how much simpler the whole project becomes when using these special shift register/driver chips then if you instead try some other method of current control for the leds. You will need an external source of +5vdc to power the cube, but it will only need to be rated at about 2 amps max output current capacity (64x.02A = 1.28 amps)

Be sure to buy 'diffused' leds as their wider dispersial of light gives a much better effect then narrow beam brighter leds.

Here is a very good led cube project page where you can learn a whole lot before committing to buying stuff. While it's based on using a PIC micro chip the hardware design is 100% applicable to an arduino based project. I used their basic design for my arduino (actually a standalone 328p chip ) driven 5x5x5 blue led cube and while challenging from both a construction point of view and software design (I wrote the sketch from stratch) it was successful from the git go. 

http://picprojects.org.uk/projects/lc/index.htm#Description

Once completed I think you will find the biggest challenge is coming up with creative and complex pattern displays. I found this very tedious and time consuming and stopped after building maybe 6 or 7 pattern scripts. What is really required is some kind of PC based GUI led pattern generator editor where you can build your pattern frame by frame and then get the raw binary data patterns that you can copy and paste into your cube sketch.

Lefty



Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 26, 2012, 06:51 pm
I would agree with lefty that you should really start smaller, 8x8x8 is a lot, really a lot. You will have to complete many stages of the project before you understand why not do do something a specific way, but by then you will have used up 500 leds, and have  a huge mess.

I would suggest starting with a 3x3x3, you can probably build one and get it working within a day, it will only waste 27 leds, you wont really need other hardware (should also use 9 resistors), so you can focus on learning how to build a cube, which itself is fairly difficult.

I would then progress to controlling the cube with serial data instead of parallel data. This will mean using shift registers or LED driver.  I did an instructable about converting parallel to serial with shift registers, it might be useful http://www.instructables.com/id/4x4x4-LED-cube-upgrade-with-Shift-Registers-74hc5/  (http://www.instructables.com/id/4x4x4-LED-cube-upgrade-with-Shift-Registers-74hc5/)

You may want to charlieplex your cube, this will probably reduce the number of pins to where you can control it with a mega. By my calculations you will need a minimum of 24 pins to control 512 LEDs using charlieplexing. Charlieplexing is a bit difficult because it requires that some LEDs face one way, while others need to face another way, so building is a little more difficult. It also takes advantage of tri-state micro-controllers, so programming is a bit more difficult too.

Besides Persistance of Vision, and Multiplexing, you also need to think about duty cycle. If you have a 4x4x4 cube, you will have a 25% duty cycle (no LEDs will be on longer than 1/4 of the time), with an 8x8x8 you usually have a 12.5% duty cycle which may make things dramatically dimmer than you think. If you split your planes into 2 planes of 32 LED, then you will have a 6.25% duty cycle, pretty low! That may not work out too well, it would be best to test that before building 500 LED cube.

The other real problem with spliting the plane is that each plane creates dimensional stability, if you split the plane, you are splitting the cube into 2 rectangles that may not be as dimensionally stable.

There are many ways to skin that cat, and I've just mentioned the more common ways that I have seen.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 26, 2012, 09:34 pm
You might want to look at the MAX7219 chip. That multiplexes 64 LEDs:

http://www.gammon.com.au/forum/?id=11516

It's not particularly cheap, from memory, but it could save you buying a lot of transistors and current-limiting resistors.

The chip does its own current limiting, and its own multiplexing. Since it uses SPI you could add additional chips, using only one extra SS line for each additional chip.

My personal advice would be to start smaller initially, just get comfortable with coding on this platform, using LEDs, resistors, current flows etc.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 27, 2012, 12:32 am
Hi Guys!

First of all, thank you for your replies!

I've read the suggested articles. The one that has really caught my attention is this one:
http://www.gammon.com.au/forum/?id=11516 (http://www.gammon.com.au/forum/?id=11516)

It's a very good explanation of how the MAX7219 chip can be used to drive a 8x8 LED matrix relatively easily. This is not the first time I've read about the MAX72XX chips, but the articles I have found in the past were not as friendly as this one and they did not explain how to program the MAX72XX chips, so I just threw that information away because I did not really understand it. Now, on the other hand, I think I do understand it. The wiring diagram is pretty clear and also the programming examples are easy to understand.
I did a quick search on eBay and found that you can buy 10 pieces of MAX7219 for about 5$, which is quite cheap. I'm very tempted to go for this approach.

Starting out with a smaller LED cube (3x3x3 to 5x5x5) is probably good for practice and I'll probably regret not taking your advice and doing it, but somehow I feel that 'll go straight for the 8x8x8. First of all, creating a bigger LED cube (just the LED cube, not the additional electronics) is just a matter of exponentially more soldering, right? Second of all, the MAX7219 is designed to drive exactly 8x8 LEDs which are exactly the number of LEDs needed in one layer of my 8x8x8 cube, so why not go for the real thing from start? If at this point you feel that I'm making a huge mistake and that there are a lot of problems with a big cube and that I need to experience some failures with a smaller cube first, please outline a few of those, maybe I'm not seeing something important here after all...

OK, so let's assume for a second that I'll build that 8x8x8 cube (sooner or later I will, I hope :) ). Let's also assume that I'll use MAX7219 chips to drive the LEDs and to make my life easier :) I have a few questions related to this solution:

1. What would you recommend to consider a layer in the cube? Would you drive each horizontal plane of the cube (8x8) with a MAX7219 or would you drive each vertical plane which faces the "front" of the cube with one MAX7219. In other words, would you divide the cube into layers horizontally or vertically? This is an important question. If one would like to display text (letters) in the cube, which face the "front" side of the cube, programming would become a lot easier if the layers were vertical. On the other hand, for generic animations, I get the feeling that dividing the cube into horizontal layers would be more practical...
2. The following wiring diagram: http://www.gammon.com.au/images/BL-M12A881_e.png (http://www.gammon.com.au/images/BL-M12A881_e.png) shows that 3 pins are used from the Arduino to communicate with the MAX7219: MOSI (D11), SCK (D13) and SS (D10). Now this is great if you only have one layer of 8x8 LEDs. But I need 8. Which additional pins would I use in this case? I get the feeling that pins D11, D13 and D10 are part of some special group on the Arduino and that they are used for some special protocol. If so, how could I use 8 groups of 3 pins to communicate with 8 MAX7219 chips?
3. Again, using 8 layers (8 MAX7219 chips), how would I need to modify the code from the article to talk to each of the MAX7219 chips? When you have only one layer (one chip), the code looks like this:
Code: [Select]
void sendByte (const byte reg, const byte data)
  {   
  digitalWrite (SS, LOW);
  SPI.transfer (reg);
  SPI.transfer (data);
  digitalWrite (SS, HIGH);
  }  // end of sendByte


How would I modify this to be able to talk to the layer (MAX7219) of my choice?

I'm also thinking about whether I should use standard clear white LEDs or diffused ones. retrolefty pointed out that diffused ones look much better when turned on. I've never actually seen a diffused LED until now, but I believe you :) However, clear LEDs are brighter (is that good or bad?) and look a lot more elegant when turned off. Also, I'm thinking that the luminous flux of standard clear LEDs is usually higher, so maybe I can drive them with less current (as I wrote, in my experience 1 mA is more than enough when continuously lit, but multiplexing might make a difference). Luckily the MAX7219 chips need a single resistor to specify the current running through all the 64 LEDs, so I'll only need a total of 8 resistors for this purpose in the entire cube. I'll add lower value resistors calculated for 20 mA through the LEDs and I'll add variable resistors in series with the regular ones, to be able to modify the LED currents and turn them down to 1 mA. How the resistor value can be calculated for a given current value, I don't know. I've seen some tables somewhere, but those tables  were only considering current values of 20 mA and 10 mA, they never went down to 1 mA...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 27, 2012, 02:57 am
Quote

What would you recommend to consider a layer in the cube?


Can't you just turn the cube? If not, I would probably have a layer be one letter (depending which way the letters are going to face). It's probably not critical.

Quote

But I need 8. Which additional pins would I use in this case?


You parallel up MOSI and SCK for all 8 chips. Then you use one SS line for each chip (ie. pins 10, 9, 8, 7, 6, 5, 4, 3). However looking at the datasheet the chip has a DOUT pin (pin 24) which is for daisy-chaining.

What you could possibly do (although I haven't tested this) is to parallel up SCK and SS, and then feed DOUT from the first chip to DIN on the second (and so on for second to third, etc.). Then you could use just 3 wires for the entire lot.

You would then bring SS low, clock out all the bytes and bring SS high to latch the lot. The datasheet says "The last 16 bits of serial data are latched on CS's rising edge.".

So, you send out 16 bits (2 bytes). It goes into the first chip. Keeping SS low, you send another 16 bits. The first 16 leave the first chip and get clocked into the second. Then you do the third 16 bits. Now the bits end up in the third chip. And so on. So 16 bytes later (16 x SPI.transfer) you have set up one row for each of the 8 chips. Then you latch, and that row gets committed. Repeat for the next row, and so on.

I haven't tried that (I don't have enough patience) but clearly the design is supposed to allow for that. Effectively you could set up any number of chips in sequence like that, but only need 3 data lines from the processor, no doubt which is what they intended.

Quote

Again, using 8 layers (8 MAX7219 chips), how would I need to modify the code from the article to talk to each of the MAX7219 chips?


As I described above.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 27, 2012, 02:58 am
Quote

What would you recommend to consider a layer in the cube?


You probably set up in memory the bit pattern for all 512 bits anyway in an array. How they are physically wired is not critical, it would just be whether you go through the array X direction first or Y direction first.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 27, 2012, 09:49 am
Thank you for this information! :)

I have found another article somewhere (http://playground.arduino.cc/Main/MAX72XXHardware (http://playground.arduino.cc/Main/MAX72XXHardware)) which seems to confirm what you just mentioned:
- Parallel the CLK and CS(Load) for all the MAX7219 chips (I guess we also call these two SLK and SS)
- Take the DOUT from one chip to the DLN of the next chip

And using just 3 wires to communicate with the whole thing? Wow, that's impressive!

There's one thing I'm not sure I understand in your explanation about how to program the whole batch of chips. You say that if I send packages of 16 bits multiple times, the bits are pushed from the nearest chip to the next one every time a new package is sent while SS is kept low. This is clear and wonderful. But you also wrote "Then you latch and that row gets committed". What does it mean to latch?
Sorry if I ask such beginner questions, but as I wrote, my knowledge in this area is merely starting to develop and I'm having a hard time understanding some of the basics...

As for how to divide the cube into layers, I guess you are right, it doesn't really matter that much, the software can handle it either way.

I don't really where to buy the MAX7219 chips from. As I wrote earlier, I found them on eBay, where you can buy 10 pieces for 5$. That would be nice, but I've read that they are not original and that must be true because Maxim is selling them for a lot more. I've also checked them in a local electronics parts store and here I could buy original ones, 10 pieces for 40$... I wonder if it's worth buying the original ones...

Thank you!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 27, 2012, 10:00 am
I've juts realized that the fact that driving the LEDs with MAX7219 chips in such a simple and elegant fashion has a price to be paid during construction of the LED cube. If I drive each horizontal plane of 8x8 LEDs with one MAX7219, I'll need to have 16 wires go to each horizontal plane, I no longer have the advantage of connecting the vertical legs of each column together and sending signals through that... It's going to get ugly... :(
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 27, 2012, 09:23 pm

But you also wrote "Then you latch and that row gets committed". What does it mean to latch?


When you bring CS (chip select) high the data is latched. That is, it is transferred from internal holding registers to the actual chip outputs, connected to the LEDs. Until it is latched you don't see it, so you don't notice the data being pushed from one chip to the next one, it is all internal.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 27, 2012, 09:27 pm

If I drive each horizontal plane of 8x8 LEDs with one MAX7219, I'll need to have 16 wires go to each horizontal plane, I no longer have the advantage of connecting the vertical legs of each column together and sending signals through that... It's going to get ugly... :(


I don't see how you can individually control 64 LEDs with less than 16 wires unless you use Charliplexing maybe, but that could be a bit difficult for 512 LEDs. Plus you need the 512 resistors then.

On this diagram for the 8x8 LED:

(http://www.gammon.com.au/images/BL-M12A881_i.png)

On the right, notice how 8 anodes are connected together and 8 cathodes? It will be tedious wiring 512 LEDs whatever way you look at it, but only 16 wires isn't too bad.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 27, 2012, 09:46 pm
So why not stick with your original plan:
64 cathode drivers, and 8 anode drivers.
Can be done with 9 TPIC6B595 shift registers and 8 PNP or p-channel MOSFETs.
8 of the 6B595's will drive the cathodes.
Each bit of the 9th 6B595 will be used to pull the Base/Gate of the Anode transistor low to turn the part on, pullup resistor pulls it high to turn it off.
83 cents each at avnet.com
Have to play with the timing, see if 9 SPI transfers will do it, or if need to turn the anode off, drive the cathodes, and then turn the next anode on to prevent ghosting. 9 SPI tranfers or 11, quick either way.
Lots of time available while watching millis() go by to update the 64  bytes that hold the array information.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 27, 2012, 09:53 pm
This board I sell will hold all the shift registers, you can not populate the '328 part of it and feed in your SPI controls signals from  your Mega if you wanted to.
They're all daisy chained, so you couldn't easily split the transistor driver from the other drives.
(http://www.crossroadsfencing.com/BobuinoRev17/12_digit_driver_board.jpg)

I used 2 of them, 10 shift registers each card, just passing power and the control signals along to the 2nd card, to drive this 5x20 display with no multiplexing:
http://www.crossroadsfencing.com/BobuinoRev17/Prototype_in_action.MOV
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 12:26 am
Thank you again for your replies!

Nick Gammon, in a theoretical sense you are right that 16 wires to drive 64 LEDs is pretty good. However, the LED cube is all about being able to see through it, about being elegant, about not seeing wires... I was thinking that I could cheat out half of the wires by dividing the cube not into horizontal, but vertical planes. Each MAX7219 would drive a vertical plane. This way 8 legs (all anodes or all cathodes) would go directly into the PCB beneath the cube, so only an additional 8 wires would have to crawl up along the edges of the plane. Dividing it equally, I could manage with 4+4 wires. Maybe I can buy some very thin wires and it would look nice. I wonder how thin is not too thin. I'm thinking that the resistance of the wires might matter...

CrossRoads, your idea is also tempting because I could create a cleaner (wire-free) and more robust cube. It also has the advantage that the cube would be made only by soldering LED legs together, as opposed to the MAX7219-based solution where I would have to find a way to make the cube more rigid by adding some non-conducting sticks between the planes, to hold them together. That would probably mean glueing.
What did you mean by "Lots of time available while watching millis() go by to update the 64  bytes that hold the array information." Were you suggesting that in the MAX7219-based approach needs a lot of time to fill up the registers?

You also wrote this:
"64 cathode drivers, and 8 anode drivers.
Can be done with 9 TPIC6B595 shift registers and 8 PNP or p-channel MOSFETs.
8 of the 6B595's will drive the cathodes.
Each bit of the 9th 6B595 will be used to pull the Base/Gate of the Anode transistor low to turn the part on, pullup resistor pulls it high to turn it off."
Is there a place I could find an exact wiring diagram for this? What about an example on how to program it?

As I wrote, I really am an amateur with high aspirations (the 8x8x8 LED cube). I'm struggling really hard to understand the answers you guys give me :) Because of this the MAX7219-based solution is more appealing to me. The chip takes care of LED currents, of multiplexing the LEDs. Also less components, less room for error. The only two problems with it are the price and the wires that would make the cube look less aesthetic... Because of this I'd like to try to understand the other solution too, with TPIC6B595 shift registers, but I need some diagrams and some programming example to see if I can work with it.

I really do appreciate your answers. Thank you!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 28, 2012, 04:22 am
How's this for a start?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 09:27 am
It looks understandable enough :) Thank you!
A few questions, though:

1. The micro controller on the left would be an Arduino. How would that be connected to the TPIC6B595s? Which Arduino pin would be connected to which pin of the shift registers?
2. For the 64 coulmns 8 pieces of TPIC6B595 are needed. In your diagram I see that pin 18 of each shift register goes to the next shift register. But to which pin of the next shift register?
3. Which input pins of the TPIC6B595s would be used and how exactly (how would they be connected to the Arduino and how would the 8 column driving shift registers be connected to each other) (In a sense this extends question 2).
4. For the 8 layers I would need 8 transistors. If I understand correctly, this is the part of the circuit which decouples the low currents used to get signals from the Arduino to the LEDs from the high currents that actually pass through the LEDs. You wrote above the diagram that each transistor must be able to handle 64*20 mA (makes sense as it switches 64 LEDs in a layer). Is there some packaged chip like the ULN2809 for example which could handle the whole cube (I mean that it contains 8 transistors, each capable of handling 64*20 mA)? If not what kind of transistor can do the job?
5. These shift registers don't do multiplexing. Does this mean that the multiplexing will have to be done from software?
6. How would you switch LEDs on/off with this hardware approach? How would you send data to the shift registers?

Thank you!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 01:51 pm
I'm wondering about what 5V power supply to get for powering the cube...
What would be the maximum current consumption of the two solutions when all the LEDs are turned on at full brightness (assuming we give each LED 20 mA of current)?

With the MAX7219 I saw something in the datasheet that it consumes 330 mA, but I wonder if that includes the current consumption of the 64 LEDs it drives or it consumes 330 mA by itself...

Any useful tips regarding the power supply?

Thanks,
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 28, 2012, 05:00 pm
1,2, 3: Yes, an Arduino. Connections would be via SPI as I previously described.
Specifically: D13/SCK to SRCK on all chips
D11/MOSI to SerDataIn on 1st chip, then SerOut goes to SerDataIn down the chain
D10/SS to RCK on all chips
SerClr/ to +5 on all chips
OE/ to Gnd on all chips. You could also experiment with connecting to a PWM output for dimming.
4. 64 * 20mA = 1.28A. I don't know of a PNP equivalent to ULN2803 that can do this.
I would suggest a P-channel MOSFET such as this
http://www.digikey.com/product-detail/en/NDP6020P/NDP6020P-ND/1055922
I also realize some resistors are missing. See corrected shematic below.
5. Yes, software does the multiplexing as I described earlier; one layer's transistor is turned on at a time while the cathodes are pulled low for on, and not for off.
Having each layer on for 4mS would yield about a 30Hz refresh rate.  Better results may be seen if the transistor shift register is seperately written from the cathode shift register, have to experiment some & see.
6. I  would keep the image of the cube in a 64 byte array, writing out 8 bytes at a time for a layer using SPI.

Cube would use 1.28A if a layer was turned full on at 20mA. 5V, 2A supply would be sufficient
http://www.dipmicro.com/store/DCA-0520

I suppose one could also use 4x TLC5940 or 4XWS2803 for the cathodes, and have PWM capability per channel. Have to send out more data tho, at least a full byte per column for 256 level brightness control. Vs just 8 bytes per layer & on/off only.

MAX7219, controls both the anodes & cathode, haven't thought of a way to multiplex that. Would think something like 8 transistors between MAX7219 and the anodes, or cathodes, of each layer to be able to isolate the control for that layer? Then have to control turning layers on/off in software and writing out data for each layer in software.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 05:48 pm
A lot clearer now. Thank you!
What is the role of those resistors that you have newly added and what would their value be?

Now that I think I'm very close to fully understanding both the TPIC6B595-based solution and the MAX7219-based solution I'm trying to evaluate the advantages and disadvantages of both:
1. The TPIC6B595 solution would only require a 2A power supply because the total theoretical current consumption is only 1.28A. The MAX7219-based solution needs at least 8x330 mA (2.64 A), so I'd probably need at least a 3A power supply, which are harder to come by.
2. The TPIC6B595 solution has cosiderably more components, it's easier to make a mistake and the software multiplexing must be bulletproof, otherwise it could accidentally turn on all layers, leading to a current consumption of 8x1.28 A. Software multiplexing would of course complicate the code in unnecessary ways, compared to the MAX7219 solution which only needs the bytes to be sent via SPI.
3. The MAX7219 solution is expensive, the TPIC6B595 is magnitudes cheaper.
4. The MAX7219 solution requires some additional wires to crawl up to all LED planes, making the construction a bit uglier, but I could come around that by putting the wires into two sets of 8 additional columns in the cube (with no LEDs, just wires). MAybe it would look acceptable. The TPIC6B595 solution solves this problem in a natural way by allowing the current to travel up the cathodes of the LEDs soldered together in 64 distinct columns.
5. The MAX7219 solution would make it easier to solder the LEDs together because the 8 distinct levels (planes) would need no contact. I could just add some non-conducting sticks in the end among these 8 distinct planes to make the structure more robust. For the TPIC6B595 solution, on the other hand, it's needed to solder all the LEDs together (cathodes to cathodes in 64 unconnected columns and anodes to anodes in 8 unconnected planes). Makes the soldering trickier.

Are there any other pros/cons for these two solutions that I don't see?

Thank you!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 28, 2012, 06:39 pm
I disagree with many of your assumptioms.
1.  MAX7219 multiplexes 64 digits. It has no more than 8 LEDs on at a time, thus not much more than 160mA if 20mA/LED is being used.
Additionally, 5V/4A supply is easy to find - I use this one in several projects
http://www.mpja.com/5-Volt-DC-Plug-Power-Supply-4A-Regulated/productinfo/18520+PS/
For my 8x32 display using 4 of MAX7219 and a Duemilanove, a 9V, 1A supply was used, drawing under 1A of power as all 5V current went thru the onboard regulator.
2. More components, yes,  but easier to assemble LED cube as all columns are connected, and all Layers are connected, thus just 8 wires need to be hidden away. With non-multiplexed MAX7219, need isolated layers and 16 wires per layer.
3. MAX7219 is $1.25/chip from taydaelectronics.com. TPIC6B595 is 83 cents from avnet.com, plus PNP or P-channel MOSFETS.  Seems comparable when totalled.
4. Agree with you on wiring. Don't know how you solve the cube stability while maintaining layer isolation.
5. There are many examples of LEDs cubes. The soldering together is less tricky than you think, there is just a lot of it.  Here is one of the best writeups I have seen.
http://www.jameco.com/Jameco/workshop/JamecoBuilds/4x4x4ledcube.html
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 28, 2012, 08:08 pm
That bobduino thing looks pretty cool. I've also seen a similar thing that was just shift registers, I think it was 8 of them, I cant remember for sure.

I have been working on documentation for 3 different RGB LED cubes, they all controll 64 RGB LEDs, but they do it 3 different ways.

I still have a lot of work to go, I have one cube up, and details about how what wires to use, how to prep them, and why.

I really think the split is a bad idea, It will require some kind of non-conductive structure in between. I dont see any good way to do this, it will only make things harder, and I think the results will be less than desirable.

I have seen carbon fiber tubes and plastic stuff at the hobby store, if you really must try some kind of non-conductive alternative, you might find something there. What you will find there is something called music wire, its hardened steel wire, and is very very stiff. Its harder than hell to solder too, but it provides a really sturdy structure, that will flex a bit, instead of bending and kinking. You can get very thin wire, that is stronger than bailing wire, and much much thinner, and harder to see.

You should really learn about Serial communication, like I mentioned in my other post. Transmitting the data (64 bits per plane most likely) Since you do not have 64 pins available, there is no way to do that with parallel, so you will need serial, there is no doubt (unless you were willing to entertain charlieplexing...) Since you are forced into serial, you really wont need a mega, but it has more memory, so that will be useful, but you really only need a few pins to do serial data transfer. Since you have so many pins available, you may elect to use one pin per plane, and 3 pins to serialize your data through. Since you will be doing some form of serial, you have lots of options, shift registers, LED drivers, you could even do a ton of resistors and transistors. Drivers come with a lot of different features, I've tried get my head around what things are important, and its confusing.

If you go with a constant current driver, like the TLC 5940, you can do it with 4 chips (each chip is 16 bit, and does PWM), You will need to source current to each plane, as the TLC chips are sink only, no sourcing.

If you use shift registers, the nice thing about them is that they can sink or source, so you could source using a shift register, and sink with something else. The downside is that they dont control the current, so the will need resistors.

Multiplexing chips probably wont work for you.

I havnt finished my higher power cubes, but you will need to sink or source current to your planes, I've done a little reading and it seems there are 2 common ways to do that, darlingtons or mosfets. Mosfets are preferred as they seem to be more efficient, especially when not being used (and your mosfets would only be used 1/8 of the time).

The current website im working on is about RGB charlieplexing cube, but you will find some useful info about building cubes in there. I would strongly suggest building a couple small structures with just a few parts, and actually complete something so you understand all the steps before you try to design your own process.

The most realistic way I can see building this cube is 8x64 setup, and common anode(planes) is the most versatile way, since you could use shift registers or constant current drivers.

https://sites.google.com/site/rgbledcubes/home/charliecube64 (https://sites.google.com/site/rgbledcubes/home/charliecube64)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 11:11 pm
Thank you again for your help, guys!

I'm thinking and thinking an thinking about which approach to take, but it seems that the more I know, the more confused I get :)

I must admit, the solution that appeals to me most at this time is to have 8 separate, unconnected layers, each driven by a MAX7219. It seems that the current consumption is not so bad after all and I'm hoping that the ones I can find on ebay (10 pcs for 5$) will do the job. I would not divide the LEDs into 8 layers the conventional way though. Instead of having the usual 8 horizontal layers, I'd have 8 vertical layers. This has several advantages:
1. Having 8 layers driven each by a MAX7219 requires 8x16 wires. Half of these would be connected to the layers directly from the bottom of the cube (because the layers would be placed such way that half of the required wires would face the bottom). This means that only 64 wires would be visible. These could enter the cube from the back of it (the side which is away from the viewer). Could still be messy...
2. By having these vertical plane layers, the weight of each layer would stand on the bottom 8 LEDs, so I would have to add just a few non-conducting sticks to strengthen the cube, maybe just at the top and around the middle, not everywhere. I'm not sure if this would look nice because the cube would be more transparent or it would look weird...

I guess the main reason why I'm trying to convince myself that the MAX7219-based solution is best is because it's the simplest from more than one perspective:
A. Less components to solder in the circuit.
B. Takes care of LED currents and even can be used to set brightness from software easily.
C. The software does not need to be aware of the multiplexing, the Max chips do it themselves.

Searching the Internet I have found that somebody has actually pulled it off with this Max7219-based solution applied to a 8x8x8 LED cube (http://hackedgadgets.com/2011/09/02/8x8x8-led-cube-powered-by-an-arduino/ (http://hackedgadgets.com/2011/09/02/8x8x8-led-cube-powered-by-an-arduino/)). Unfortunately, I must say that the result is not nice at all. I mean, I do respect his work, but let's face it, the usual LED cubes that we see are much more better looking. Those wooden sticks at the corners of the cube block the vision a lot and those wires at the back are just plain ugly. I'd hate to turn up with a result like that after who knows how many hours of work.

I've never thought it would be so hard to build a LED cube. There are solutions for every problem related to it, but none of the solutions is "perfect". You can only get some benefits by sacrificing others...
I'll try to think of solutions to go for the MAX7219-based solution and to get rid of the ugly wires and to solve the problem of non-conducting sticks between the layers. As much as I realize that most of the cube out there don't use this solution because of the disadvantages I have just enumerated, I don't dare to try the other solution. It just has too much room for error both in building the circuit and in the software part which gets more complicated by having to implement multiplexing. Also it's less foolproof. If the software messes up the multiplexing and lights up all the 512 LEDs, I don't know what's going to happen...

Like I said, the more I think of it, the scarier it gets... :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 28, 2012, 11:35 pm
Back to the TPIC6B595... CrossRoads, you laid it out so nicely for me, I just hate to waste that information, so I'm back to it again :) Looking at the diagram, the following additional questions have come up:

1. Should all GNDs be connected together (The GND of the Arduino, the GDN of the TPIC6B595s, etc.)?
2. What kind of resistors should be used?
3. What kind of capacitors should be used?
4. You recommended NDP6020P MOSFETS for the transistors. In their datasheet the leggs of the NDP6020P are marked G,D,S. Which of these leggs go where in the diagram?
5. You wrote that if the software multiplexing turned each layer on for 4ms, it would lead to a refresh rate of 30 fps. Do you think that's good enough for the human eye?
6. You wrote that dimming could be achieved by connecting to PWM pins on the Arduino. But connecting what to the PWM pins?

Sorry if I'm asking the obvious again...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 12:23 am
"If the software messes up the multiplexing and lights up all the 512 LEDs, I don't know what's going to happen..."
Nothing. Any COTS switching power supply will just shutdown as it sees an overcurrent situation occurring, same as if you shorted the output.

Your latest questions:
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.

For the transistors, the base/gate resistor from the shift register is probably not needed (no need to limit current into the shift register, that will be set by the pullup resistor), and the pullup resistor can be smallish, say 220 ohm.

Caps are just 16/25/50V 0.1uF caps. I use these a lot
http://www.dipmicro.com/store/C5K10-50

P-channel MOSFET -
Gate connects to the shift register
Source connects to +5
Drain connects to the LEDs
(odd naming, I know).

30Hz - Movies were only 24 Hz for the longest time, and TV was 30 Hz.  Good enough?

PWM connected to OE/ on the shift registers could be used for dimming. I would connect to the cathode shift registers where there is less current flow.

You are making too much of the "multiplexing complexity" I think.
Code: [Select]

// some stuff you need anyway
# include<SPI.h>
unsigned long currentmillis();  // millis() and micros() are type unsigned long, 0x00000000 to 0xFFFFFFFF
unsigned long previousmillis();
unsigned long duration = 4;  // time in mS to display each digit
// declare other variables, and 2 arrays, one to hold the anode bit selection, one to hold the 64 bytes of the array

void setup(){
// do all the setup stuff, pinModes & stuff.
SPI.begin();
};

void loop(){
// start the multiplexing:
currentmillis = millis();  // capture the "time"
if ( (currentmillis - previousmillis)>=duration){  // 4 mS gone by yet?
previousmillis = previousmillis  + duration;  // set for next time check

x=x+1;  // break down anode for:next loop so it can run within the time check
if (x==8){
x=0;  // reset  after passing 7
}
// turn off existing anode (see note below)
digitalWrite(anodeSS, LOW);
SPI.transfer(0xFF);  // all 1s so no MOSFET is on
digitalWrite(anodeSS, HIGH);

// set up cathodes
digitalWrite (cathodeSS, LOW);
for (y=0; y<8; y=y+1){
SPI.transfer(dataArray[(x*8)+y]); // so 0-7, then 8-15, 16-23, etc., up to 55-63
}
// (perhaps ditch earlier anode write & pull later one back to here, so all shift registers are updated together with one SS pin?)

digitalWrite (cathodeSS, HIGH);

// now turn on one anode (see note above)
digitalWrite(anodeSS, LOW);
SPI.transfer(anodeArray[x]);  // Array holds B00000001,  B00000010,  B00000100, B00001000, B00010000, B00100000, B0100000, B10000000
digitalWrite(anodeSS, HIGH);  // with high = output pulled low

} // end time check

// do other stuff if desired while waiting for next time check, like receive serial data, update dataArray contents, etc
} // end void loop


This may need a little tweaking, but that's basically it.
I used seperate SS for the Anode vs the Cathodes, it may be that you can string them all together with one SS, have to play some and see which looks better.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 12:23 am
Yes, all GNDs get connected.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 29, 2012, 12:23 am
CrossRoads, doesn't your circuit require 16 wires per 64 LEDs? So the number of wires in the cube is the same as using the MAX7219? Or have I misread it?

The only way I can think of reducing the required number of wires to less than 16 is to use Charliplexing:

http://en.wikipedia.org/wiki/Charlieplexing

However that is quite complex. Also you still need 9 wires to control 64 LEDs (only a small saving).

Quote
For n pins, you can have up to n(n-1) LEDs in the matrix. Any LED can be lit by applying 5 V and 0 V to its corresponding pins and setting all of the other pins connected to the matrix to input mode.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 12:41 am
I think you are misreading the partial schematic.
Each common anode layer needs 1 wire.
The common cathodes need 64 wires, 1 per column, usually soldered to the PCB that makes the base of the cube.
72 wires total.
Vs  8 x 16 wires = 128, and connectivity not built into the array either. See the video that was posted in Reply #21.

Wish I had way more hours in a day to build one of these up.
I'd go for 9x9, have read having the center LED to pivot things around makes it look neater.
My 12-shift register board could drive it, be a bit of a software PITA spreading 81 bits + 9 anode control bits across 12 8-bit registers (96 bits).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 12:47 am
CrossRoads, thanks again! :)
Yeah, I guess I was making too big of a fuss about the software multiplexing, it's not the end of the world after all :)

One last "dumb" question: You mentioned some pull-up resistors which should be 220 Ohm. Which one are those in the diagram and what is their role?

I think I'm going to create my cube based on this diagram and based on your explanations. But I'll start with a 5x5x5 one. It's just too complex to aim for the big rabbit from start...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 12:50 am
I looked for TPIC6B595 on eBay and found TPIC6B595N only. I guess it's the same...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 12:52 am
The pullups go on the Gate of the MOSFET (or, the Base of the PNP, as currently drawn).

Start with 5x5, leave room to expand it to 8x8, need to use whole bytes anyway...

TPIC6B595N, N is the package type.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: nickgammon on Dec 29, 2012, 01:00 am

The common cathodes need 64 wires, 1 per column, usually soldered to the PCB that makes the base of the cube.
72 wires total.
Vs  8 x 16 wires = 128


Ach, you hardware guys always come up with cool ways of doing things! :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 01:05 am
Yes, indeed - but its always the software that actually makes it look cool when running!
For instance, I have no idea how to write the code that makes it do the vertical paddle wheel kind of rotation, or the bubble rise up thru the middle kind of thing.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 01:08 am
Well then, the theory is clear :)
All that remains to do is to order the components, wait 5 weeks until they arrive from China, solder them together and write the software :) Should be ready by spring :)
Too bad I can't buy the components here in Romania in some local store. Well, I could, but they'd cost 10 times more as sellers and stores are really greedy here.

Anyway, I know I've said this quite a few times already, but I'll say it one more time: thank you very much for taking the time and patience to explain this to me in detail. I've learned a lot from this discussion.
I'll be back with pictures and videos when I'll have something usable or perhaps with a few more questions even before that if things don't go well :)

Thanks!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Dec 29, 2012, 01:14 am
I have built a 5x5x5 cube which is not powered yet but, getting close.

For the wires that go to the layers, I used bare 24Ga. craft wire that I found in Walmart. The wire has a similar shine as the LED leads so, it is not as obvious that the wires are in the cube. Care has to be taken running the wires but, they work nicely.


Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Dec 29, 2012, 01:25 am
Let me know if you can see this image. At this point, I have only soldered the cube to the board. No wires have been ran yet in this picture.

(http://sphotos-a.xx.fbcdn.net/hphotos-ash4/430897_425483377523470_2030893301_n.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 01:32 am
I can see it :) Nice! Aren't those 5mm LEDs?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 01:48 am
Looks nice!

Andras, you can start writing software while you wait.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Dec 29, 2012, 04:14 am

I can see it :) Nice! Aren't those 5mm LEDs?


Yes they are 5mm diffused LEDs. I started with a 3x3x3 cube and made it work basically but, had one bad LED. I then bought 100 more LEDs and made the cube bigger to 5x5x5.

Here is where I got the LEDs. They did take around 3 weeks to arrive using the standard mailing option.
http://stores.ebay.com/LED-Wholesale-World/Blue-LED-/_i.html?_fsub=2777255010&_sid=1016205190&_trksid=p4634.c0.m322
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 09:28 am
Funny thing, I was looking at the same seller, only at his 3mm LEDs. I guess he has good prices. I'd like to use 3mm ones because it makes the cube more empty, more transparent, more visible (up to 5x5x5 it probably does not matter but when you get to 8x8x8 it does).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 10:57 am
CrossRoads, I have made a few modifications to your wiring diagram, to make it more understandable for amateurs like myself and to be sure that I have understood things well. I hope you don't mind.

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/cube_transistor_shift_register01_zps098bc35e.jpg)

The information I have added:
1. The polarity of the LEDs
2. The value of the resistors
3. The value of the capacitors
4. The type of the MOSFETs and which of their legs goes where
5. The connections between the Arduino and the shift registers

I have removed all the additional circuitry that was around the Arduino or other micro controller on the other pins because I thought that it's not needed. In other words the only pins of the Arduino that need to be connected to anything are D10/SS, D11/MOSI, D13/SCK and GND. I hope I was not wrong...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 11:17 am
Could you please suggest some other MOSFET instead of NDP6020P-ND? These are barely found and expensive on eBay and cannot be found at all in my town's local shops...

Thanks,
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 11:23 am
Also, do you think this power supply is good enough?
http://www.ebay.com/itm/5V-2A-DC-2-5mm-EU-Plug-Power-Supply-Adapter-Converter-Chager-for-Tablet-PC-/190705402077?pt=US_Server_Power_Supplies&hash=item2c66ed80dd (http://www.ebay.com/itm/5V-2A-DC-2-5mm-EU-Plug-Power-Supply-Adapter-Converter-Chager-for-Tablet-PC-/190705402077?pt=US_Server_Power_Supplies&hash=item2c66ed80dd)
It doesn't say that it's regulated, I don't know if that matters or not...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 12:12 pm
Or perhaps a 5V 3A power supply, might be good for future projects which need more juice:
http://www.ebay.com/itm/BRAND-NEW-5V-3A-AC-100-240V-DC-Switching-Power-Supply-Converter-Adapter-EU-Plug-/390494389454?pt=Multipurpose_AC_to_DC_Adapters&hash=item5aeb4784ce (http://www.ebay.com/itm/BRAND-NEW-5V-3A-AC-100-240V-DC-Switching-Power-Supply-Converter-Adapter-EU-Plug-/390494389454?pt=Multipurpose_AC_to_DC_Adapters&hash=item5aeb4784ce)
This one says that it's a "Switching power supply"...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 12:15 pm

Could you please suggest some other MOSFET instead of NDP6020P-ND? These are barely found and expensive on eBay and cannot be found at all in my town's local shops...


You'll probably not find a suitable P-channel mosfet in your local shops. I suggest you order them from one of the major component distributors. If you are prepared to use a mosfet in an SMD package, then the prices are much better, for example this one http://uk.farnell.com/taiwan-semiconductor/tsm2311cx/mosfet-p-ch-20v-4a-sot23/dp/1864586 (http://uk.farnell.com/taiwan-semiconductor/tsm2311cx/mosfet-p-ch-20v-4a-sot23/dp/1864586).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 12:21 pm
PS - the SMD mosfets will also switch faster and can be driven from the cheaper 74HC595 instead of the more expensive TPIC6B595.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 12:25 pm

Also, do you think this power supply is good enough?
http://www.ebay.com/itm/5V-2A-DC-2-5mm-EU-Plug-Power-Supply-Adapter-Converter-Chager-for-Tablet-PC-/190705402077?pt=US_Server_Power_Supplies&hash=item2c66ed80dd (http://www.ebay.com/itm/5V-2A-DC-2-5mm-EU-Plug-Power-Supply-Adapter-Converter-Chager-for-Tablet-PC-/190705402077?pt=US_Server_Power_Supplies&hash=item2c66ed80dd)
It doesn't say that it's regulated, I don't know if that matters or not...


It says it recognises a fully-charged battery and switches to a save mode, which is not what you want.


Or perhaps a 5V 3A power supply, might be good for future projects which need more juice:
http://www.ebay.com/itm/BRAND-NEW-5V-3A-AC-100-240V-DC-Switching-Power-Supply-Converter-Adapter-EU-Plug-/390494389454?pt=Multipurpose_AC_to_DC_Adapters&hash=item5aeb4784ce (http://www.ebay.com/itm/BRAND-NEW-5V-3A-AC-100-240V-DC-Switching-Power-Supply-Converter-Adapter-EU-Plug-/390494389454?pt=Multipurpose_AC_to_DC_Adapters&hash=item5aeb4784ce)
This one says that it's a "Switching power supply"...


Switching power supplies are always regulated.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 12:57 pm
Thank you!
I'd rather not go into the SMD area for now, though :) Keep it simple is my motto :)
Is there some other normal MOSFET instead of the NDP6020P that I could use?
What do you think of the power supplies?

Thanks!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Dec 29, 2012, 04:02 pm

Here is the mosfet that I used with the 3x3x3 and I think it big enough for my 5x5x5.  It is a ZVP2106A

http://www.diodes.com/datasheets/ZVP2106A.pdf
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 04:31 pm
@Un4seen,
I selected the MOSFET I did because it was the lowest priced thru hole part at Digikey with low Rds.
I don't search on e-bay as I find it a waste of time trying to search by characteristic.

Update your profile to show a country, lets see what you have for parameter searchable sources.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 04:43 pm


Here is the mosfet that I used with the 3x3x3 and I think it big enough for my 5x5x5.  It is a ZVP2106A

http://www.diodes.com/datasheets/ZVP2106A.pdf


The OP's schematic indicates that he needs to switch 1.28A, which implies that in order to keep the voltage drop and power dissipation low, the Rds(on) needs to be low. I suggest a maximum Rds(on) of 0.1 ohm, and that is what I looked for when I searched for suitable mosfets. The part you linked to is designed for 10V gate drive and even then it has Rds(on) of 5 ohms. So it isn't really suitable for this application.

I suggest either the mosfet that Crossroads selected, or the SMD part I linked to along with some SOT23 to DIP adapters such as these http://www.ebay.co.uk/itm/10pcs-SOT23-Dip6-Adapter-PCB-SOT-23-6-/360441877952?pt=LH_DefaultDomain_0&hash=item53ec0295c0 (http://www.ebay.co.uk/itm/10pcs-SOT23-Dip6-Adapter-PCB-SOT-23-6-/360441877952?pt=LH_DefaultDomain_0&hash=item53ec0295c0).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 05:11 pm
Wow,  10 pieces for $7.50  - that adds a lot to cost of the MOSFET!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 05:17 pm
Hi guys!

I've updated my profile to show my location, sorry about not showing it before.

I live in Romania, so have 3 options:
1. Buy from local stores, which have very high prices. For the NDP6020P-ND it's not an option at all, they don't sell it here and they can't even place an order to bring it from an international supplier.
2. Buy from eBay. It's cheap and usually there are plenty of items and sellers to choose from, but delivery takes a month.
3. Order from UK online stores which ship internationally. I've never done it so far because the cost of transport was ridiculously high when I looked for some items in the past.

Every time I try to solder together some circuit, I reach the same conclusion: I should move to UK :P
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 05:24 pm

Wow,  10 pieces for $7.50  - that adds a lot to cost of the MOSFET!


Unfortunately, yes - although SMD mosfets are so cheap that it still costs less than using a TO220 mosfet (but a lot more work of course).

One day I'll get round to sending an SMD adapter design off to Itead to reduce the cost. It would be useful to have boards that take 2 or 4 SOT23 devices too.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 05:25 pm

I live in Romania, so have 3 options:


Have you tried http://ro.farnell.com/ (http://ro.farnell.com/)?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 05:35 pm
Is Farnell expensive in Romania?
For a part like this?
I don't know what this price relates to in US dollars.
http://ro.farnell.com/international-rectifier/auirf4905/mosfet-w-diode-p-ch-55v-74a-to220ab/dp/1865604
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 05:36 pm
I bought a sheet of adapters like
http://www.ebay.com/itm/SMD-CONVERTER-ADAPTER-PCB-SOT-TO-MSOP-SIP-DIP-14-/270832318388?pt=LH_DefaultDomain_0&hash=item3f0edd37b4
Probably had like 20 each of the different adapters on it.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 05:37 pm
I have just tried Farnell. They sell it for about 2.5$, same as the Chinese eBay seller (which could be fake). They say it's coming from UK, so it would probably take less time. The problem is however, that they haven't got a user-friendly site and I just can't figure out how much the transport to Romania would be without trying to actually buy the stuff :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 05:38 pm

Is Farnell expensive in Romania?
For a part like this?
I don't know what this price relates to in US dollars.
http://ro.farnell.com/international-rectifier/auirf4905/mosfet-w-diode-p-ch-55v-74a-to220ab/dp/1865604


They sell the one you originally suggested for less, see http://ro.farnell.com/fairchild-semiconductor/ndp6020p/mosfet-p-to-220/dp/1017724?Ntt=NDP6020P-ND (http://ro.farnell.com/fairchild-semiconductor/ndp6020p/mosfet-p-to-220/dp/1017724?Ntt=NDP6020P-ND).

PS - 7.06 RON = 2.10066 USD according to xe.com
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 05:44 pm

I have just tried Farnell. They sell it for about 2.5$, same as the Chinese eBay seller (which could be fake). They say it's coming from UK, so it would probably take less time. The problem is however, that they haven't got a user-friendly site and I just can't figure out how much the transport to Romania would be without trying to actually buy the stuff :)


If you go through the order placement process, I think you will find the carriage cost (if any) added on before you get asked for your credit card details. It may be free, some of the stuff I buy from Farnell gets shipped form mainland Europe and I don't get charged extra. You may find there is a minimum order, it's GBP20 here in the UK for non-business accounts.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 05:45 pm
OK, I have figured it out :) 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 :) 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 :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 05:45 pm

I bought a sheet of adapters like
http://www.ebay.com/itm/SMD-CONVERTER-ADAPTER-PCB-SOT-TO-MSOP-SIP-DIP-14-/270832318388?pt=LH_DefaultDomain_0&hash=item3f0edd37b4
Probably had like 20 each of the different adapters on it.


That looks excellent, I'll order one.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 05:48 pm
Unfortunately, P-channel MOSFETs and PNP transistors seem to be pricey compared to N-Channel & NPNs.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 06:08 pm
From my point of view the biggest problem is not that they are pricey, it's that they are rare. Otherwise I could buy them here at home or on eBay :) I just talked to a friend and he says that Farnell only ships to Romania for companies, not for individuals. I'll have to check that out.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 06:18 pm
Okay, so can they ship to Un4Seen, Incorporated?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 06:20 pm
I just searched eBay for P-channel mosfets and got 156 results. The SMD ones are inexpensive, the TO220 ones cost a lot more and are mostly not logic level.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 06:21 pm
Might be worth trying RS as well, http://ro.rsdelivers.com/ (http://ro.rsdelivers.com/).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 06:23 pm

OK, I have figured it out :) 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 :) 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 :)


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 (http://www.ebay.co.uk/itm/20PCS-AO3401-SOT-23-P-Channel-MOSFET-TRANSISTORS-/150653948679?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item2313acd307).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 29, 2012, 06:26 pm
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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 29, 2012, 06:35 pm
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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 29, 2012, 06:39 pm
Yes, see http://www.aosmd.com/pdfs/datasheet/AO3401.pdf (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).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 10:41 pm
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 (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
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 29, 2012, 10:53 pm
Seems to be a logic level part
http://www.irf.com/product-info/datasheets/data/irf9540n.pdf

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
http://www.ti.com/lit/ds/symlink/tpic6b595.pdf

So as long as your LEDs have Vf <(5-1-.07) = 3.93V you should be okay.
Adust your current limit resistors accordingly.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 11:11 pm
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! :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 29, 2012, 11:24 pm
Hmm, are your sure you interpreted figure 2 (http://www.irf.com/product-info/datasheets/data/irf9540n.pdf (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
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 30, 2012, 12:04 am
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? :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 30, 2012, 12:14 am

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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 30, 2012, 12:34 am
I see... too bad :(
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
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 30, 2012, 12:54 am

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.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 30, 2012, 01:05 am
I understand. Well then, it seems that I've got two choices: buy some NDP6020P or accept that I need to use SMDs :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 30, 2012, 01:32 am
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
http://www.digikey.com/product-detail/en/MIC5822YN/576-2400-ND/1031176
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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 30, 2012, 06:27 pm


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?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 30, 2012, 06:33 pm

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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 30, 2012, 06:57 pm
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!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 30, 2012, 07:09 pm
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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 30, 2012, 09:37 pm
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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 30, 2012, 10:58 pm

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.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 30, 2012, 11:50 pm
I search for MOSFETs like this at digikey.com:

x-channel mosfet (P or N)
in stock
Fets-single
logic level
thru hole (for prototyping anyway)
sort by price (click on unit price)

scroll down past the 1,000 qty min buy parts to  the 1-lot, looking for a low Rds part,
which usually puts me at the start of the TO220 type parts.
Then I check to make sure the gate capacitance isn't ridiculous.

Right now, that search puts me at these two parts
p-channel - small list of parts, just 12 choices
http://www.digikey.com/product-detail/en/NDP6020P/NDP6020P-ND/1055922

n-channel, 18 pages of parts
after the price sort, right on the first page
http://www.digikey.com/product-detail/en/NTD5867NL-1G/NTD5867NL-1GOS-ND/2401422
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 30, 2012, 11:58 pm
Very nice explanation dc42! Now I understand why I need the MOSFETS that I need.
I bought the NDP620Ps from Farnell in the end: http://ro.farnell.com/jsp/search/productdetail.jsp?sku=1017724 (http://ro.farnell.com/jsp/search/productdetail.jsp?sku=1017724)

In the datahsheet we can see this:
"Features
-24 A, -20 V. RDS(ON) = 0.05 W @ VGS= -4.5 V.
                  RDS(ON) = 0.07W @ VGS= -2.7 V.
                  RDS(ON) = 0.075 W @ VGS= -2.5 V."

I hope that's good news. What confuses me is that you used Ohms for the unit of Rds(on) and the datahseet uses Watts. But I guess V=I*R and W=I*V, so W = V/R*V = R. W=R ?!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 31, 2012, 12:06 am
Data sheet says 0.05 ohm, right on page 1.
http://www.fairchildsemi.com/ds/ND/NDP6020P.pdf
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 31, 2012, 12:10 am
When I look at the datasheet, the characters that you describe as W are Greek omega-characters.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 31, 2012, 12:17 am
Rds(on) = 0.05 Ohms then, so it's good :)

Thanks!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 31, 2012, 12:38 am
For anyone else who might be interested in the future to build a LED cube based on this design, I've put together a component list with prices based on what I have bought for the project. I tried to buy the components as cheap as I could, most of them off eBay, but for many of them I have bought more than actually necessary, because they sell in bulk or because I wanted some spare parts. Here's what I got:

NDP6020P: 14 pcs 33.3 EUR (43.8 USD)
3mm diffused blue LEDs: 1000 pcs 19.4 EUR (25.5 USD)
TPIC6B595N shift registers: 20 pcs 9.3 EUR (12.3 USD)
1K variable resistors: 100 pcs 7.4 EUR (9.8 USD)
5V 3A power supply: 1 pcs 7.1 EUR (9.4 USD)
Craft wire 0.8mm 6m: 3 pcs 7 EUR (9.2 USD)
Jumper cables 40 PCS: 2 pcs 6 EUR (7.9 USD)
Capacitors (0.1 uF) + resistors (82R, 220R): 3 pcs 4.6 EUR (6.1 USD)
PCB 18x12 cm: 2   pcs 3.9 EUR (5.2 USD)
Female pin headers: 200 pcs 3.8 EUR (4.9 USD)
TO-220 heatsink: 10 pcs 3.4  EUR (4.5 USD)
IC sockets DIP-20 for TPIC6B595N: 10 pcs 2 EUR (2.7 USD)
Crocodile clips: 2 pcs 0.8 EUR (1 USD)
Total: 108 EUR (142.3 USD)

Sorry, I just can't get the data into a well-formatted table.

This does not include, of course, the price of the Arduino driving the cube or other miscellaneous stuff like soldering materials or the prices of some tools that you use for other projects too.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Dec 31, 2012, 06:23 am
Somehow I got lost on the math there DC. 1.28 * 1.28 = 1.6384, divide by 4 and you get .4096.
How do you come up with .5 watt?
He will need 8 mosfets, each one will run 1/8th of the time (12.5%), each one will need to be able to source between 0 and 1.28A. I see the 1.28 in there, and the 4 was from half watt times 8. So I see some of the numbers, and understand where they came from, Im still confused with the math, and where half a watt came from. it seems arbitrary. 

I tried crossroads technique, and came up with 7 P-channels, I started by searching "p-channel mosfet", then clicked a link that said Fets-Single, That displayed a page with many options, I selected logic level gate, through-hole, and then I scrolled the package column, and selected the TO-220-3

From there, I notice that all of the parts have many mOhm RDS (way way over .4 ohm), not even close to mOhms.
I dont know what a good/bad gate capacitance is, but I can only find gate charge, and input capacitance.

I can also see that the NDP6020 is rated at 60 watts, and if using 1/2 watt, Im guessing you wouldnt need a heatsink.
How many 20mA LEDs could you run on that mosfet?

Also $150 for the parts for a 8x8x8 cube sounds like a lot, but I havnt built a cube that big.

6 Meters of wire seems like a low estimate to me too, I bet you use over 8. what kind of wire is it? soft wire is very difficult, but harder wire is a bit easier, and ends ups being sturdier. I find very hard steel works the best. For cube building, and general keeping wires straight, thinner and softer are more difficult, thicker and harder are easier, but for soldering, thinner is easier.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 31, 2012, 09:09 am
Hi!

I'm planning to run 64 20 mA LEDs from one of those MOSFETS.
That price of 142$ includes components for the big 8x8x8 cube, but also for the small 4x4x4 learning cube and some spares. I guess that if I tried to but onyl as many components as necessary for the 8x8x8 cube only, I could have pulled it off for about 100$.

6m of craft wire is definitely not enough. But I have bought 3x6=18m, which is probably twice as much as I need. I do not know how soft or hard it is, I bought it blindly from eBay based on the suggestion of somebody who has already used the same or similar craft wire to build a LED cube successfully. It is 0.8mm thick and is sold rolled up, I'll have to straighten it before soldering.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: dc42 on Dec 31, 2012, 09:40 am

Somehow I got lost on the math there DC. 1.28 * 1.28 = 1.6384, divide by 4 and you get .4096.
How do you come up with .5 watt?


See reply #83. I suggested a maximum of 1W for a TO220 mosfet with no heatsink, and 0.5W for a mosfet in a smaller package.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 31, 2012, 02:29 pm
CrossRoads, is there a special reason why the LED cube that we've discussed here uses the cathodes as columns (64 cathode columns) and the anodes as planes (8 anode planes) and not the other way around? Many other cubes that I've seen use anode columns and cathode planes and it seems to be more practical that way because the anodes are 2-3 mm longer, which compensates for the fact that the LED heads are taller than wide, so the horizontal and vertical distances between the LEDs could be longer and still equal if we used anode columns and cathode planes. Is it possible to do this reversing of anode/cathode roles? If yes, how?

Thanks,
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 31, 2012, 05:53 pm
Cathodes as columns because the TPIC6B595 can only sink current, not source it.
I have not seen a shift register that is designed to source 20mA (and not running at the Absolute Maximum as many people use 74HC595) outside of the 74AC299P which I think is not procurable in DIP form anymore.  I bought a tube of them from Newark for not much when Newark was getting rid of the last of theirs.

I had not considered LED pin lengths - just figured cube dimension would adjusted to actual parts purchased, which no doubt vary by manufacturer.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Dec 31, 2012, 09:27 pm
Well, I'll sacrifice those 2 millimeters then :)
Thanks!

BTW, happy new year!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Dec 31, 2012, 11:51 pm
Thanks! Happy New Year to  you as well!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Jan 25, 2013, 04:43 pm
Finally all my parts for the LED cube have arrived (except some minor things that I can start without) :) I plan to start working on it soon, I will show you pictures when I'll have some results.
The only problem is that the LEDs that I bought seem to have very short legs. The Anodes are 18 mm and the cathodes are 15 mm. It will be a crowded cube...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Jan 25, 2013, 05:50 pm
I thought you were using craft wire? If you are using wire, you will be soldering the leads to wires, then clipping the leads.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Jan 25, 2013, 10:26 pm
My intention was to use craft wire only to strengthen the cube where necessary (diagonally relative to the LED anodes, inside the planes), but given the short legs, I might need to make the whole cube frame from craft wire. That would require twice as much soldering, though...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Jan 25, 2013, 10:32 pm
How do you keep from shorting things out with extra diagonal wires like that?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Jan 25, 2013, 11:35 pm
Well, all you have to make sure is that the craft wire inside the anode planes never touches any cathodes. The 64 (8x8) cathodes go down and all the anodes are soldered together in the same horizontal plane, including with craft wire. In other words, you solder the LED anodes together along the X axis. You strengthen the anode plane with craft wire along the Y axis (X and Y are in the horizontal plane) and the cathodes go down along the Z axis.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 01:17 am
I'm afraid I have very bad news :(

A few days ago I've started working on a 4x4x4 cube to see how I can build it, before I jump into the real one (the 8x8x8 cube). So I drilled a 4x4 matrix of 3 mm holes into a piece of wood to help me assemble the horizontal layers of 4x4 LEDs, filled the holes with 3 mm LEDs, cut the craft wire to pieces of appropriate length and set out to solder the pieces of craft wire to the LED anodes. Now this already turned out to be a huge pain. The craft wire is 0.8 mm thick and the LED legs are way thinner so it's close to impossible to hold them together with clips while you solder them together because the clips will only close to the thickness of the craft wire and will not be able to grab the LED legs properly. Because of this the building process was about 3-4 times slower than I thought it would be. I have wasted hours and hours trying to hold the LED legs together with the craft wire, while I was soldering them. Anyway, after about 8 hours of work I managed to  make 4 layers of 4x4 LEDs connected by their anodes into planes.

While I have built the layers, 2 LEDs burned out or something, because after testing the layers, they were not working anymore, even though they had worked before being soldered into the layers. I didn't think much of it at the time, I just replaced them with new LEDs. But the ordeal began when I tried soldering the cathodes together into columns. Holding the LED legs together with the craft wire was a pain, as usual, but that was the least of problems. After soldering the cathodes of 3 layers together  (into 16 columns), several LEDs started not working and instead they seemed to conduct electricity directly, without lighting up, which resulted in several LEDs lighting up instead of just one when I tested the intersections of layers and columns. In other words, when I put the multimeter's positive lead to layer x and the negative lead to column y, instead of having only one LED light up at (x,y), I saw 2 or 3 LEDs light up. This was not for all (x,y) pairs, just for a few. I managed to find some LEDs which did not light up at all, so I figured that they are the problem. I managed to solder them out and solder new ones in their place through very painful work. Imagine if this would have happened in the middle of a 8x8x8 cube, it would have been impossible to replace them. But the problems were far from over. While I replaced those LEDs, others have burned out. And so on, until I had to throw out the whole darn thing into the garbage. Hours of work gone.

Now the question is: what made the LEDs burn out in massive amounts?
1. My best guess is that they are burning out because of the heat from soldering.
2. My second guess is that perhaps the multimeter's diode testing mode is burning them out.
3. Is there any other explanation?

God knows I've tried to limit the soldering time to 3-5 seconds, with a few exceptions. I can't do it faster, the solder just won't adhere any faster. Maybe the soldering iron is too hot? I think it's a bit above 300 degrees Celsius, although it doesn't show the temperature, so I'm only guessing. Turning it lower seemed not to heat the solder fast enough and I had to keep the iron on the LED legs longer because of this, so it wasn't good either. I've watched several videos about how to solder properly and I'm using standard 40-60 rosin core flux, so I don't think the problem lies there.

This is such a disappointment. After spending 150-200 $ on components and who knows how much time on planning and soldering, I'm close to giving up the whole project because I just don't see how I could avoid these problems. This wast just a 4x4x4 test cube. If just one single LED fails in the middle of a 8x8x8 cube, I'm screwed and my whole work goes down the drain, so I'd rather not even start working on it. The only solution I can think of is to somehow solder the LEDs together with some non-traditional, cold soldering method. Honestly, I've never heard of such a thing, but hopefully it exists, otherwise the whole project is wasted.

Maybe the LEDs that I've ordered are poor quality and weak, maybe they can't take as much heat as regular LEDs? Or maybe I should try soldering at really low temperatures? I doubt that it would work. Maybe I'm burning them out with the multimeter's diode test mode? I don't know. It all seems really hopeless right now...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 06, 2013, 03:12 am
Ouch. Yeah, did I mention that soldering a 3D grid of LEDs is difficult?

To start, id make sure that the holes for the LEDs are big enough to easily slide the LEDs in and out, once they are soldered into a grid, it will be difficult to remove the grid w/out buggering up your LEDs.

There are many ways to prep the leads, and lay the wires, Its unclear how exactly you are doing that, if you can provide pictures, that might help.

The LEDs shouldnt be burning out, you may lose one or two, but a bunch is unusual. The thick wire requires a lot of heat, one way to prevent the heat from damaging the LED is to pre-tin the wire, then when you put it next to the LED, you just quickly reflow the solder with a little flux on the joint to keep things clean and happy. 3-5 seconds is a lot, but I've done worse. Good solder joints are typically take 1 to 2 seconds, but can vary depending on how much mass you need to heat. With the thick wire, hotter is better, I solder really fast, so I want the hottest iron I can find so that I get the heat in and out as fast as possible.

I just recently wrote this up about soldering.
https://sites.google.com/site/rgbledcubes/soldering

If you poke around you can find other good info about preparing parts and wires and stuff.
When prepping parts, the better job you do, the easier the soldering will be, Once you figure out how to prep your part well, the soldering will become easier, and you will also figure out how to prep your parts to make soldering easier. Basically, the more time you spend in prep, the less time you spend in soldering, so it pays for itself in time savings, and the better you do in the early steps, the better the end results will be, so its kind of a double win to spend the time prepping the parts.

The reason some LEDs lit and others didnt may be due to solder bridges or broken solder joints (shorts or opens) its hard to say from here.

Im building a cube that doesnt use craft wire, and I think its more difficult lapping 2 thin wires, than crossing wires in a solder joint. At least the lap solder joints are flat aluminum leads, which makes things a little easier.

If you have a heat gun, you might be able to use it to heat up the blob of leds and salvage some of them, and start over. The first cube I built was made with leftover flashlight LEDs that I salvaged when modifying flashlights. It was more difficult, bu it worked.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 11:25 am
Thank you for your answer :) Well, you did mention that soldering a 3D grid is difficult and I was prepared for that, but what I'm experiencing is way beyond difficult. It's just impossible to work like this. The 4x4x4 cube contained only 64 LEDs and about 10 of them burned out. Dealing with burnt out LEDs in the middle of a 8x8x8 cube would be absolutely impossible, so it's not even worth trying to build it until I can find a way not to burn out the LEDs.

You wrote that several LEDs lighting up simultaneously is due to shorts or opens. Well, there were definitely no shorts caused by LED pins touching wrong parts or by misplaced solder. The only way shorts could have occurred was through burned out LEDs. That was probably the case. I don't know what an LED does when it burns out, does it conduct electricity or not, but it seemed to me that it did. I can't imagine simultaneous light-ups being caused by opens. I mean in my LED cube each LED is connected to a single cathode column, so if I'm not touching that column at all (and I made sure of that!), how can the LED still light up when I'm touching a completely different cathode column with the multimeter's negative tester? The only way I can imagine it through some other burned out LED which conducts electricity...

I talked to a friend about this, who is skilled in soldering and he says that he has abused LEDs several times by soldering them for even 10 seconds, heating them up, etc. and they have never burned out... I don't know what to think. When I arrive home tonight, I'll start heating up some of my LEDs to see how they take the stress. I want to prove to myself that indeed heat is what's damaging them. Perhaps this is a very bad batch of LEDs and I should buy some others...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 12:26 pm
@Hippynerd: Nice article about soldering!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 02:37 pm
I've found a really nice experiment here:
http://books.google.ro/books?id=PQzYdC3BtQkC&pg=PA114&lpg=PA114&dq=leds+burn+out+during+soldering&source=bl&ots=8kWGijzk3H&sig=BA_OdSQzM9koZz9J2Vg3Wt-ofyk&hl=ro&sa=X&ei=EVkSUaOoDsKr4ATYnYCYCw&ved=0CFcQ6AEwAw#v=onepage&q=leds%20burn%20out%20during%20soldering&f=false (http://books.google.ro/books?id=PQzYdC3BtQkC&pg=PA114&lpg=PA114&dq=leds+burn+out+during+soldering&source=bl&ots=8kWGijzk3H&sig=BA_OdSQzM9koZz9J2Vg3Wt-ofyk&hl=ro&sa=X&ei=EVkSUaOoDsKr4ATYnYCYCw&ved=0CFcQ6AEwAw#v=onepage&q=leds%20burn%20out%20during%20soldering&f=false)

It explains how you can burn out LEDs while soldering. I'll try it today. I'm curious how fast they fry.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Feb 06, 2013, 03:47 pm
  @Un4Seen

When I built my cube, I tested each layer before assembling the whole cube. I also found the same problem, the layers were good until additional soldering occurred. Out of 125 leds I had 3 fail but, my build method probably used less heat.
 
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 04:16 pm
Yepp, that's exactly what happened! The layers were all fine on their own, but when I tried to put them together, all hell broke lose.
BTW, what soldering temperatures do you guys use? 250-300 Celsius degrees? Perhaps more? I've read in several places where people explain how to build an LED cube that they like to use "good hot irons" but only for a second or two. I find it impossible to be in and out in 1-2 seconds, so perhaps a less hot iron would make a difference without increasing the probability of cold solder joints.
I have to find a way to do the soldering with very low probability of burning out the LEDs, otherwise the 8x8x8 cube will put me in the loony bin.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 06, 2013, 06:48 pm
Personally, I like the hottest iron i can find, im not very patient, and sometimes i burn things, but Im the person that will have to fix it, so its not an issue for me. I think around 350c is my starting range, when i use temp controlled irons, I usually set them between 750-850F, usually in the 850 range. You probably dont want to go that high, because you really have to move quickly to avoid burning things.

You may have an ESD or EOS issue going on. I have had some strange grounding issues with my non-grounded soldering iron, It actually lit up LEDs(just a tiny bit) while I was soldering them. It maybe that you have something like that going on.

All LEDs are not the same, so it maybe that the ones you got are particularly sensitive. I would do some testing on the LEDs and see if you can cause failures, and try to figure out what not to do, before you ruin all your LEDs!

I tried to load up that page you linked, and it didnt load for me.

Make a new grid, and this time pre-tin the wire, make sure the solder is adhearing nicely to the wire, but just leave a little film of solder on the wire, not a glob. then when you solder your grid together, just reflow the solder. Flux is important because you want the solder to flow quickly, so you can get the heat off as fast as possible (1-2 seconds). The flux also helps prevent  "Ice sickles" so you dont accidentally short on anything. I have reflowed the solder many many times without destroying the part, so I know that they can take a lot of heat, but sometimes it may wreck them with only a few seconds of heat.

How are you testing your LEDs, maybe that is causing extra stress?

I dont know how your LEDs could light or not light when the should/shouldnt, but my only guess is a short/open situation. I think its possible for an LED to fuse, and create a short, but my guess is its usually an open.

I reloaded the page, and now it loads, so i'll look it over.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 11:24 pm
Hippynerd, you are so on the spot with your last reply, you couldn't have gotten it more right!! Let me explain...

I started playing with the LEDs tonight, to see how much heat they can take. I took a new LED of the very same type (from the batch used for the cube), I set my iron to 370 Celsius degrees (same as I used with the cube), gave the LED current, so that it would be lit up while I heat it to see exactly after how many seconds it goes out and started heating it... and guess what?! after 35 seconds of constant heating near the head of the LED still no sign of burning out. OK, so I tried it on the other leg for another 35 seconds at 370 degrees. Nothing. No damage. I repeated this about 5 times, abusing the poor LED in a barbarian way, but it's still fine, lights perfectly, no damage. I tried it with one more LED, same result. Heat does not seem to burn them out. At least not in 35 seconds. And I only solder them for 3 to 5 seconds, so that cannot be the cause. I was puzzled... So what the hack was burning them out?!

I went to the garbage can and dug out the 4x4x4 cube that I had tossed yesterday night and started de-soldering the LEDs in order to have more to experiment with. At some point I thought I saw one light up while I was melting the solder near it, but there was no current connected to it, so I thought I was hallucinating or something... but no... it happened again and again.

It turns out that when I touch my soldering iron to one leg of the LED and I put my finger on the other leg, the LED lights! It's a bit dim, but you can clearly see it light. And now comes the interesting part: it doesn't matter which leg I touch with the iron and which led I ground with my body. It lights both ways. I guess that the iron is leaking alternative current and that's why it lights. It's getting 50 Hz PWM current, that's why it's dim. So I started playing with it, touching one leg, than the other. After a few touches it went dead. It's burnt. I tried this with another 5-6 LEDs, but they are fine, I did not manage to burn them out, only the first one gave in. I guess some of them are more sensitive than the others...

This perfectly explains why more and more soldering of the cube burns out more and more LEDs. They are exposed to AC for longer and longer times and eventually they burn out. At first I thought that perhaps my wall outlet into which I had plugged the iron does not have proper grounding (the iron does have grounding), so I took it to another outlet in another room. The result is the same. If I touch the LED with it, it ligths (when I also ground the other leg with my finger).

Now the real question is: what is the problem with the iron? And is it just unsafe for the LEDs or is it also unsafe for me to touch? How can I get around this problem? Should I take it back to the store saying that it's not working properly? Or is this something normal? Assuming that this should not happen normally and that it's not just a problem with my iron, but a problem with all the irons of the same type, what kind of soldering iron should I get instead? What detail should I pay attention to?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 06, 2013, 11:37 pm
BTW, this is my soldering station: http://www.amazon.co.uk/Basetech-ZD-99-Compact-Soldering-Station/dp/B003A6B27Q (http://www.amazon.co.uk/Basetech-ZD-99-Compact-Soldering-Station/dp/B003A6B27Q)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: retrolefty on Feb 07, 2013, 12:37 am
Quote
Now the real question is: what is the problem with the iron? And is it just unsafe for the LEDs or is it also unsafe for me to touch? How can I get around this problem? Should I take it back to the store saying that it's not working properly? Or is this something normal? Assuming that this should not happen normally and that it's not just a problem with my iron, but a problem with all the irons of the same type, what kind of soldering iron should I get instead? What detail should I pay attention to?


Why don't you take a AC voltage reading between your iron tip and an independent path to your power ground when the iron is turned on and see if there is indeed some AC leakage voltage on it. Most soldering station irons have a positive direct ground connection to their body/tip as a protection against ESD damage, but yours sounds like it might have a defect or broken connection internally or something like that.

Most LEDs have a maximum safe reverse voltage rating of only 5vdc or so, and it doesn't take much current to damage a led that way, just apply reverse voltage above it's safe rating.

Lefty
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 01:43 am
Quote
Why don't you take a AC voltage reading between your iron tip and an independent path to your power ground when the iron is turned on


In other words take an AC voltage reading with a multimeter between the iron's tip and the grounding in the wall socket?
The iron doesn't need to be turned on the light the LEDs when touching them. I just needs to be plugged in.

I wonder if I can demand changing it in the store because of this... I mean, is this a defect or it's just a poor model?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: retrolefty on Feb 07, 2013, 01:47 am

Quote
Why don't you take a AC voltage reading between your iron tip and an independent path to your power ground when the iron is turned on


In other words take an AC voltage reading with a multimeter between the iron's tip and the grounding in the wall socket?

Yes
The iron doesn't need to be turned on the light the LEDs when touching them. I just needs to be plugged in.

Turn the iron on for the test, but no LEDs required, just measure for AC voltage from tip to ground while powered up. Obviously you can't leave your meter lead on the hot iron for too long.

I wonder if I can demand changing it in the store because of this... I mean, is this a defect or it's just a poor model?

Make the test first. I searched a little for this product description but can't find anywhere where it states it's a grounded iron tip or that it offers ESD protection which is the same thing.
Lefty


Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: John_Smith on Feb 07, 2013, 08:06 am
Using the soldering techniques described by some of the guys above (  pretinning the legs, and then just reflowing the solder whie holding the legs still until the solder goes a dull colour again )  I soldered over 8000 joints on my last project without losing one LED.

For my sins, I had to get 2 prototypes out before the PCB manufacturers opened after their Xmas summer holiday break ( everything shuts in South Africa for a month )  so I built them " dead bug " style.

During the days of boredome at the bench, I calculated that I had spent over 10 hours in total just holding the wires steady until the solder set !

Heres a pic of a couple of the 60 dead bug chips and LEDs     -  DONT TRY THIS AT HOME FOLKS !

(http://i.imgur.com/r3e19tG.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 08:40 am
Thank your for the replies, guys! I will do that test tonight, I'm curious what I will find.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 08:28 pm
Hello again!

I did some more tests and... I'm even more confused :|

First of all, I measured the voltage between the tip of the soldering iron and the wall socket's grounding. I've set the multimeter to 750 V AC and tried it. The result: 90 V! Wow! I know that there's no error in my measurement because I tried measuring the mains voltage with the very same settings and I got 230 V, which is the standard value here in Eastern Europe.
Next I took another old soldering iron, which does not have grounding. With that one I obtained 45 V.

You know that what I initially observed, yesterday, was that if I touch either leg of the LED with the tip of the iron and the other leg with my finger, the LED lit up (although it was dimmer than usual). So I thought to myself, let's try to ground the tip of the iron by connecting it with a wire to the wall socket's grounding. And this is when the real surprise came! The theory was that the current will not go through the LED, it will go through the wire directly to the wall grounding and the LED will not light up. Instead the LED lit up twice as bright! Remember that I was still touching the LED's other leg with my finger.
Next I completely took out the soldering iron from the equation. I just held one LED leg with my fingers and I connected the other LED leg directly to the wall grounding through a wire. The LED still lights up, although not as strongly as through the soldering iron.

So what is going on here? Am I producing electricity and it's flowing through the LED into the wall grounding? And for minutes and minutes, without an end? How can I be producing electricity constantly? OR is the electricity coming from the wall grounding and going into me?
I tried holding the LED and connecting the other leg to some other mass, like the radiator, that way it does not light. But if I connect one leg to myself and the other leg to ANY wall grounding in the apartment, it lights.

What's going on here? The only thing I can think of is that the wall grounding is not done properly and that it's leaking very small amounts of current at 90 V...

I'll try taking the LED into another home in a different part of town, let's see what happens.

What a stupid game of circumstances that lead to the destruction of my 4x4x4 cube!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 07, 2013, 08:42 pm
It sounds to me like you have grounding issue. One easy way you can make a good ground, is to connect a wire to your plumbing (this assumes you have metal plumbing that goes underground, or is somehow grounded. You might try using that as a ground for a power strip, and just use that power strip. You of course would need to very careful to not short anything that might cause you injury.

If you happen to have a long metal rod, you could hammer it into the ground to get a good ground, its kind of extreme, but it may suit your circumstances.

We use 120 here, and they have a tester that costs a few bucks, less than 10 I think, and you just plug it in the wall socket, and it tells you if things are wired properly. Its a fairly common tool, you may know someone that has one that you can borrow.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 07, 2013, 08:53 pm
boffin, Im a big fan of the deadbug style prototyping.

The hard part of building that circuit looks like the ribbon wire, that stuff isnt designed to be soldered, the insulation is designed for easy clean cutting with connectors. It shrinks way back when you heat the wire, you really need to pre-tin it, then trim the wire down after the insulation shops shrinking back.

Soldering LEDs without a board to hold them is a lot more difficult, and using some kind of jig to hold the parts while soldering really make a big difference in the end product.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Feb 07, 2013, 10:27 pm
Quote
One easy way you can make a good ground, is to connect a wire to your plumbing



Please, don't do that! Think bath tub and electric, not a good thing. Using plumbing pipes for ground is what used to be done in the past (in the USA) however, it can go badly wrong if the water pipe is not going to earth ground. Driving a ground rod into the earth (have said earth area checked first) is the safest method.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 10:38 pm
Diving a metal rod into ground is not an option because the apartment is on the 10th floor :)

Anyway, I've just tried the touch-the-LED-touch-the-grounding experiment in my parents' house. Here everything is fine (I got a quick pulse of light from the LED on first touch but nothing ever since - I guess there might have been some static electricity left in me or in the iron), so I decided to move the LED project here. I don't really have another choice. The grounding in the apartment where I've started the project is giving off current at 90 V, so it's dangerous for sensitive equipment :(

Good thing I managed to figure it out in time. I've only wasted 12 hours of work, about 70 LEDs and about 6 meters of good craft wire. Better like this than being sorry with the 8x8x8 cube.

Thank you all for helping me figure this out! I really appreciate your help.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 07, 2013, 10:47 pm
Yeah, you should probably check things out before hammering a rod into the ground, you could hit electrical, gas, or water plumbing!

Also, you should not take a bath with your soldering iron, or your other electronics, its not good for them, or you.

Since you mention that you are in an apartment building, there is little that you can do You can check to make sure you are getting a good ground with a previously mentioned device. You can ask your landlord about it, maybe there is something that they can do?

You may also be able to use some plumbing for a good source of ground.

Now is probably a good time to learn about ESD, and EOS. You and other objects can store up and discharge quite a lot of electricity (like a million volts under some circumstances). You dont need a million volts to destroy sensitive electronics, you can happily destroy stuff with much lower voltages that you wont ever feel. You have probably been giving them LEDs a bit of EOS while messing around with them, but LEDs seem not too sensitive to ESD.

ESD = Electric Static Damage = Part destroyed
EOS =Electrcal Over Stress = Part weakened.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 11:06 pm
Don't worry, I'm not going to take a bath with my soldering iron :P

I just got myself a pair of thin rubber gloves. No more EOS for the LEDs ;)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 07, 2013, 11:10 pm
Good ESD techniques usually mean constant grounding (usually though a high value resistor), rather than insulation. insulation keeps you from discharging, and it means that it builds up until voltage levels get  high enough to arc.

Good grounding is probably what you want, insulation usually turns you into a bigger capacitor.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 11:36 pm
Okay... but should I ground the soldering iron, the cube or myself? I'm figuring that I shoudl ground myself because the static electricity may build up in me and if that is grounded through the iron, it will go through the LEDs unti;l it gets to the iron...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 07, 2013, 11:44 pm
On a different matter now...
Last time we talked about the driving circuit, it looked like this, or at least this is what I understood:

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/cube_transistor_shift_register01_zps098bc35e.jpg)

I'm hoping that CrossRoads still reads this topic...
Can somebody please help me clarify the following things:

1. What should the value of the resistors between the G and S pins of the NDP6020P-NDs be? I remember CrossRoads mentioning at some point that they could be left out (these resistors). I don't know if that's healthy or not because I don't understand the role of these resistors. Or maybe he meant that the resistors between the anode-driving TPIC6B595 shift register and the G pin of the NDP6020P-NDs is what could be omitted and those 220 Ohm resistors should actually be between the G and S pins of the NDP6020P-NDs?
2. If the target current for each LED is 20 mA, have I calculated correctly the valu of the resistors that go to the cathode columns (56 Ohm)?
3. Is there anything missing from the diagram?
4. Is everything connected as it should be?

I'd really like to be sure that the diagram is 100% correct because this is what I'm going to base my driving circuit on and I reall think I've had enough unpleasant surprises :)

Thank you!
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 08, 2013, 12:36 am
I could be mistaken but I think your 56ohm resistors should be closer to 100 ohm (or maybe 91?) assuming you are running them at 5v, and VF 20ma is at 3.3v.

I cant help you with the other stuff...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 08, 2013, 09:24 am
Yes, but I think the value of the LED resistors should not be calculated for a voltage of 5V-3.3V because there's some voltage drop across other components too, just not sure how much and where...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 08, 2013, 10:51 am
I've studied things a bit more and I think there might be some problems with my diagram.

This is my diagram (modified version of CrossRoads' diagram):
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/cube_transistor_shift_register01_zps098bc35e.jpg)

And this is CrossRoads' original diagram:
(http://arduino.cc/forum/index.php?action=dlattach;topic=139146.0;attach=32250;image)

There are a few things that I think may be wrong:
1. The 220 Ohm resistors should not go between the shift register (TIPC6B595) and the MOSFET (NDP6020P-ND). Instead there should be no resistor between the shift register and the MOSFET, the 220 Ohm resistors should be between the G and S pins of the MOSFET (they are what they call pull-up resistors). I think...
2. If you look at CrossRoads' original image, there are some resistors and capacitors connected to pins 7,1,9,10,21,20,22,8 of the Arduino. I removed those, thinking that they are not needed. Now I'm not so sure anymore...
3. I still wonder about what value is needed for the cathode resistors if I want 20 mA per LED and the LEDs drop 3.3V from the 5V that is available. The question here is if the MOSFETS or something else also has a voltage drop that needs to be taken into account and if yes, how much.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 08, 2013, 09:26 pm
Hopefully crossroads will clarify things, but i seems to me that the i/o>gate resistors were probably from using pnp transistors, and if you are using logic level mosfets, you probably dont want a resistor there, but I think the gate>source resistor is to help it shut off, so it can switch faster. but Im a bit confused about many things transistor...

Check your calculations on your led resistors, I bet you are set for 30ma, not 20.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 08, 2013, 11:12 pm
Thanks, Hippynerd! You've helped me a lot lately :) When my final 8x8x8 LED cube will be done, I will symbolically dedicate one of it's LEDs to you :) Another one is definitely for CrossRoads and the rest of you guys who have given me so many useful bits of information should also get one :) I guess I'm talking nonsense here, but hey, it's my way of expressing gratitude.

So back to the hardware, I agree with you. The gate-source resistors are needed as pull-up resistors (I've just learnt today what that means). The resistors between the shift register and the mosfets can probably be left out, as CrossRoads said earlier.
As for the LED cathode resistors, I think the safe way to go is to calculate their value based on a voltage of 5V - 3.3V (5V comes from the power supply and 3.3V is the voltage drop across the LED). With a target current of 20 mA, we get 100 Ohms for the resistor value (http://led.linear1.org/1led.wiz?VS=5;VF=3.3;ID=20 (http://led.linear1.org/1led.wiz?VS=5;VF=3.3;ID=20)). Even if the mosfet drops an additional 0.5V (which I don't know, I'm just assuming the worst here), with 100 Ohm resistors the current passing through the LEDs will be about 13 mA, which should be well enough for the LEDs to work properly.

I've done some experiments a few months back with some standard 5 mm white and blue LEDs and they give up pretty strong light even at 0.5 mA. I don't know if that's still true when they are switched very fast. I don't know if their turn-on time is affected by the intensity of the current. I guess we'll find out :) Anyway, for the 4x4x4 test cube I will include some variable resistors in line with the 100 Ohm resistors to see how much I can reduce the current without affecting the cube's light levels too much. This way, wehn I build the real cube, the 8x8x8 one, I might be able to use resistors which will reduce the current values much and this way the cube's power requirements will be significantly lower.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 09, 2013, 02:05 am
The Gate-Source pullup resistors, 5K should work well. Provides 1mA of pullup curent.
The Arduino-Gate resistor, 220 ohm , will pull the gate good & low. Vg will be ~5V*220/(5000+220) = 0.2V.

The LED current limit resistor:
(5V - Vce-pnp transistor - Vf-led - Vds-shift register)/(current-desired) = R
So an example might be:
(5 - 0.5 - 3.3 - 0.08)/20mA = 56 ohm
0.5 & 3.3 are my speculation, dependent on the parts selected.
0.08 is from Rds of TCIP6B595 of 4 ohm at 100mA, so 4ohm * 20mA = 0.08V

So read your datasheets, plug in your numbers & desired currents, go from there.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 09, 2013, 09:44 am
Thank you, CrossRoads!

So, in other words we do need the 220 Ohm resistors between the shift register and the NDP6020P-ND gate. We also need pullup resistors between the gate and source of the NDP6020-ND and their value should be 5 KOhm.

As for the LED current limiting resistor, I understand now which components drop voltage and need to be taken into account. I guess your guess of 0.5 is from the NDP6020-ND. I've read the datasheet, not just once, but I can't figure out the voltage drop based on the graphs. Here is the excat datasheet of the NDP6020-NDs that I've bought from Farnell: http://www.farnell.com/datasheets/59594.pdf (http://www.farnell.com/datasheets/59594.pdf)

The 3.3 voltage drop for the LEDs is a correct assumption.

One more important question: CrossRoads, in your image the Arduino had some additional things (capacitors, resistors) connected to some pins on the top and left, so it would seem that not only the MOSI, SCK, SS and GND pins are connected. Is that needed, or is that just some leftover from another circuit? If needed, what values would those be and what is their role?

Thank you very very much or your answer!

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 09, 2013, 04:22 pm
Ok, I didn't realize the NDP6020 was a MOSFET with 0.023 ohm on-resistance. Its voltage drop will be 0.023 * planned current (# of LEDs per row) or very small.

I drew up a standalone microcontroller circuit; if you are using an actual arduino, those are already built in, so you only to connect to the SPI pins and Gnd.
The standalone circuit has 10K reset pullup resistor, 16 MHz xtal, 22pF caps, and 100nF caps on VCC/AVCC/Aref.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 09, 2013, 09:11 pm
Thank you, CrossRoads, very much! :)

So that means that the voltage for which we need to calculate the current limiting resistors for the LEDs looks like this:

5V (source) - 3.3V (LED) - 0.08V (TCIP6B595) - 0.023 * 64 * 0.02 = 5 - 3.3 - 0.08 - 0.03 = 1.59. In other words we need 82 Ohm resistors. Luckily I have a few hundred of those laying around :)

At this point  I understand the driving circuit 100%. I will soon post an updated diagram to reflect the reality accurately.

In the meantime I'm progressing with the 4x4x4 test cube. You guys were right when you advised me not to start with the 8x8x8 one. No amount of theory can prepare you for the difficulties encountered during soldering. A practice cube is a must. In a few days it will be ready and I'll come back with pictures.

Thank you all for your help!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 09, 2013, 10:36 pm
1.59V/20mA = 79.5 ohm, 82 being a standard value should work well.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 10, 2013, 12:30 am
Here's the updated, hopefully 100% correct circuit diagram:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_zps56388f61.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 10, 2013, 09:42 pm
Thats pretty nice, I must admit, im a bit jealous. That looks like a pretty good schematic, it even includes specific part values, and the calculations.

I have been busy the last couple days strugling with my NPN transistor cube design. I accidentally smoked a few test parts (good thing for off board testing!), and my measurements are not what I had expected, and I think the parts I have, may not work well for what Im doing :( I have considered re-designing it using n-channel mosfets instead of bjt. I think maybe 12 LEDs maybe too much for one sot23 2222 BJT NPN.

Im starting to like your design better, since mine isnt going anywhere quick!

Have you figured out Your BOM ? I hope this is close:
Nine TPIC6B585 shift register ICs
Nine .1uf ceramic capacitors
Eight 220 ohm resistors
Eight NDP6020P-ND P-channel mosfets
Eight 5k ohm resistors
Sixty-four 82 Ohm resistors
Five-hundred and twelve LEDs
-------------------
Six-hundred and eighteen parts. That sounds like a lot, but its mostly the LED and resistors.

Wire/patience/skill...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 10, 2013, 10:03 pm
You know, I sell this bare board for $5 that will do all but the resistors and P-channel MOSFET.
96 open drain outputs (TPIC6B595) that can sink cathode current from 64 columns  and pull P-channel gates low to enable the 8 layers.
Save you a ton of assembly wiring time, you can concentrate on the cube wiring.
(http://www.crossroadsfencing.com/BobuinoRev17/12_digit_driver_board.jpg)


Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 10, 2013, 10:12 pm
I was going to mention that in my BOM post, but I wasnt comfortable selling someone elses product, so im glad you posted that. That board will make that project a lot easier, and tidier. I didnt know it was only $5.

Do you also sell a populated board? I would think that a board that is populated and ready to use would also be of value to many people.

It seems to me, you could use that board, another board for the rest of parts (except the LEDs), and the LED cube. That would be very nice and tidy, and my guess is a lot harder to make a mistake.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 10, 2013, 11:45 pm
I could sell them as populated. I don't advertise that, there are too many variations as to the parts that make up the board.
The ones I've assembled have been for specific projects.
IC Sockets? Male/Female headers? LED colors & brightness? Right angle or straight FTDI connector? Power connector type?

Same for the 'LED support' board.
I suppose a generic board with up to 81 cathode current limit resistors, 9 PNP or P-channel parts, and 9 gate/base pullup resistors could be put together.
(base current limit resistors too?)
Basically just not enough hours in a day for all the projects I'd like to do.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 11, 2013, 12:29 am
Hippynerd, I think your list of parts is accurate, or at least that's about what I have bought. But you might need to add the following:
-About 40 meters of silver plated copper wire (if you plan to make the cube quite lose, to ensure good visibility, the leggs of the LEDs just arent'long enough, so you'll need to make the whole structure out of craft wire)
-Some small size crocodile clips (at least 4) to hold the LEDs and craft wire together while soldering
-Some small hair clips to hold them together (or you could just borrow from a lady :P )
-9 IC sockets for the shift registers so you can avoid soldering them directly onto the board
-A few hundred breakable male and female pin headers to attach to the LEDs (making it possible to detach the cube from the circuitry) and to attach different parts of the circuitry to each other (I'm planning on putting it on 3 PCBs)
-A few appropriate size PCBs to hold the whole thing
-A 5V power supply which can power 64 LEDs at once (for 20 mA per led I got myself a 5V 2A power supply)

CrossRoads, you did mention this board you are selling earlier in this thread and I was very tempted to request one from you (still am tempted in a way, but now it might take too long to arrive). The only reason I didn't ask you to sell me one was that I did not really understand what's on it and how exactly I could connect it to my project. Sometimes I wish they taught us some hardware at the university. Unfortunately I've only ever learnt software, all that I know about hardware is just from reading on my own...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 11, 2013, 01:57 am
Here's my idea for an LED support board.
Place to accept cathode drive, series resistor and connect out to LED columns.
Place to accept gate/base drive, pull up the gate/base, and connect out to the anode layers.

USPS mail only takes a few days in the US, and not much longer internationally.

This board is 132 x 100mm, maybe I'll see if resistor can  be squeezed to fit on a 100x100mm board for lower cost.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Feb 11, 2013, 03:52 am

  I built my 5 x 5 x 5 cube on a perf. board with the resistors on the same board. I need to take another picture to show it.

@CrossRoads, I need a FET driver board for the Anode layers just like part of the board you are showing. Then, I think your sinker board that you have shown earlier would complete my project. I do not need the 81 resistor part of the board because my cube board already has the needed resistors.

Nice board design though!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 11, 2013, 05:56 am
Here we go, rearranged to fit in 100x100mm.

@cyclegadget,
The bare driver boards are $5 each mailed to US locations.  I've got 10 on hand.
paypal to cardinaflyer @ comcast dot net.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 11, 2013, 11:18 am
CrossRoads, you should change your nickname to "SolutionMan" or "TheManWithTheSolutions" or something :)
I's stretching my mind to understand the boards you presented here and I think I'm starting to realize how deeply convenient they are for this LED cube project!

I am seriously thinking about requesting an LED support board as it would be much more elegant than the perfboard solution I had in mind and it would save me a lot of time. I can't use it for the 4x4x4 test cube because with that one I plan to include variable resistors connected in series with the 82 Ohm resistors in order to experiment with how much current is exactly needed for the LEDs. With this approach I'll be able to determine the exact resistor values which I will use for the big cube (8x8x8). So, if my 4x4x4 cube will prove to work fine, I'll have to order such an LED support board from you. I like the 13.2 x 10 cm version better because it's less crowded.

As for the other board, which is meant to hold the shift registers, it's also very tempting. There are quite a few things I don't fully understand about it yet. For example I suspect that the IC1 (the big IC) on it is a microcontroller which is meant to replace the Arduino. If that's true, I probably don't need most of the left part of the board. But the bigger part, the right part, is a convenient way to hold the shift registers. Another thing I can't see is where I'd connect the MOSI, SCK and SS signals coming from the Arduino.

I see that you design very nice boards, which you also sell for more than correct prices. Do you by any chance happen to have a version of the shift register board specifically designed to work with the Arduino? If I understood things correctly, that would make the board smaller because it would leave out the left part of it. It would also be more elegant.

Final question: Did I understand correctly that these boards that you presented are completely naked, I mean there aren't even pin headers soldered to them, they are just the boards, and nothing else?

Thanks,
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 11, 2013, 10:32 pm
SolutionMan, I like that.
I'm still playing with the LED support board, iteadstudio is still closed so there's time.
I like the 10x10 because it will a lot less money - 10 x 13.2 jumps way up in price.
The other board has Arduino function built right in  - just connect an FTDI Basic, FTDI Cable, CP2102 module for a USB interface.
Or, build it up with shift registers & caps, and connect arduino SPI wires to the correct pins.
$5 gets you a bare board.
I can assemble one for you, we'd have to discuss specifics on parts, as I mentioned on Reply #143.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 12, 2013, 12:58 pm
Ok, thank you :)
I'll first see how my 4x4x4 test cube turns out and if the hardware and software parts both prove to be correct, then I'll most likely need an LED support board :) I'm still thinking about the other one...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 12, 2013, 02:53 pm
CrossRoads, I think I've spotted a mistake on all he connection diagrams that we've shown so far:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_zps56388f61.jpg)

If you look carefully at the TPIC6B595 shift register on the bottom of the diagram (the one which drives 8 cathode columns) and at the connections to its pins 13 and 12 (SRCK and RCK), you'll see that according to the connection diagram the SRCK connects to the next shift register's RCK and the RCK connects to the next shift register's SRCK. It think that's messed up and should be the other way around. I think that all shift registers should have their SRCK pins connected together and their RCK pins connected together, including the shift register which drives the anode planes. In other words, the Arduino's D13 (SCK) should be connected to all shift registers' SRCK and the Arduino's D10 (SS) should be connected to all shift registers' RCK. Am I right?

Another question that came to my mind: looking at the TPIC6B595's data sheet, I se that its pin 2 is marked VCC. In our diagram pin 2 is not connected to the 5V rail. Is that OK?

Thanks,
Andras
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 12, 2013, 05:06 pm
The "To Next Device SCK" & "To Next Device SS" notes are swapped, I'll agree with that.
Pin 2 is shown connected to +5V.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 12, 2013, 05:30 pm
Ouch! I missed the connection of pin 2.
OK, thank you! I will correct the diagram tonight so that others who read this in the future see the correct design.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 12, 2013, 11:24 pm
Updated schematic:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_V3_zps3dfcdb71.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 13, 2013, 07:32 pm
After you get this going and tested, I'd like a copy of the schematic and BOM, I may make one, but like crossroads said, there isnt enough time in the day to build all the stuff that i want to build.

My initial tests with transistors has lead me to wonder why anyone would ever use anything but a mosfet, but I still have more transistor torture to do before I make any decisions.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 13, 2013, 08:34 pm
Sure thing, Hippynerd! I'll send you everything when it proves to be working, although I'm afraid that's going to take at least 2 weeks from now.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 13, 2013, 08:57 pm
Sweet. Thank you :D
Please dont rush on my account, I would prefer that you insure success.

Also, thank you crossroads, youve done a great job here too.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 13, 2013, 09:26 pm
Yes, I think it's important to emphasize that CrossRoads is the mastermind behind this design. Thank you, CrossRoads!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 13, 2013, 09:36 pm
Well, we'll see if you guys can make it work!
I used similar for an 12x8 matrix here
with 8 common cathode 'rows' sunk by ULN2803 (from arduino pins) and just resistors sourcing the anodes - two 6B595s pulled the anodes low for the "off" LEDs.

6B595 & PNP/row is a little more hightech, but is really needed for the much higher number of LEDs that can be on.
(http://www.crossroadsfencing.com/BobuinoRev17/piano_card_assy_small.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 14, 2013, 02:00 am
A friend showed me these days a really nice piece of software called Sprint Layout, which can be used to design custom printed circuits. I started playing with it and found that it's very easy and straightforward to use. Driven by the desire to have the whole LED cube driver circuit on a single board, I've taken CrossRoads' design and tried to create a drawing for a printed circuit. Here's how it turned out:

Back:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Back_zps59064b2e.jpg)

Imaginary Front:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_ImaginaryFront_zps7e1d321c.jpg)

Real Front:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_RealFront_zpsb2f23223.jpg)

The board is 180 mm x 120 mm and holds all the components (except the Arduino and the LEDs, of course). The connections to the Arduino are marked with large rectangles and the connections to the LED cube are marked with small squares. The round connections are all internal.

I've struggled with it for about 6 hours until I have reached the current result. This is the first time in my life that I've ever done something like this, so it might be far from perfect. It might even have errors in it, unfortunately it's 3 o'clock in the morning here already, so I have to go to sleep, I can't verify it... If you guys notice anything strange or you have suggestions related to how it could be improved, let me know :)
I've spent quite a lot of time trying to squeeze things into the smallest space possible. A multi-layer PCB would have probably been smaller, but I don't know how to do that and I didn't even want to work on more than one layer because it might complicate the creation of the board.

Now, I haven't got the slightest idea yet if and how I can turn this design into a real board. I don't know anybody or any company who will accept such a design and make a board out of it. For now, it's just a design. If I can turn it into something concrete that's going to be great. If not... well, it has been a nice learning experience :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 14, 2013, 02:22 am
Nice plan!
couple of thoughts:

Quote
The board is 180 mm x 120 mm
That's gonna be pricey.
5  boards for $76.20 for example at iteadstudio (2 layer >10cm x 10cm >> 15x20cm price.
Figure out 2 sided & shrink it down. May not be much smaller, my 12xTPIC6B595 board is 100x100mm,  not sure of removing the 'arduino' portion and 3 shift registers would let 64 resistors fit instead. Even 10 x 15cm would get you down to $44.20 for 5.
(mine was designed with LED strips on mind, which have their own current limit resistors).

Quote
holds all the components (except the Arduino and the LEDs, of course)

So put the 'arduino' on it. Just the 328P, xtal, two 22pf caps, couple of 0.1uF caps, 10K pullup resistor, header to attach USB/Serial adapter to.

Would be a lot easier to review from a schematic.
Add ground plane top & bottom will eliminate a bunch of traces.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 14, 2013, 10:47 am
Thank you for the advice CrossRoads!

"Put the 'Arduino' on it" - just when I thought that I've figured it all out, you got me tempted again into figuring it out even deeper :) It's a nice idea. Until now I haven't considered it because my understanding of things was just not deep enough. But I've learned a lot these days, so now it's a different perspective... Based on my test results with the 4x4x4 cube, I might consider this, replacing the Arduion with a built-in controller!

Ground plane - what a simple and efficient way to ground things! I've never thought of this until now, but that certainly would eliminate a lot of strips! But where would that ground plane be? The current bottom (with the strips) would be the top and the bottom would be the ground plane? I'll have to read up on this...

The first thing I'll have to figure out is who or what company can turn the design into a real circuit. Based on that I will be able to decide how many planes I can have (how many they can do). I'd rather find somebody who can just make 1 or 2 boards, there's nothing I can do with 5... But I guess it's not worth it for them do make less than 5...

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 14, 2013, 10:51 am
"Would be a lot easier to review from a schematic." - I'm not entirely sure what kind of schematic you mean, but I've done it based on your design:

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_V3_zps3dfcdb71.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 14, 2013, 12:36 pm
I've shown my circuit design to a friend who really knows about electronics. HE had two remarks/questions:

1. Will it not be a problem that the SCK and SS signals coming from the Arduino are connected to 9 shift registers? He says that the SCK and SS signals are probably carried by weak currents (10-20 mA) and if this gets divided into 9 parts, it might be a problem. He also says that he looked at the datasheet of the TPIC6B595 shift registers and that they can work with very low currents, so maybe it's not a problem after all. I thought I'd ask your opinion anyway, just to be on the safe side. According to my friend, if this is a problem, I could employ some buffers like the 74HC125 in order to get around the problem, but I'm not sure what that means in our case.

2. What is the frequency of the MOSI/SCK/SS signals coming from the Arduino? It seems that if the signals have a high frequency, the circuit design becomes more complicated. Now, I'm sure that the signals cannot be faster than 16 MHz, which is the CPU frequency of the Arduino, but I wonder how high is the actual SPI frequency. If it is too high, do I need to take into consideration some additional things? He mentioned something about impedance, but that's a bit high-level for me at the moment...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 14, 2013, 02:30 pm
I've found an article about the Arduino SPI, here: http://arduino.cc/en/Reference/SPISetClockDivider (http://arduino.cc/en/Reference/SPISetClockDivider)
It seems that the SPI frequency can be set from software. The default is 4 MHz. I wonder what the optimal value is. You don't want it to be too slow, because it will become visible in the cube. You don't want it to be too fast because high frequency signals complicate things...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 14, 2013, 05:11 pm
1 & 2: I have daisy chained 20 TPIC6B595 shift registers spread over 2 boards.
The up-to-40mA capable IO pins had no problems driving them at default SPI speed of 4 MHz.

I don't know how your new program does a ground plane, ground pour, or what it might call it.  In eagle, you draw a polygon covering the area you want and then Name it GND.  I do on the top & bottom layer because iteadstudio does 2 sided boards as standard.  1-sided is usually just home board creaters - I won't be bothered doing that when compex designs can be had  & silkscreened & solder masked & have plated thru vias, all for $25 for 10 boards. (10cm x 10cm)
(http://www.crossroadsfencing.com/BobuinoRev17/12_digit_driver_board.jpg)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 15, 2013, 02:31 am
I've made a dual-layer version of the circuit :) Unfortunately it's very late again and I haven't had time to properly verify it. Maybe tomorrow...

Front:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Dual_Front_zpsd066b682.jpg)

Back - Mirrored:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Dual_Back_Mirrored_zpsa65e114a.jpg)

Back:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Dual_Back_zpsd50e1b6f.jpg)

The ground plane really has helped a lot. The board size has decreased from 180 x 120 mm to 140 x 100 mm :) Thanks for the tip, CrossRoads!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 15, 2013, 02:53 am
The front/top is the ground plane? Looks like it, just confirming.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 15, 2013, 10:30 am
Yepp, the top/front is the ground plane :)
I'm not quite sure yet about how the pads (round and rectangular connection areas) are connected to the whole ground plane (which is mostly all a big copper rectangle), as they seem to have some isolation circle or rectangle around them, but I'll figure that out...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 15, 2013, 04:47 pm
I have a really basic, but important question. The Arduino has some pins marked 5V and GND. See the group of pins which is leftmost on the bottom of the following image:

(http://arduino.cc/en/uploads/Main/ArduinoMega2560_r2_front.jpg)

My question is: Are those 5V/GND pins directly connected to the power jack of the Arduino or the current passes through some circuitry in the Arduino before it reaches the 5V and GND pins? I'm asking because I want to determine whether I can feed my LED Cube Driver circuit from these 5V/GND pins of the arduino or I need to connect my LED Cube Driver to the real power supply's 5V and GND. As you know, my LED Driver Circuit can work with currents up to 1.3A and I'm wondering if it's safe to take that much current from the Arduino's 5V/GND pins...
It would be nice if I could feed my custom circuit from the 5V/GND pins of the Arduino because that way I would have only one power connector (on the Arduino), I would only need to solder some pin headers on my own custom circuit.

Thanks!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 15, 2013, 07:38 pm
Im not sure about the mega, but the 328 based units seem to be limited to 500ma at the 5v pin. My guess is that 1.3a is going to too much, even for the mega.  I think that the 5v pin limit is from the specific voltage regulator that is used (the part right next to the external power socket.)


Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: retrolefty on Feb 15, 2013, 07:46 pm

Im not sure about the mega, but the 328 based units seem to be limited to 500ma at the 5v pin. My guess is that 1.3a is going to too much, even for the mega.  I think that the 5v pin limit is from the specific voltage regulator that is used (the part right next to the external power socket.)





That and when using USB power there is a 500ma thermofuse that limits the maximum 5V current one can draw.

Lefty
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 15, 2013, 07:53 pm
Too bad... Well, then I'll just connect the LED driver board directly to the power supply unit.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: retrolefty on Feb 15, 2013, 07:58 pm

Too bad... Well, then I'll just connect the LED driver board directly to the power supply unit.


Always a better way to go. The arduino boards are great at controlling stuff but are pretty wimpy at powering things.

Lefty
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 15, 2013, 09:38 pm
5V & Gnd are connected to the output of the 5V regulator, which is rated at 800mA,and is fed by a 1A rated diode from the barrel jack connector, or 500mA from the USB port.
For 1.3A, you need an external source for sure.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 15, 2013, 10:15 pm
Extrenal  5V/GND connector it is then :) This makes me wonder, though... the fact that I need to connect the Arduino's GND pin to the ground of the LED circuit still holds true, right?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 15, 2013, 10:25 pm
Yes, Gnds must be connected. Arduino, LED "shield", power supply.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 16, 2013, 10:57 pm
I have perfected the dual layer design. Here is the result:

Front (ground layer):
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Front_zpsb995756c.jpg)

Back (Mirrored):
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Driver_Back_Mirrored_zpsc8f47682.jpg)

The power supply is supposed to connect through a barrel jack identical to the one on the Arduino (this should be soldered onto the LED cube driver board's front). The MOSI, SCK, SS and GND of the Arduino are supposed to be connected via standard pins (breakable pins soldered onto the front of the circuit, either male or female). The anode planes and cathode columns are supposed to be connected to the board via standard pins (male/female pin headers soldered onto the front of the board).

If any of you guys want to try producing a real board from the design, I'm happy to send you the Sprint Layout file or some exported results (PDF, Gerber file, drill data, isolation milling, PCB outline milling, etc.). Please keep in mind that this has never been tested (except virtually inside Sprint Layout), so there's a chance that it has some bugs :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 17, 2013, 01:44 am
Nice. See you figured out how to run some traces on the top too.
What's the size of the board now?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 17, 2013, 05:31 pm
Thank you, CrossRoads :) It may not seem like it, but there's a lot of work in that dual layer design :) That's why I would happily share it with anybody who wants to use it. Of course, it would be nice if I could first prove that it's correct by building a board myself. I'm afraid that's going to take months, because soldering the 8x8x8 cube together is a tedious task. But it will be done one day and I'll be back here to inform you about it!

In the meantime, I've finished putting together the circuit today for the 4x4x4 test cube. I've done it on 3 solderless prototyping boards, without any soldering. I hope it will work. It also includes variable resistors to the LED cathode columns, so we'll know exactly just how much current we'll need for the big cube.
The 4x4x4 test cube is also soldered together and ready to go. It will take a few more days to write some basic software for it. I'm hoping that in about one week from now I will be able to show you some nice video about the 4x4x4 cube working. Perhaps I'm too optimistic, it will be a miracle if everything will work on the first go. Actually, I'm hoping that at least it will do something, even if not exactly what is expected and I'll be able to debug it. If no LED will light at all, that won't be funny... let's hope it does not happen.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 17, 2013, 05:41 pm
Ok, good luck! I'd like to try a cube myself some day, not enough  hours in the week right now tho.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 17, 2013, 10:57 pm
Yeah, I know the feeling... if only there was enough time for all the projects that I can come up with...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 19, 2013, 02:24 pm
Hi!

I've started writing the code for the LED cube and I've bumped into a question which might be very basic, but it's also important.
An SPI transfer begins by setting the SS pin to LOW and ends by setting it back to HIGH. In between you transfer the bytes with calls to SPI.transfer(). My question is: when exactly does the transferred data become live on the cube? Immediately after it's written with SPI.transfer(), or only after the SS pin is set back to HIGH?

I'm planning on transferring the data of an NxN horizontal plane like this:
Code: [Select]
void displayCurrentPlane ()
{
    digitalWrite (PIN_SS, LOW); //Start transferring data
    SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
    digitalWrite (PIN_SS, HIGH); //Done transferring data

    digitalWrite (PIN_SS, LOW); //Start transferring data

    for (byte i = N - 1; i >= 0; --i) //Set up the LEDs inside the current plane
    {
        SPI.transfer (cubeData[currentPlaneIndex][i]);
    }

    SPI.transfer (~(1 << currentPlaneIndex)); //Turn on the current plane (current plane's bit 0, all other bits 1)

    digitalWrite (PIN_SS, HIGH); //Done transferring data
}


Does this seem correct?

Thanks!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 19, 2013, 03:17 pm
Output registers of the shift register get loaded when SS goes high.

This only sends 1 byte out. I don't know how your shift registers are connected up - 3 daisy chained, 2 for the 16 LEDs in the layer and 1 more to control the layers?
If so, you'd need 3 SPI transfers.
Code: [Select]

    digitalWrite (PIN_SS, LOW); //Start transferring data
    SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
    digitalWrite (PIN_SS, HIGH); //Done transferring data


You have a loop for the plane, and then 1 more for the layer. As long as the layer shift register is last in line I guess the 2nd part would work.
How is cubeData [currentPlaneIndex] organized? as 1 byte/LED, so you have 64 byte altogether representing the cube?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 19, 2013, 03:55 pm
Hi CrossRoads!

Yes, the N+1 shift registers (where N is the size of the cube in one dimension) are daisy chained, one for the anode planes and N for the cathode columns. The first shift register on the line controls the anode planes and the rest of N shift registers control the cathode columns.

Indeed, this only writes out one byte:
Code: [Select]

digitalWrite (PIN_SS, LOW); //Start transferring data
SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
digitalWrite (PIN_SS, HIGH); //Done transferring data

That should be enough to turn everything off, because the value (all 1s) gets into the first shift register and turns off all the anode planes, so it does not matter what is left in the next N shift registers, which control the cathode columns. Or at least, that's how I imagine it...

cubeData is a matrix consisting of NxN bytes. The first index is the plane index, the second index is the row index inside the plane. Each element of the matrix contains one byte, which holds the data for one column inside the horizontal plane. In other words cubeData has NxN elements and each element contains N bits (obviously N cannot exceed 8 ).

Did I understand correctly that when you have X pieces of shift registers daisy chained, the first byte sent out via SPI.tansfer() goes into the first shift register, then the second SPI.transfer() pushes it into the second shift register, and so on?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 19, 2013, 04:39 pm
Actually, if the data goes live only when the SS pin is turned back HIGH, then I think this should be enough to switch to the next horizontal LED plane (next multiplexing step):
Code: [Select]

void displayCurrentPlane ()
{
    digitalWrite (PIN_SS, LOW); //Start transferring data

   for (byte i = N - 1; i >= 0; --i) //Set up the LEDs inside the current plane
   {
       SPI.transfer (cubeData[currentPlaneIndex][i]);
   }

   SPI.transfer (~(1 << currentPlaneIndex)); //Turn on the current plane and turn off all other planes (current plane's bit is set to 0, all other bits are set to 1)

   digitalWrite (PIN_SS, HIGH); //Done transferring data
}
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 01:29 am
Tonight I've "fired up" the LED cube. For about 2 hours it did not work at all. Turned out I had one short plus some misunderstanding about how my solderless breadboard's +/- rails work. I've solved these and the cube started working :D

Unfortunately it doesn't quite work as I would have expected it to. There are some mysteries that I can't explain:
1. In theory we have discussed that a cathode column can be turned on by setting its bit to 1. This works as expected. We have also discussed that an anode plane can be turned on by setting its bit to 0. Instead of this it turns on when I set its bit to 1, not to 0. I have followed CrossRoads circuit design 100%.
2. When I turn an anode plane on (by setting its bit to 1) some other planes also turn on (one or two planes above/below it), but much more faintly than the plane that actually needs to be turned on.
3. When I set all anode planes to off (by setting all bits to 0), the middle two planes turn on at full brightness.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 20, 2013, 05:02 am
For the anode/layer, writing a 1 into the shift register bit makes the output go low & turns on the PNP to make the anodes High.
For each cathode, writing a 1 into the shift register bit to make the output go low and turn on the LED.

Can you seperate the SS for the anode from the SS for the cathodes?

Instead of your funny << shift thing, pull the data from an array:
Code: [Select]

for (layer = 0 to 7){
// turn off all layers
digitalWrite(AnodeSS, LOW);
  SPI.transfer(0x00);
digitalWrite(AnodeSS, HIGH);

// write cathode - I suppose this could be the array structure you have above too
digitalWrite(CathodeSS, LOW);
  SPI.transfer(cathodeData[2*layer]);        // 0,2,4,6,8,10,12,14
  SPI.transfer(cathodeData[(2*layer)+1]); // 1,3,5,7,9,11,13,15
digitalWrite(CathodeSS, HIGH);
// this seems simpler to me tho - just 2 bytes per layer

// turn on anode
digitalWrite(AnodeSS, LOW);
  SPI.transfer(anodeData[layer]);
digitalWrite(AnodeSS, HIGH);

}
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 12:17 pm
Ok, so in order to turn on an LED situated at the intersection of the layer X and column Y, you need to write 1 into the Xth bit of the anode shift register and 1 into the appropriate bit of the appropriate cathode shift register. The main idea is that both the anode and cathode shift registers need to receive a 1 bit in order to turn on the LED. That's nice. It seems that I misunderstood it earlier, but now everything is clear.

I'm not so worried at the moment about how exactly I write those bits into the shift registers, as that seems to be working. On the other hand I'm very much worried about the fact that turning a layer on also turns on  1 or 2 other layers below and/or above it, but not as brightly as the targeted layer. Also, if I turn off all the layers, the two middle layers turn on at full brightness. That's very worrying... seems like a hardware bug...

For testing purposes I have disabled the whole multiplexing and everything that can make debugging hard. My whole loop() function is empty now, I just test things in the setup() function.

For example, if my setup() contains this:
Code: [Select]

void setup ()
{
    pinMode (PIN_MOSI, OUTPUT);
    pinMode (PIN_SCK, OUTPUT);
    pinMode (PIN_SS, OUTPUT);

    SPI.begin ();
    SPI.setBitOrder (MSBFIRST);
    SPI.setClockDivider (SPI_CLOCK_DIV4);

    digitalWrite (PIN_SS, LOW); //start transferring data
    SPI.transfer (B00000000); //turn off cathode columns 8-15
    SPI.transfer (B00000001); //turn on cathode column 0, turn off cathode columns 1-7
    SPI.transfer (B00000001); //turn on the first anode plane (anode plane 0)
    digitalWrite (PIN_SS, HIGH); //done transferring data
}


The code cannot get simpler than this. There's clearly no error in it and yet anode planes 1 and 2 also turn on in a dim manner next to anode plane 0 which turns on at full brightness, as instructed.

If in the last SPI.transfer(), which sets the anode planes, I transfer all 0 bits, the two middle anode planes (1 and 2) turn on.

Remember that I have a 4x4x4 cube driven by 3 daisy chained shift registers. The first 4 outputs of the first shift register on the line control the 4 anode layers through the MOSFETS and the next two shift registers on the line use all their 8 outputs to control the 16 cathode columns.

At the moment I don't have the slightest clue, what can be wrong, but it smells like a hardware problem to me...
Let me know if you suspect anything.

Thanks!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 20, 2013, 03:42 pm
I suspect hardware problem also. If you put a meter on the anodes for the other layers, what do you measure?
Perhaps a small pulldown (5k) is needed to keep the anodes low when the PNP is turned off, or a stronger pullup is needed on the PNP bases.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 04:02 pm
Thanks, CrossRoads! :)

When I'll arrive home tonight, I'll take some current measurements on the other anode layers. I plan to do this by inserting a multimeter between these other anode layers and the drain of the MOSFET which drives them. I hope that's right...

Honestly the thought that some layers turn on in addition to the layer which is really supposed to be on, has planted the feeling in me too that there's something wrong with the pullup resistors that I have today between the gate and the source of the MOSFETS (I have 5.6 KOhm there today). I'll try replacing them with some stronger resistors. I think I have 220 KOhms lying around, I'll give them a try. I hope that's not too much. I wonder if this can also explain why the two middle layers turn on when no layer is supposed to be on.

You mentioned that if I don't manage to solve the problem with bigger pulllups, I might need some pulldowns. From what I've read on Wikipedia, I understood that a pulldown is a resistor which you connect between the gate of the MOSFET and the ground. Is this correct? Also, is it good practice to use pullups and pulldowns combined, or you need to decide which one and use just one?

Thank you!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 10:58 pm
OK, so I started experimenting with pullups and pulldowns. First I replaced the 5.6K pullups with 220K pullups (I didn't have anything in between 5.6K and 220K). Nothing has changed really... Then I took out the pullups and replaced them with 5.6K pulldowns (instead of having the resistors between the gate and the 5V I put them between the gate and the GND). The situation became worse. Now all the planes are lit all the time.

Some interesting things I've noticed:
1.When I plug in the cube, but the Arduino is not connected, it starts up with all LEDs off. But if I put my hand near the 5V rail (I don't touch anything, I just take it 1-2 cm close tot he 5V rail), the LEDs start lighting up. The closer my hand, the more LEDs light up. I take my hand away, the LEDs go off...
2. When I unplug the cube, the LEDs stay on for 5-10 seconds (Depending on homw many are lit up). I guess that's because the power supply has some capacitor in it...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 11:06 pm
If I take out all pullup and pulldown resistors, then planes 1 and 4 are always on at full brightness, planes 2 and 3 behave as instructed. This is kind of the opposite of the case when I have the pullups in place and set all planes to off. In that case planes 2 and 3 are on at full brightness.

It's got to be something related to the pullups/pulldowns, but I can't figure out what is wrong...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 20, 2013, 11:19 pm
I would start by putting the resistors back the way you think they should be (5.6k gate/source I think). Then with the arduino completely disconnected, try to manually light up an LED by connecting the approprate voltage to the appropriate pins to turn on an LED.

I think your case this would be to hook up a ground, and have a couple 5v probes. hook one probe to the gate on one mosfet, and another on the leds anode lead (make sure to connect it before the resistor, so that you are using a resistor in circuit with the LED, or you may blow an LED. If you can manually light each LED one at a time, your LED setup is fine, you need to look at your programming or other circuitry.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 11:20 pm
I've now tried 1K pullups instead of the 5.6K pullups. The behavior is pretty much the same, except that the planes which are "ghosting" (slightly lit up besides the planes that really should be on) are now brighter, but still not fully bright.

I've managed to figure out one more important detail: The planes which are "ghosting" are always planes 2 and 3 (planes 1 and 4 are fine). When I turn all planes off, the "ghosting" planes (2 and 3) turn on at full brightess.

There's definitely something wrong around the anode planes 2 and 3...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 20, 2013, 11:24 pm
@Hippynerd: My LEDs (the cube itself) is defintely fine. I've tested it throughly before connecting it up to anything. The devil is hiding somewhere in the driver circuit. It seems to me that it's impossible for the software to be wrong as I'm only writing out 3 bytes to the 3 shift registers in the setup() function, loop() is completely empty, there's no sorcery in the software (yet :) )
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 21, 2013, 12:10 am
The mystery has been solved! It was clear that the problem was around the anode planes, so I started changing the components around that part, thinking that maybe something is defective. I first changed the anode driving shift register, that did not change anything. Than I changed the MOSFETS of planes 2 and 3 and... surprise! Now everything works well. They must have become damaged in the first phase when I had some wrong connections... I truly hope that they did not arrive damaged form Farnell, because 2 bad out of 4 would be very concerning.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 21, 2013, 12:24 am
Congrats! Glad to  hear it wasn't my circuit design ;)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 21, 2013, 01:04 am
Ladies and gentleman, it's alive! It works! 100%!
I've even  tried multiplexing and that also works well. At 4 ms multiplexing cycles it looks nice, at 6 ms my eye can already see the "trick" (it starts vibrating). I'll probably aim for 4 ms or lower.

I would like to thank you all for all the help you've given me with this project. I wouldn't have done it in a thousand years by myself, without your answers. My thanks are aimed especially at you, CrossRoads! Your design and your help is something that MasterCard cannot buy (priceless!). Seriously, I cannot thank you enough for having the patience to assist me across the steps of building the cube. If there's any way ever I can hep you back with anything, don't hesitate to let me know!

Now that the 4x4x4 cube works, I'll continue experimenting with writing software for it. After I'll have something usable, I will start putting together a 8x8x8 cube :D I'll start by turning that printed circuit design into something real and transferring the current 4x4x4 cube onto that board, populating only part of it.

@Hippynerd: It's very late at night again here, so I'm going to sleep now, but if you're still interested in that BOM, let me know and I'll gather my notes and write you a comlete list with stuff that you need for the cube and the approximate prices for which I've bought the components.

The 4x4x4 cube is just a test cube, but it's a great success for me. From here to the 8x8x8 cube it's just an immense amount of soldering. The knowledge is in my head and it's all tested now. This is a great day for me :) I've wanted to build a LED cube for 2-3 years now, but I didn't have the necessary knowledge. I've learned a lot from this 4x4x4 test cube. Now I can build the real thing. This is a dream come true.

Thank you all for everything again! I am most grateful for your help.

I'll borrow a camera soon (mine got broken) and I'll be back with a demo video of the 4x4x4 cube in a few days! Also, I make it my goal to thoroughly document the process of building the big cube. I will write a series of articles on my blog about it, which will help other people achieve the same result.

Hooray! :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 21, 2013, 01:13 am
Can you add on to the 4x4x4 to expand it into the 8x8x8? If so, then you're already 25% done.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 21, 2013, 10:07 am
:) I've thought of extending the 4x4x4 cube into an 8x8x8 one... but I've reached the conclusion that I'll start fresh with the big one. With the little one I've learned how to solder nd how not to solder the LEDs together, so it has some minor aesthetic flows. The big one is planned to be a work of art :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Feb 22, 2013, 06:31 pm
That would be great if you could put together a little document. I dont need source or price of parts, but listing the specific parts, and the specific calculations and schematics would be great.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 22, 2013, 11:09 pm
Hey there, Hippynerd!

Here's the BOM that I've promised, in form of a Google spreadhseet:
https://docs.google.com/spreadsheet/ccc?key=0An4wEyr8LJXZdFR4MjhVXzNBZ2R3WWFkQzFYeWlCa0E&usp=sharing (https://docs.google.com/spreadsheet/ccc?key=0An4wEyr8LJXZdFR4MjhVXzNBZ2R3WWFkQzFYeWlCa0E&usp=sharing)

I tried to make it as complete as possible, so there might be some things there that you don't need. The included prices are estimations of the prices that I have paid myself. My own total is 189$, but in reality it's probably 30% more because from several components I've bought more than needed, just to be safe.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 23, 2013, 12:03 am
I have bumped into a very interesting (and annoying effect) with the LED cube.

Let's say that we turn on one LED on the lowest anode plane, the corner LED which is leftmost and frontmost, like this:

Code: [Select]

   digitalWrite (PIN_SS, LOW); //Start transferring data

   SPI.transfer (B00000000);
   SPI.transfer (B00000001); //leftmost, frontmost corner cathode column
   SPI.transfer (B00000001); //bottom anode plane

   digitalWrite (PIN_SS, HIGH); //Done transferring data


Then we turn that LED off and instead we turn on another LED on the top layer, in the opposite (rightmost, backmost) corner, like this:

Code: [Select]

   digitalWrite (PIN_SS, LOW); //Start transferring data

   SPI.transfer (B10000000); //rightmost, backmost corner cathode column
   SPI.transfer (B00000000);
   SPI.transfer (B00001000); //top anode plane

   digitalWrite (PIN_SS, HIGH); //Done transferring data


The extremely strange thing that happens is that at the moment when we switch from the first LED to the second, for a very brief moment we can see a ghosting (a pale turn-on, but still visible) of a third LED, which is in the newly turned on anode plane but in the old cathode column, in other words in our example, the LED in the top plane, in the leftost, frontmost column.

This becomes very bothering as soon as we start using multiplexing (and that's the goal here). The way it manifests itself during multiplexing is that the image shown in the current multiplexed plane is ghosted in the previously multiplexed plane.

I can't find an explanation for this. It's like the cathode column that was turned on first is not turning off fast enough and when the second anode plane is turned on in combination with another cathode column, for a brief moment the intersection of the new plane and the old column is lit up. But why is the old cathode column not turned off fast enough? Could it be due to some characteristic of the TPIC6B595 shift registers? Some weird latency? Or maybe it's something related to how the data is pushed from one shift register to the next one?

I've tried CrossRoads' suggestion and separated the SS pin for the anode layers from the cathode SS pins. I turned off the anode planes first, then I set up the cathodes and finally I turned the anode planes back on. It doesn't help. The ghosting remains.

I got around the problem in the software by doing this: first I turn off everything by pushing all 0s into all shift registers, then I wait for 100 microseconds (1/10 milliseconds), after that I push the new data into all shift registers (including cathode and anode shift registers). This makes the ghosting go away by allowing the old cathode column to turn off before a new cathode column is turned on in a new anode layer. The only problem is that this approach introduces a barely noticeable tiny flickering in the LEDs when they are constantly on (through multiplexing). It's not a very big problem, because usually the LEDs won't be constantly on and the flickering is very hard to notice, but it still bothers me a little. And I'm curious what is behind that latency in turning off the cathode columns. I'm also worried that if this is somehow caused by some delay in the shift registers, the problem will be more severe in the 8x8x8 cube, where there will be 9 shift registers instead of the current 3 and the flickering will become more visible...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 23, 2013, 02:03 am
Try this: use the TPIC6B595 OE to disable the outputs when switching.

Use direct port manipulation to make it go faster.
So that OE is bit 2 and SS/Latch is bit 3, both on port D:
Code: [Select]

PORTD = PORTD | B00000010; // bring OE/ high
// xfer data
    SPI.transfer (B00000000);
    SPI.transfer (B00000001); //leftmost, frontmost corner cathode column
    SPI.transfer (B00000001); //bottom anode plane
PORTD = PORTD & B11111011; // bring SS/latch low
PORTD = PORDT | B00000110;  //  bring OE/ an SS/latch high
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 23, 2013, 09:52 am
So... basically your are suspecting that the latency is introduced by the Arduino itself! Interesting thought!
Does this require any rewiring in the physical circuit? Do I need to connect anything from the Arduino to the circuit?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 23, 2013, 01:54 pm
I've read about the direct port manipulation and I think I understand what it's about and I have also come to the understanding that OE means output enable. I'm still struggling to understand the following:

1. Looking at the datasheet of the TPIC6B595, I can't find an OE pin on it. How can I set the OE on the shift register? My current understanding is that I should use two pins on the Arduino to control when and how data is transferred to the shift registers: SS and OE, instead of the currently used SS only. The SS should remain connected as it is now, but where on the shift registers is the OE pin?
2. The direct port manipulation section of the Arduino documentation states that PORTD is mapped to pins 0-7, but they only say that it is so on ATmega8, ATmega168 and ATeega328 chips. Mine is ATmega2560. Nobody seems to write anything about which pins PORTD maps to on the Mega2560... I think I would have to disconnect the SS from the current Arduino pin 53 and connect it to where bit 2 of PORTD is mapped. I should connect the OE to where PORTD's bit 3 maps... But which pins are the bits of PORTD mapped to on my Mega2560? :)
3. There are a few things I'm not sure I understand in the example code:
Code: [Select]

PORTD = PORTD | B00000010; // bring OE/ high
// xfer data
   SPI.transfer (B00000000);
   SPI.transfer (B00000001); //leftmost, frontmost corner cathode column
   SPI.transfer (B00000001); //bottom anode plane
PORTD = PORTD & B11111011; // bring SS/latch low
PORTD = PORDT | B00000110;  //  bring OE/ an SS/latch high


a) PORTD = PORTD | B00000010; //bring OE HIGH
   Didn't you mean to bring EO low here (in the beginning, before the SPI transfers)? Isn't the goal to disable the outputs during the next lines, which do the transfer?
b) PORTD = PORTD & B11111011;
   PORTD = PORTD | B00000110;
   There's nothing in between bringing the SS/latch LOW and bringing it back HIGH. Is that correct and is that so in order to keep the time between the point when the data transfer starts and the data transfer ends to a minimum?

Thank you!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 23, 2013, 04:09 pm
I've found a good resource here: http://www.henningkarlsen.com/electronics/pm_arduino.php (http://www.henningkarlsen.com/electronics/pm_arduino.php)
If you open the PDF that corresponds to the Arduino Mega 2560 Rev3, you'll see the port labels there. For example PORTD 0-3 is mapped to digital pins 18-21. I hope that's right. I don't exactly know which revision of the Mega2560 I have, but hopefully the Rev3 mapping will apply to my device too.

The sad conclusion is that if people will try to use my code on other type of Arduinos (not Mega2560), they'll have to figure out where PORTD is mapped on their device.

So now what remains to be figured out is what is OE on the TPIC6B595 shift registers and how I can control it. Also, the questions a) and b) referring to CrossRoads' example code still puzzle me...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 23, 2013, 11:41 pm
OK, I have figured it out! OE (output enable) is pin 9 (marked G) on the TPIC6B595. So I disconnected the OE pins of the shift registers from the GND (that's how it originally was) and connected them in chain and to the Arduino pin 49. I left SS on Arduino pin 53, as it was before. And I started using this code:
Code: [Select]

   PORTL |= B00000001; //Output enable (pin 49) disabled
   SPI.transfer (cathodeData1);
   SPI.transfer (cathodeData2);
   SPI.transfer (anodeData);
   PORTB &= B11111110; //Latch (pin 53) low - start transfering data    
   PORTB |= B00000001; //Latch (pin 53) high - done transfering data
   PORTL &= B11111110; //Output enable (pin 49) enabled


Unfortunately this doesn't change anything :( The ghosting remains. During multiplexing the ghosting is seen as the previous plane being lit up very lightly at the same time when the new layer is lit up at full brightness.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 24, 2013, 01:06 am
Yes G pin Output enable.
High is disabled, Low is enabled.
Might have to do some experimenting to find the best time to turn the outputs on & off.

Ports, PORTD was just an example, yes portability is reduced somewhat in exchange for speed.

Setting the SS pin Low/High back to back- all that is needed is  rising edge to clock the bits into the output register, does not matter where it goes low.
Maybe add a pull down resistor on the anode layers to ensure they go low when their transistor is turned off.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 24, 2013, 06:57 pm
CrossRoads, by adding pulldown resistors to the anode layers you meant adding some resistors between the MOSFET gates and the GND, right? I'm a bit confused by this (just like I was last time when you suggested it) because currently we have some pullups there (between the MOSFET gates and the 5V). I thought the role of the pullups was to ensure that the anode layers go low when the MOSFET is off... but now you suggested that we need pulldowns for the same purpose... I guess I'm missing something here.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Feb 25, 2013, 01:56 am
What I am saying is leave the MOSFET gate alone and put a resistor from the LED Anode to Gnd - that will ensure the LEDs are being turned off when the MOSFET is off.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Feb 25, 2013, 08:59 am
Right! I knew I was misunderstanding something :) This sounds good. I'll try it tonight when I get home.
Thank you!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 02, 2013, 11:57 am
Unfortunately I still haven't had the time to try the pulldowns on the anodes (I suspect they wil actually be needed on the cathodes), I'll get back with my findings as soon as I'll be able to try it out.

In the meantime I wanted to share with you guys something that might be quite important. As I wrote earlier, modern LEDs might be rated at 20 mA, but they give relatively strong light at much lower currents. I have experimented with my cube and I have found that multiplexing (fast switching) does not influence this at all. In other words, designing the cube to work at 20 mA per LED might not be needed at all. I'm giving my LEDs 1.6 mA (1K + 82R resistors for each LED) and they are quite bright. Not as bright as at 20 mA, but still bright enough (I'm guessing about 70% as bright as at 20 mA). Full brightness may actually be an undesired thing, as the LEDs in the lower planes might shine through the ones that are above them. What I'm trying to say is that you can put 1K (or heavier) resistors to the LED cathodes instead of the originally intended 82 Ohm ones. This will reduce the current consumption of the cube considerably, you'll get away with a much weaker power source and maybe even the MOSFETS and shift registers could be replaced with ones that work at lower currents :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 05, 2013, 01:44 am
Here's the first video of the cube, running a test pattern :)
http://youtu.be/daVEyItv5lA (http://youtu.be/daVEyItv5lA)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 05, 2013, 04:40 am
Did you end up changing the hardware between replies 214 & 215?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 05, 2013, 08:24 am
No, not yet. I expect to do it sometime in the next 2-3 days. Don't worry, I'll let you know what I find.
The reason why you don't see the ghosting in this video is that I've fixed it in the software by adding a 100 microseconds delay between turning the previous layer off and turning the current layer on. The hardware solution appeals to me more, so I'll definitely try it.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 06, 2013, 08:43 am
Time for some fun!  8)
http://youtu.be/5NqlwmS5dDs (http://youtu.be/5NqlwmS5dDs)

Although the multiplexing is quite obvious on camera, it is almost completely unnoticeable for the human eye.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 12:00 am
I've finally managed to take some time to try adding some pull down resistors directly between the anodes and GND to see if the ghosting disappears. No such luck. I've also tried to add them between the cathodes and the 5V. Still no joy.

Something is not shutting down quickly enough. I wonder what. Remember that when a new anode plane is turned on, the LED that is at the intersection of the new anode plane and old cathode column, briefly turns on, just enough to be visible to the human eye as a dim light. This suggests that the cathodes are not turned off fast enough (not the anodes) and they interact with the newly turned on anode plane although they should not. The minimum delay added in the software which fixes this is 75 microseconds (0.075 milliseconds). From what I understood from the TPIC6B595 shift regiters' datasheet, that's a lot more than the typical 200 nanoseconds specified as "Fall time, drain output". But there's also some propagation time there (see the "Switching characteristics" section in this datasheet: http://www.ti.com/lit/ds/symlink/tpic6b595.pdf (http://www.ti.com/lit/ds/symlink/tpic6b595.pdf)). Could it be that some propagation times add up to produce this 75 microseconds delay? That's still hard to believe because the propagation times (high-to-low + low-to-high) are specified around 150+90 = 240 nanoseconds. 75 microseconds divided to 240 nanoseconds is still about 300 and I doubt that I have 300 propagations (whatever that means) on 2 shift registers. Still, the cathodes are driven directly by the shift registers, so I can't imagine any other culprit... or could it be something to do with the capacitors that we use at the shift registers?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 07, 2013, 01:39 am
You got me.  I just finished  multiplexing 56 7-segment displays with 8 TPIC6B595s, pullup resistors as current source, one TPIC6B595 to pull the anodes low for off segments and one output low at a time from the remaining 7 for each digit's common cathode, switching to next digit every 300uS.  All 8 shift registers were loaded and updated at the same time.  I didn't see any ghosting at all.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 08:51 am
Yepp, it's very strange... I might try experimenting with turning the shift registers off with their clear pin (instead of shifting 0s into them), who knows, maybe they turn off faster like that...
I wonder if the quality of the shift registers could have anything to do with this. After all, I've bought them form China at a quite low price...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 07, 2013, 09:07 am
Turn off time, quality of signals - hard to say without putting a 'scope on the lines and see what you are getting.
I am doing 8 SPI.transfers to send the anode data and select 1 cathode (now that I fixed all my typos  :smiley-mr-green: ) with a common latch to change the outputs from all 8 at the same time.  OE is just on all the time.

I don't know what is going on with my PC,  I can't seem to copy & paste code from a sketch in here. It highlights correctly, all the copy & paste commands are selected correctly, yet nothing is pasted in.  Aggravating.

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 09:18 am
If it's Windows, it's a subtle way of letting you know that it's longing for a reboot :P
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 07, 2013, 09:57 am
"If it's Windows, it's a subtle way of letting you know that it's longing for a reboot"

Okay, full power off re-boot, including pulling battery.
Can copy-paste here.
Can copy-paste in a sketch.

Can't copy paste from sketch to here.  What gives?

WinVista, never had this issue until a couple of days ago.  Gotta be some setting screwed up somewhere.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 10:12 am
Can you copy-paste from scratch to notepad and from notepad here? If not, which step fails?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 07, 2013, 10:39 am
When I paste from sketch to Notepad, I only get a few lines.
Even when I do CTRL-A to select all, then CTRL-C to copy, and CTRL-V to paste - I only get a small section, like this:
Code: [Select]

/*
LED display test
Use  shiftregister 7 to control anodes, 1 = output low = segment off
Use individual bits of shift registers 0,1,2,3,4,5,6 to control common cathode of individual digits. 1 = output low, common cathode on

cathode bits are flipped in pairs:
control board: a-b, c-d, e-f, g-dp
breakout board: b-a, d-c, f-e, dp-g

anodes are 1-1 between boards: a,b,c,d,e,f,g

*/

I can copy the whole sketch within the IDE itself - just not anyplace else.

Off to bed, probably gonna have snow to clear in a few hours, work on this some more tomorrow night.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 10:59 am
I guess the problem is with the sketch editor then... You should open the file with another text editor (notepad, Total Commander viewer, NotePad++, etc.) and you would probably be able to paste.
OK, good night :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 07, 2013, 04:22 pm
Ok, will check that out tonight.
I also tried going back to 1.0 (vs 1.0.3) and paste from there did not work either.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 07, 2013, 10:41 pm
I've tried out a couple of other things tonight, hoping to get rid of the ghosting:
1. I've added some big (10uF) capacitors in parallel with the existing smaller ceramic ones to each shift registers. Didn't help.
2. I've disconnected the clear (SRCLR) pin of the shift registers from the 5V (which prevented them from clearing) and connected them to two Arduino pins. When I'm clearing the the data in the shift registers, instead of shifting all 0s into them, now I set the SRCLR to LOW for a moment and that clears them. This way te ghosting doesn't go away even if I add that software delay. This is either because the clear doesn't work (does not clear the shift registers) or because for some perverted reason they need those 0s to be shifted in...

God only knows what the hack is going on here :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 08, 2013, 03:43 am
SRCLR only clears the first, need  an output clock to make the 0's show up at the output.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 08, 2013, 03:47 am
Check the end of this post
http://arduino.cc/forum/index.php?topic=144057.new;topicseen#new
Not seeing any ghosting - why not ask to see that code?
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 08, 2013, 10:14 am
Oh, yes, you're right. It's not enough to clear, you need to latch too. I'll try that tonight. Thanks! :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 11, 2013, 12:25 pm
I kind of grew tired of hunting down the ghosting :) I'll leave it as it is for now, with the software fix. I read somewhere that somebody had the same problem and he changed some wires and bad connections and the problem went away. Maybe I'll have the same luck. Today the printed circuit will be ready so I will soon switch form the solderless breadboard solution to the printed circuit (let's hope I've designed it well :) ).

Anyway, I wanted to write about the LED currents again. For 20 mA per LED we agreed to have 82 Ohm resistors. I've used 1KOhm ones instead, limiting the current to about 1.6 mA per LED. This seems to be the optimal value for super-bright, diffused, 3mm blue LEDs. This value seems to give optimal brightness (not too bright to cut through your retina, but bright enough if there's no strong light in the room - a lamp is fine, in bright daylight they look a bit pale). If the LEDs are brighter, they bother me at night. For white LEDs probably the same resistor values are optimal. For orange, green and red ones you need weaker resistors because their voltage drop is less.

As an experiment, I've tried adding higher value resistors. At 5.6 KOhm (0.3 mA) the LEDs still look quite bright (but not enough for a cube in my opinion). The point where they start loosing their light is 47 KOhm (0.03 mA).
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Mar 11, 2013, 10:55 pm
Wow, that's pretty efficient!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 12, 2013, 12:47 am
Yepp! :)

Just for fun, here's another video of the 4x4x4 LED cube :)
http://youtu.be/H_wenZQ0fmI (http://youtu.be/H_wenZQ0fmI)

The main thing to notice here compared to the previous video is how much smoother the animations are, even on camera. This is because now I'm switching layers every 1 ms. Previously it was 3 or 4 ms.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: cyclegadget on Mar 12, 2013, 03:10 am

It's getting better all of the time! Way to go!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 12, 2013, 09:04 am
Thanks :)
I stopped developing animations for now in favor of starting the 8x8x8 cube, but new ones will follow when the big cube will be done :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 13, 2013, 12:20 am
As I have promised, I'll try to give back what I have learnt here to the community, by writing a series of articles about how to build an LED cube. For now, I've written a very long introduction :)

http://iqjar.com/jar/building-an-8x8x8-led-cube-introduction/ (http://iqjar.com/jar/building-an-8x8x8-led-cube-introduction/)

I plan to write 3 more articles, one about building the cube itself, one about putting together the driving circuit and one about writing software for it. These will take time, because I'm doing it in parallel with actually building the big, 8x8x8 cube, so that the experience is fresh while I'm writing about it.
I'm trying to explain things on a very simple level, suitable for beginners like I was a few months ago.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Pedro147 on Mar 13, 2013, 01:15 am
Great article there  Un4Seen 8) Its good to see people, such as your good self, take the time to write up these tutorials. Looking forward to the software article, Pedro. 
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 13, 2013, 09:50 am
Thank you :)
I predict it will be at least two months before I can write all the articles and the software one will be last. If you cannot wait until then, you're welcome to download the current version of my code from here:
http://iqjar.com/download/jar/LED_Cube/4x4x4/LEDQB_v0.4.ZIP (http://iqjar.com/download/jar/LED_Cube/4x4x4/LEDQB_v0.4.ZIP)

In the software article I'll go into details about how and why I've done things the way I've done them. Until then you can try to figure it out yourself and I can answer your questions, should there be any.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 12:46 am
Those of you who have been following this thread probably remember that I've build my 4x4x4 test cube on some solderless breadboards and that I've used 3 shift registers in total (1 for the anode planes, using only 4 of its outputs) and 2 for the cathode columns, using all their 8 outputs (16 in total). You may also remember that I had some strange ghosting that I could not fix in the hardware so I got around the problem by introducing a 75 microseconds delay in the software between  the switchwing between two layers.

These days I've ordered the printed circuit that I've designed for the driving circuit and today I have soldered the components onto it, replacing the solderless breadboard solution with a final, soldered one. But I have done something a little bit differently. This time I have used 5 shift registers in total for the very same 4x4x4 cube: 1 shift register for the anode planes and 4 shift registers for the cathode columns, using only 4 outputs from each shift register. So now, instead of only 3, I have 5 shift registers chained.

The good news is that the printed circuit design is flawless. It worked immediately during the first attempt to fire it up.
The bad news is, that the ghosting has become magnitudes worse. Now that 75 microseconds delay between switching layers is not enough anymore. Now I can only get rid of the ghosting by introducing a 600 microseconds delay. That's unacceptable. For an 8x8x8 cube it would probably be around 4-5 milliseconds, which would kill the whole multiplexing mechanism and the cube would flicker like hell. So I have no choice but to figure out what is wrong with the hardware and fix it. What makes things even more complicated is that now the components are soldered in, so it will be more difficult to experiment.

I did draw an important conclusion today. The ghosting appears because the anode layers turn off too slowly, not because the cathode columns turn off too slowly. Or at least that's what the experiments suggest. It also seems that the ghosting becomes exponentially worse with more shift registers chained. Does anybody have any idea at all what could be wrong? Could it be because of those 220 Ohm resistors at the gates of the MOSFETS which turn the anode layers on/off?

Remember the schematic:
(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_zps56388f61.jpg)

I guess I could find that out by shorting the 220 Ohm resistors temporarily. I hope that will not damage the MOSFETS...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Mar 24, 2013, 01:13 am
Do you need those 220 resistors on the gates? I am curious about that, as I have a couple cubes that will need fets for switching planes. I have 5k's for the gate/source, and in my testing, I think that the gate drew like 1ma. If the function of that resistor is to limit the current on the arduino, then It didnt seem necessary during my experiments.

Do you have a video of the ghosting, I dont know if I've seen that issue before this thread.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 09:37 am
Hi there again! :)

I'm afraid still no video, as my old camera is still broken and I still didn't make the decision to buy a new one. But It's very simple to imagine it with the following test:

First step: write all 0s into all cathodes to keep them all off and write a 1 into one of the anodes to turn it on. As the cathodes are off, no LED will light, so far so good:

Code: [Select]

digitalWrite (53, LOW); //Start transferring data
SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); //All cathodes OFF
SPI.transfer (B00001000); //One anode ON
digitalWrite (53, HIGH); //Done transferring data
delay (600);


Keep it like this for 600 milliseconds (all LEDs OFF even though one of the anodes is ON).

Second step: write a 1 bit into one of the cathodes and a 1 bit into a different anode:
Code: [Select]
http://digitalWrite (53, LOW); //Start transferring data
SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000001); //One cathode ON, the rest OFF
SPI.transfer (B00000001); //A different anode ON, previous anode OFF
digitalWrite (53, HIGH); //Done transferring data
delay (600);


What should happen here is that the LED corresponding to the turned on cathode and to the NEWLY turned on anode should light up for 600 milliseconds. This does happen, but at the beginning of those 600 milliseconds the LED which is in the turned on cathode column and in the OLD anoe plane, also turns on briefly. Tests show that it turns on for 600 microseconds.

BUT here comes the interesting part!
You know that I wrote last night that the only thing that I did differently with the soldered printed circuit compared to the solderless breadboard solution is that now I have more shift registers chained. Well, I just remembered that it's not true! I have also replaced the 5.6K pullup resistors between the MOSFET gates and sources with 47K resistors with the intention to make the circuit consume less power when the anode layers are off. I have the feeling that this is what made the ghosting so much worse. I did not try changing those resistors back yet, but my hunch seems to be backed by the fact that the old ghosting time with the 5.6K resistors was 75 microseconds and the new ghosting time with the 47K resistors is 600 microseconds. The 75/5.6 and 600/47 ratios are both roughly 8, so I guess the ghosting (the anode turn-off lag) increases linearly with the value of those base-gate resistors.

Now comes the hard part! How low can I go with the values of those base-gate resistors without damaging anything and without having my circuit eat too much power in passive mode? Even if I go really low, I doubt that I'll be able to make the ghosting go away completely. For that to happen I think some other solution is needed. But what, I wonder?  :~
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 10:55 am
Interesting, very interesting...
I've put back the 5.6K resistors in parallel with the 47K ones. This should result in an overall resistance of 5K between the gates and sources.
Now I can get away with a delay of only 10 microseconds between switching. Perhaps in the solderless solution there was no proper contact somewhere and the resistance was actually higher than 5.6K. Or perhaps 5K is near the limit where the resistors are weak enough for the ghosting to go away. I'll try desoldering the 47K ones and soldering some 3.3K ones instead. Hopefully that will make everything OK.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 01:27 pm
I've soldered in the 3.3K resistors between the gates and sources of the MOSFETS. The result is not what I was expecting. Now the ghosting seems to show up a bit more differently. Now when a cathode is on and multiplexed, not just the previous layer is ghosting, but all the layers. The ghosting is dimmer now, but instead of only one ghosting layer, now all the layers are ghosting. Also, no matter how much software lag I introduce, it's not going away. I need a wall to hit my head against  =(
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Mar 24, 2013, 09:46 pm
I dont know if it was this thread, or another, or what, but I think I remember reading about toggling the OE or CLR to help prevent ghosting or something similar.
Sometimes when you can see what its doing, you can make a better guess, but even then, this stuff is doing things way beyond our ability to see.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 10:02 pm
Hi, Hippynerd! :)

Yepp, it was this thread.
I did try to experiment with that (disabling output while transfering data), did not help.

You're right, this is doing stuff which is a bit hard to understand, you're certainly right about that :) But at least now I knwo for sure that the ghosting is related to the parts of the circuit around the MOSFETS. And I know that the problem is that the anode layers are not turning off fast enough. I've also found out that the gravity of this lag (of the anode planes) depends on the value of the resistors between the gate and source legs of the MOSFETS. The higher the resistor value, the longer the lag. Maybe the value of the 220 Ohm resistors between the anode driving shift register and the gates of the MOSFETS might also have a say in it, I did not experiment with that yet.

I'm kind of hoping CrossRoads is still reading this. He might be the only one who understands what is going on.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Mar 24, 2013, 10:21 pm
I think it was crossroads that said that the gate/source resistor helps the fet switch faster (this is where the math gets scary, with all that RDS on, and gate capacitance and stuff factor in).

I've also read that it helps prevent ringing, which can damage and prematurely wear out your FET.

I dont understand the reason for the resistors that are on the shift registers that dont connect directly to LEDs.

I was also thinking, that if you are going to run your LEDs at less than 1ma, you could use 74hc595s instead of tpic shift registers. You could even go up to 8ma each LED.

I suspect he will chime in, but its sunday, he might take a break from the forum to you know, do real life things once in a while...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 10:53 pm
Yeah, real life tends to need attention :P

God forbid giving the LEDs 8mA! I'm running them at around 1.5 mA and they are still way too bright!

I've done some further experiments and I can now explain as clearly as possible the ghosting effect, through some short pieces of code. No multiplexing involved, nothing funny, just plain old turning on/off cathodes and anode layers using SPI transfers:

Code: [Select]

void loop ()
{
    //Step A: turn on all the 16 cathodes and turn off all the 4 anodes
    digitalWrite (53, LOW);
    SPI.transfer (B00001111); SPI.transfer (B00001111); SPI.transfer (B00001111); SPI.transfer (B00001111); //All cathodes ON
    SPI.transfer (B00000000); //All anodes OFF
    digitalWrite (53, HIGH);
    delay(1000);
   
    //Step B: turn off all the 16 cathodes and turn on 1 anode
    digitalWrite (53, LOW);
    SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); //All cathodes off
    SPI.transfer (B00000001); //One anode layer ON
    digitalWrite (53, HIGH);
    delay(1000);
}


The expected behavior here is that no LED turns on ever, because there isn't any moment of time when both a cathode and an anode layer are simultaneously ON. Well, unfortunately that's not what happens. The LEDs in the layer which is ON at step B keep lighting up briefly and dimly after each full cycle (step A + step B). I'm not sure whether this happens between step A and B or between step B and A, but it only happens once during a full cycle. My bet is that it happens between step B and A (and not between A and B) because the anode layers turned on at step B don't turn off quickly enough. But I'm not sure that this is what really happens because I tried adding some code both between step A and B and between step B and A which turns off everything (all cathodes and all anodes) and waits for the turn-off to happen (software delay). No matter how much delay I added, the blinking didn't even get shorter, it remained the same. I even added 600 ms delays (which is extremely much!), nothing changed.
The way I see it, what happens is that when you turn on an anode layer, some small amount of current gets into that layer and it somehow stays there until it can get away somehow. It only seems to be able to get away through the LEDs when some cathodes are turned on. And while it gets away through the LEDs, the LEDs light up. This is my best explanation so far.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Hippynerd on Mar 24, 2013, 11:15 pm
recently, I've been working on a 4x4x4 cube that uses transistors to switch lines (not planes, lines, one plane is line * cubesize. Instead of using 4 transistors to swtich 4 planes, I using 20 transistors to switch 16 lines of LEDs (16 lines = 4 planes).
To do this, I have to cascade the transistors, so that you turn on 1 transistor, to turn on another bank of 4 transistors.
When writing the code, I cycle bits through the anodes pins, but I dont need to turn them off or clear them. i originally wrote the it so that it turns on the 2 that it needs, then delay, then turn off all transistors. I recently changed it to just turning off the second transistor (leaving the first transistor on, until its time to turn it off, and the next one on.)

I dont know if it makes any difference, but it seems like its must be better that way. Im wondering if your ghosting issue has something to do with 2 transistors being on at one time, when maybe only one should be on? are you turning off one layer before turning on the next?

Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 24, 2013, 11:33 pm
When multiplexing. I only turn off a layer before turning on the next one because of this ghosting. In the past, when I had the 4x4x4 test cube's circuit on solderless breadboards, turning the previous layer off and aiting 75 microsecs before turning the next layer on, helped. But in theory, there should be no need for this.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 25, 2013, 12:39 am
I've just tried again one of CrossRoads' older suggestions: ground the anode layers through some resistors. I used 5.6K. No change. The ghosting persists :(
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 25, 2013, 10:00 pm
Some other things I've tried tonight:
1. Added one more 3.3K resistor in parallel with the existing one between the MOSFETs' gate and sources.
2. Shorted the 220 Ohm resistor at the MOSFET gate.

None of these made any difference.

One more thing I found: the dim flickering (or ghosting or whatever) appears between step B and A in my previously shown code, just as I thought. In other words, the anode planes are just not shutting down quickly enough, so when some cathodes are switched on, the LEDs briefly turn on in the previously turned on anode plane (which is turned off before or simultaneously with the cathodes being turned on). I'm saying before or simultaneously, because if I turn the anode plane off and turn on the cathodes immediately (right after), then I get some quite visible ghosting-flickering. But I've tried to add a delay between step B and A, like this:

Code: [Select]

    //Step B: turn ON one anode plane, keep all cathodes OFF
    digitalWrite (53, LOW);   
    SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); //All cathodes OFF
    SPI.transfer (B00000001); //One anode plane ON
    digitalWrite (53, HIGH);
    delay(1000);
   
    //Delay step (C): turn everything OFF (all anodes and cathodes)
    digitalWrite (53, LOW);
    SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); //All cathodes OFF
    SPI.transfer (B00000000); //All anode planes OFF
    digitalWrite (53, HIGH);
    delayMicroseconds(25);
   
    //Step A: turn all anode planes OFF, turn one cathode ON
    digitalWrite (53, LOW);
    SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000000); SPI.transfer (B00000001); //One cathode ON
    SPI.transfer (B00000000); //All anode planes OFF
    digitalWrite (53, HIGH);
    delay(1000);


With that intermediate step C, after which I wait 25 microseconds, letting the previously turned on anode plane turn off, the flickering-ghosting (which occurs at the intersection of the anode plane turned on in step B and cathode column turned on in step A) is much less visible. Barely visible. But here's where it gets interesting! I tried increasing that 25 microseconds delay, even up to 100.000 microseconds, but the situation didn't get any better compared to when the delay was just 25 microseconds. However, if I reduce the delay to 0, then the flickering-ghosting gets much worse.

What is going on here?  :smiley-roll:
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 27, 2013, 11:14 pm
When I started feeling that the ghosting problem just beats me and felt like giving up, somebody really nice has sent me a link to an article written by a guy who was struggling with the same issue:
http://scriptkiller.de/en/a55/computer_electronics/10%25C2%25B3_(10x10x10)_led_cube/ (http://scriptkiller.de/en/a55/computer_electronics/10%25C2%25B3_(10x10x10)_led_cube/)
I don't know why I haven't found this article myself, because I did search a lot for ghosting in LED cubes. Anyway, thank you, Robert, for sending this to me!

The guy who had the same ghosting issue states the following:
Quote
"Eliminating Ghosting
Problem: If high-side layer switches are (almost) unloaded, they will take a long time to completely switch off (due to capacitances at the drain of the FET, I guess and in the wiring).
It can clearly be seen that the voltage does not reach 0V during one multiplexing cycle. Thus some LEDs may be switched on very dim although they should not. The solution is to add a load-resistor of 1kOhm between the drain of each high-side P-FET and ground. At 5V there will only be 5V/1kOhm = 5mA flowing through each of these load resistors, but the effect is magnificient"


Now, this solution in itself is nothing new. It's kind of what CrossRoads has suggested many days ago. I tried it back then and it didn't work. I tried it today, it didn't work either. BUT it has lead me to an acceptable solution. The reason it did not work in the past or today is that I expected this resistor to magically make the excess current vanish instantly. Obviously, that's not the case. You have to give it time. In other words, you have to combine this hardware solution with the software solution of switching everything (all anodes and cathodes) off and waiting a bit. Luckily I was inspired enough today to try this.

So, I added 1K resistors between the drains of the MOSFETS and ground (in other words I've grounded the anode layers through 1K resistors). It's important to really use 1K resistors, not higher, my experiments have shown that higher value resistors are beneficial, but don't work as well as 1K resistors. Unfortunately this means 5mA power usage per anode layer in passive mode (that's about 40 mA for a 8x8x8 LED cube), but it seems that it's the price that needs to be paid. After adding these resistors I've added an intermediary software step between switching layers, which turns all anodes and cathodes off and waits a little (as little as 30 microseconds).

After this the ghosting was almost completely gone, but I've noticed a second ghosting, out of sync with the one that I've just eliminated. This second ghosting was extremely dim, but it was there. The solution I've found for this second one was to add 10K resistors between each cathode column and the positive 5V rail. Unfortunately in a 8x8x8 LED cube with 64 cathode columns this adds another 32 mA power usage in passive mode. I guess it's something I'll have to live with. I can't say I'm happy about all this passive power usage, but I don't know a better solution.

With all these resistors added, the ghosting is almost almost almost completely gone. There is still an extremely faint, dim ghosting, but it is almost impossible to notice. You have to look at the LEDs from their top, where they give off most light and in perfect darkness and even so you can barely see it. It's not perfection, but it's quite close. In a working LED cube with real animations there will rarely be darkness. The light of the lit LEDs will make this last trace of the ghosting unnoticeable.

I hope this helps everybody who might bump into the same problem.
Thank you guys, for helping me!
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 28, 2013, 12:09 am
Unfortunately I've found an unwanted side effect of my new solution. The problems just don't seem to go away :)

As soon as I've started using the cube in real, multiplexed mode, trying out all LEDs in a test pattern, I've noticed that in one column from the 16 that I have in total, the top 3 LEDs are dimly lit all the time. The lowest LED is fine, the one above it, in the same column, is dimly lit, the third one (even higher in the same column) is dimly lit, but not as much as the second one and the fourth one is also dimly lit, but not even as much as the third one. If I remove the 1K resistor which connects the lowest anode layer to ground, then this unwanted effect goes away, but then I'm back to the ghosting :P
The even more interesting thing is that if I disconnect that column completely from the driving circuit, the top 3 LEDs in that column are still dimly lit, as described above, but when they should really light up at full brightness, they don't (because that column is disconnected). But if the column is disconnected, then it means that they are not grounded at all, so how can they light up, even dimly? And why only this column? And why only when I add a 1K resistor between the lowest anode layer and the ground?  :smiley-eek:
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 30, 2013, 10:13 pm
OK, all problems are now fixed. After soldering in all the resistors for the anode layers and cathode columns, the ghosting is completely gone with 30 microseconds software delay after turning everything off before turning a new layer on (during multiplexing). I've updated the schematic and the printed circuit design accordingly:

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED_Cube_Circuit_V4_zpsff0662ae.jpg)

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED-Cube-Driver-Circuit-Dual-v2---Front_zps06d39f17.jpg)

(http://i1135.photobucket.com/albums/m638/BazsoDombiAndras/LED%20Cube/LED-Cube-Driver-Circuit-Dual-v2---Back_zps48bdf154.jpg)

Unfortunately the printed circuit has now grown to 14 x 12 cm because I had to fit 72 more resistors on it. I've already ordered one from a guy in town who makes PCBs, it cost me about 17$, let's hope it's perfect :)

As I wrote earlier, these resistors increase the power consumption of the cube by 72 mA in passive mode (when everything is off), which is something that I'm not happy with at all, but it's still better than ghosting...
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Pedro147 on Mar 30, 2013, 10:45 pm
Good to see that you finally sorted out your ghosting problems. It would have been a shame to see all that hard work go to waste  8) Looking forward to more info on the project when you have time, Pedro.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Mar 30, 2013, 11:24 pm
Yepp :)

Unfortunately the project is advancing slower tan expected. Also, spring is coming, so I'll have less time for it than in the winter. But even if slowly, I will make it happen :) And those articles on my blog will be written as I complete the steps in real life (the driving circuit, the 8x8x8 cube soldering and the software).

I've just found a great youtube video, by the way, in which Kevin Darrah explains multiplexing and bit angle modulation. The part that I found interesting is that the LEDs can be dimmed from software, so I'll make sure to include that in my code:
http://www.youtube.com/watch?v=I0sgqgUwIAQ (http://www.youtube.com/watch?v=I0sgqgUwIAQ)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Apr 14, 2013, 12:26 am
Hi guys!

Here's the next article in the series: the driving circuit for the 8x8x8 LED cube, based on CrossRoads' design:
http://iqjar.com/jar/building-an-8x8x8-led-cube-the-driving-circuit/ (http://iqjar.com/jar/building-an-8x8x8-led-cube-the-driving-circuit/)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: CrossRoads on Apr 14, 2013, 01:23 am
Pretty nice writeup! Good looking pictures too.
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Apr 14, 2013, 01:36 am
Thanks :)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Pedro147 on Apr 14, 2013, 03:45 am
Another well written and informative article Un4Seen. Ten points  8)
Title: Re: 8x8x8 multiplexed LED cube with an Arduino Mega 2560
Post by: Un4Seen on Apr 14, 2013, 08:57 am
Thank you! :) I do try. the next article will be about the construction of the cube itself. Unfortunately, based on progress so far,  I estimate that it will be done only about 6 to 8 weeks from now  :~