Ungrounded/Not activated layers in an LED cube light dimly

I built a prototype of a 4x4x4 LED cube circuit on a breadboard before committing it to a protoboard following the anode column/cathode layer approach with a set of current limiting resistors between the columns and an arduino controller and close the plane circuits with a set of 4 transistors in the software with an intent to only have a single plane on at a time. Many folks have built these. This is most closely modelled after this project and this one. As I’ve been testing my cube, I found that the fewer the leds that I have lit, the more pronounced an unpleasant effect is where other leds in an activated column (but unactivated plane) light dimly. I’m really unsure why these leds would light up. The effect seems more pronounced with fewer leds being lit at a single time and totally disappears when all 16 leds in a plane are lit. Surprisingly, if I remove all grounding that closes a circuit, the activated column still lights with a diffuse lighting across the leds in the column. I’ve linked a video that shows the effect in the hopes that someone can help me understand what’s wrong. The circuit is basically this minus the shift registers.

Help would certainly be appreciated!

David

Hi David. Can't view your video, you need to make it "public" on youtube.

I have a theory what is wrong, but need to see your sketch to confirm or otherwise. Please use code tags.
There is a common coding fault called "multiplexing bleed" that seems to fit some but maybe not all the symptoms you are seeing.

Paul

I built a prototype of a 4x4x4 LED cube circuit on a breadboard before committing it to a protoboard following the anode column/cathode layer approach with a set of current limiting resistors between the columns and an arduino controller and close the plane circuits with a set of 4 transistors in the software with an intent to only have a single plane on at a time. Many folks have built these. This is most closely modelled after this project and this one. As I’ve been testing my cube, I found that the fewer the leds that I have lit, the more pronounced an unpleasant effect is where other leds in an activated column (but unactivated plane) light dimly. I’m really unsure why these leds would light up. The effect seems more pronounced with fewer leds being lit at a single time and totally disappears when all 16 leds in a plane are lit. Surprisingly, if I remove all grounding that closes a circuit, the activated column still lights with a diffuse lighting across the leds in the column. I’ve linked a video that shows the effect in the hopes that someone can help me understand what’s wrong. The circuit is basically this minus the shift registers.

Help would certainly be appreciated!

David

Private video, can't see it.
Are you perhaps seeing reflection of lit LEDs on unlit LEDs?
I see that in my 9x9x9 cube (well, 7x9x9 so far), am wondering if dabbing bottom of each LED with flat black paint would help.

I know it's not a reflection, do take a look again: https://www.youtube.com/edit?o=U&video_id=8O-Z7RAQRX8&feature=vm

There's something clearly electrical in this that I don't understand/haven't been exposed to, just not sure what so I can't make it go away.

Just an idea: LEDs are not perfect diodes, they may suffer from a reverse current that is high enough to light other diodes dimly.

To find out more, connect in series an current limiting resistor, and two LEDs with anode connected to anode, so that no current should flow in either direction. Then check whether one of them will light when you apply 5V.

If so, I'd suggest that you put an ordinary diode in series with every LED, to reduce the reverse current.
It may be sufficient to insert a diode on every output to the LED anodes (not sure).

There's something clearly electrical in this that I don't understand/haven't been exposed to, just not sure what so I can't make it go away.

Measure the voltage on the parts that should have no voltage and see if there is any. If so, look to see if in your circuit you have a back feed path.

Paul, sorry, I made the video public. I moved the discussion here (accidental double post) with updated information: http://forum.arduino.cc/index.php?topic=326102.0

Okay, appreciate everyone who has been helping me with this. I've been working on debugging it and have some some useful information. I've been able to observe the problem with a simple sketch that initializes the pinMode on the LED's to output in setup, set a single LED on via an anode column pin set HIGH and transistor switching "on" for that plane to HIGH. Then I'd see the intended LED lit very brightly and remaining LEDs in the other planes for the column lit dimly.

So, then I tore the breadboarded circuit down removing bit by bit to see what was causing the closure of the circuits in the "other" planes that aren't supposed to be on and literally removed all but 4 columns where each one caused a plane to light up. For the life of me, I couldn't find a grounding electrical connection between column that was hooked up and the column that was set to HIGH.

What did I notice is that the effect only happens when the "offending" column's pin is enabled for OUTPUT. So, I actually can eliminate the effect by setting the pinMode to LED's that I don't want lit to INPUT which seemingly blocks whatever connection completion is happening. afaik, the docs suggest that a big ol' resistance goes into effect when you're in INPUT mode which could make sense to me that it blocks the completion of the circuit.

I haven't had a chance to measure the voltage as suggested, but it's sort of a qed per the above.

Does this make sense to anyone how I may have managed (inadvertently) to create something as such?

David

You still haven't posted your sketch.

when you switch pins back to INPUT, do you set them to LOW first? Wondering if the internal pullups are getting enabled.

Right.

Here's a video link: Single LED at a time with other "planes" lit - YouTube with a trivial sketch demonstrating the problem plus the code driving it:

#include <avr/pgmspace.h> // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
*/
int LEDPin[] = {A1, A0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int PlanePin[] = {19, 18, 17, 16};

// initialization
void setup()
{

  int pin; // loop counter
  // set up LED pins as output (active HIGH)
  for (pin = 0; pin < PLANESIZE; pin++) {
    pinMode( LEDPin[pin], OUTPUT );
  }
  // set up plane pins as outputs (active HIGH)
  for (pin = 0; pin < CUBESIZE; pin++) {
    pinMode( PlanePin[pin], OUTPUT );
  }
  //seeding random for random pattern
  randomSeed(analogRead(10));

}

/*
    With the anode leg set up, you need to digitalWrite the pin to HIGH, setting it to 5 volts
  	    led high = on
  	    led low = off
	and set the transistor's base to high to switch the cathode "plane" layer to drain collect in the one side
	and emit to ground, i.e. creating a potential difference and causing current to flow
 	    plane high = on
	    plane low = off
*/
void turnEverythingOff()
{
  for (int i = 0; i < PLANESIZE; i++)
  {
    digitalWrite(LEDPin[i], LOW);
  }
  for (int i = 0; i < CUBESIZE; i++)
  {
    digitalWrite(PlanePin[i], LOW);
  }
}

void loop()
{
  turnEverythingOff();
  //straight up cycle through cube, 1 led at a time
  for (int j = 0; j < CUBESIZE; j++) {
    for (int i = 0; i < PLANESIZE; i++) {
      digitalWrite(LEDPin[i], HIGH);
      digitalWrite(PlanePin[j], HIGH);
      delay(500);
      digitalWrite(LEDPin[i], LOW);
      digitalWrite(PlanePin[j], LOW);
    }
  }
}

Here's the same circuit wired up with slightly different code where I by default have pinmode on each pin to input until I use it: Single LED at a time - YouTube

#include <avr/pgmspace.h> // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
*/
int LEDPin[] = {A1, A0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int PlanePin[] = {19, 18, 17, 16};

// initialization
void setup()
{

  int pin; // loop counter
  // set up LED pins as output (active HIGH)
  for (pin = 0; pin < PLANESIZE; pin++) {
    //xxx commented out as a work around to the problem
    //pinMode( LEDPin[pin], OUTPUT );
  }
  // set up plane pins as outputs (active HIGH)
  for (pin = 0; pin < CUBESIZE; pin++) {
    pinMode( PlanePin[pin], OUTPUT );
  }
  //seeding random for random pattern
  randomSeed(analogRead(10));
  Serial.begin(9600);

}

/*
    With the anode leg set up, you need to digitalWrite the pin to HIGH, setting it to 5 volts
  	    led high = on
  	    led low = off
	and set the transistor's base to high to switch the cathode "plane" layer to drain collect in the one side
	and emit to ground, i.e. creating a potential difference and causing current to flow
 	    plane high = on
	    plane low = off
*/
void turnEverythingOff()
{
  for (int i = 0; i < PLANESIZE; i++)
  {
    digitalWrite(LEDPin[i], HIGH);
    //xxx Hack to block circuit close?
    pinMode(LEDPin[i], INPUT);
  }
  for (int i = 0; i < CUBESIZE; i++)
  {
    digitalWrite(PlanePin[i], LOW);
  }
}

void loop()
{
  turnEverythingOff();
  //straight up cycle through cube, 1 led at a time
  for (int j = 0; j < CUBESIZE; j++) {
    for (int i = 0; i < PLANESIZE; i++) {
      //xxx hack to change pinmode each time
      pinMode(LEDPin[i], OUTPUT);
      digitalWrite(LEDPin[i], HIGH);
      digitalWrite(PlanePin[j], HIGH);
      while (Serial.available() <= 0) {
        delay(500);
      }
      byte incomingByte = Serial.read();


      digitalWrite(LEDPin[i], LOW);
      //xxx hack to change pinmode each time
      pinMode(LEDPin[i], INPUT);
      digitalWrite(PlanePin[j], LOW);
    }
  }
}

Looking for understanding of what's up...

plus the code driving it:

#7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html

PaulRB:
need to see your sketch to confirm or otherwise. Please use code tags.

I asked nicely, why have you refused this simple request?

Ah, thanks for clarifying all -- I edited the post w/proper code tags.

In any case, insight is welcome

dvberger:
Ah, thanks for clarifying all -- I edited the post w/proper code tags.

I'm afraid its not much better. Indentation has been lost and its full of other format tags. So still pretty unreadable. Can you re-post direct from the IDE with code tags please.

dvberger:
In any case, insight is welcome

Can you provide a schematic showing how, and what model, of transistors you are using? While I still think we should check your sketch, another possible reason for the unwanted dim leds is that the transistors for the inactive planes are leaking a small current when they are supposed to be off. With modern high brightness leds, even a tiny current can light them (for example I have some that are surprisingly bright even with 10K series resistors!).

Okay, modified the code again above.

These are the transistors: http://www.onsemi.com/pub_link/Collateral/BC337-D.PDF

Dropbox - Error is a link to the circuit diagram.

If there are any ideas, again, interested!

David

It could be that the four transistors are in "deep saturation".
Slow switching could light up other LEDs.

Use higher value base resistors (220ohm).
And add schottky diodes (e.g. 2N3819) between base and collector, cathode to collector (Baker clamp).
Leo..

P.S. Found a Youtube video explaining this.

Wawa:
It could be that the four transistors are in "deep saturation".
Slow switching could light up other LEDs.

Use higher value base resistors (220ohm).

I would have used much higher base resistors - around 2K2.

With 130R series resistors, if all 16 leds on a later are lit, total current would be around 200mA. You would only need around 2mA base current, assuming roughly 100 current gain, so a 2K2 should still be high enough.

Eck -- serious, "I'm doing that late at night" problem. Those are 2.2K base resistors on the transistors.

Change any of the comments?

Haven't had a chance to see the video yet...

I reviewed your code again. Can't see that it would cause the "ghosting" issue I was worried about. That occurs when the led anodes in a layer are updated for the next layer before the common cathode for the previous level is switched off. But your code isn't doing that, its switching off the layer/cathode, updating the anodes and then switching the next later/cathode, which avoids the ghosting issue.

I use bc337 transistors a lot, and I've never seen this problem with them.

What happens if you don't multiplex? Just get the sketch to set up one led on one layer, switch it on and leave it. Do you still see the ghosting in other layers?