8x8x8 multiplexed LED cube with an Arduino Mega 2560

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:

    //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? :roll_eyes: