Step 1: The plan and result
I google then got some understanding about how to make a led cube. I drafted the circuit as below. That fits my needs that I can expand to 16x4x4 or even 16x16x16.
I was too eager to solder the led. After two days, with some painful mistakes like wrong polarity, short circuits, damaged led, finally come with the successful product.
The design needs 24 (16 + 8 ) npn transistors and 4x100ohms resistors (may be another 8 for as pull up transistors for y and z).
Basically three transistors together determine the on or off of a led. When all three transistors have high signal, i.e, x=1, y=1 and z=1, the led will be turned on.
At a single moment, only one led is turn on. To show a shape like a line, a rectangle or a cube, turn on the led that link as the shape one by one, then repeat for several times. E.g. a straight line needs to link four led on one edge, switch on each led one at a time then repeat the cycle for 100 times, you will see the straight line. That is the effect of POV.
To make expandable, I split the product as three modules: 1) led matrix; 2) drivers (the transistors) to turn on the led matrix; 3) a MCU to program the sequence of led on and off.