Some time ago I had planned to build a LED cube like the ones seen on the net. They seem interesting artifacts with great animation effects, and they are devices with huge programming possibilities.
It could be said that it is a three-dimensional display although of very low resolution, since each pixel (in 3D they are called “voxels”) is actually a discrete LED, in this case 3mm in diameter and the set consists of a total of 512 LEDs that can be turned on or off completely independently or, at least that is the impression that the human eye perceives.
Controlling all of them completely independently would require 513 signals in the case of a common cathode configuration. This is outside the limits imposed by common sense. We will take advantage of the relative slowness of the human eye and what is known as “persistence of vision” (images are maintained for a while in the retina and therefore in the visual cortex even when they no longer exist in the real world) and in this way Illuminating sequentially (not simultaneously) the LEDs will achieve the illusion that they turn on and off independently and simultaneously.
The 512 LEDs of an 8x8x8 cube are organized into 8 layers or floors of 64 LEDs each (8×8). All the LEDs of a layer are connected in common cathode, so if we connect that cathode to 0V and apply a positive voltage on the anodes we can turn on each of them separately. On the other hand, all those belonging to the same column (one of each layer, same x,y position, but different z) are connected in common anode. If we apply 0V on that anode they will never light up and if, on the contrary, we apply a positive voltage, only those belonging to a layer whose cathode is set to 0V will light up. In short, we have 64 wires connected to anodes (columns) and 8 wires connected to cathodes (layers).
Visualization will be made one layer after another sequentially, that is, layer 1: voltage is applied to the anodes of the LEDs that should be illuminated in layer 1 and once they are all correct, the common cathode of layer1 is put to ground (0V) , but only that of this layer (the others with resistors of “pull-up” to positive). This illuminates the LEDs of layer1. We disconnect the cathode (turn off) and repeat the process for the next layers, one after another, and so on. Fast enough it seems that all layers light up at once. I am keeping each layer ON for two milliseconds and not even the slightest flickering is observed.
A logical consequence of this way of proceeding is that each LED is only ON for 1/8 of the time and it would be reasonable to perceive some type of blinking.
As for the construction process I would not say that it entails great difficulty if you have some experience in tin welding. What is clear is that if it involves large doses of patience, a lot of calm, no hurry and some delicacy in the procedures used if we want to obtain a minimally acceptable result.
A low count shows that the construction of the structure formed by the interconnected LEDs already involves 1024 welds plus another 512 in my case since I have added a mesh of 8×8 wire bars in each layer for reasons of robustness and, of course , pure geometric aesthetics.
Before starting with the construction of the structure we will decide what separation we want to have between two consecutive LEDs and if this allows direct welding of the terminals of these or, on the contrary it is necessary to use vertical wire bars. If we opt for a value that is too low, the LEDs through the cube would not look good and, in addition, the light of some would illuminate the contiguous ones, leaving, on the other hand, a cube too small for my liking. I have seen that many people opt for a separation of 25mm, which allows direct welding with the length of the terminals of most LEDs that we can find in the market. The ones that I have bought are too short and less than 25mm apart seems to me little so I have decided to complicate my life a bit and use both vertical and horizontal wire bars to weld the 512 LEDs, opting for a separation of 30mm, which it will result in a “a little big” cube.
Everyone who has some experience in welding electronic components knows that tin does not readily adhere to any metal. The galvanized wire that I used has behaved in this regard better than I expected and it has not been necessary to use additives such as “flux” that improve adhesion. If it is convenient to observe a perfect hygiene of the welding tools and proceed with enough patience.
In a sturdy cardboard of sufficient thickness I have marked a grid and I have drilled with a punch and later with a LED the 64 holes that will determine the position of each led. Using this template, the LEDs are introduced row by row by welding their cathodes to wire rods, leaving the anodes in a vertical direction. Once all are put on, 8 transverse wire bars are welded and we have a finished layer.
With two or three layers finished I have proceeded to weld the 64 vertical wires to which the anodes are connected and physically join the different layers. By the way, to get sufficiently straight wire rods I have subjected pieces of a couple of meters to tensile stress and cut them to the necessary length, obtaining a very acceptable result. With the help of a support for welding provided with tweezers I have been welding the bars.
Subsequently, the layers of LEDs are placed respecting the vertical separation of 30mm and are welded, obtaining an increasingly robust and comfortable to handle structure. As we add new layers it looks more like the goal we had in mind.
With the most laborious part finished (or, at least I thought so) I immersed myself in the design and construction of control electronics. The task in principle is not simple: 64 anodes + 8 cathodes must be handled, which makes a total of 72 control lines. It is a clearly excessive number for the microcontrollers that we use regularly and we will require multiplexing techniques, which means that with relatively few MCU input / output lines and some external circuitry we will handle those 72 signals. There are several classic solutions to this problem using, for example, flip-flops or shift registers with serial input and parallel output, which is the solution that I have chosen. It is not very common but I have not done any scheme prior to the construction of the control board but I hope to do so soon. Meanwhile say that there are interesting schemes (as well as the rest of the content) at https://www.instructables.com/id/Led-Cube-8x8x8/ and it’s worth taking a look.
I have opted for the use of ESP8266 with the advantage of the built-in Wi-Fi and Bluetooth and 80MHz process speed that exceeds five times usually arduino AVR based boards. This board has its pros and cons and has a rather small number of input / output or gpio lines (general purpose input output). Although in principle there are 17 gpios available, many are shared with other functions that are used internally for, for example, the Wi-Fi module or the internal flash memory, so in the end there are only 9 useful lines (11 if we use rx and tx of the serial port, which is possible without any problem). I have been able to design my circuit using only 10 gpio lines, 8 for the data bus shared by the 8 shift registers and the 8 transistors that ground the cathodes, a clock line and one that I call “cathode enable” that handles a MOSFET that puts (or not) the emitters of the BJTs to ground, allowing that signals present in the bases of the BJTs do not generate unwanted luminosity in the LEDs, since it does not finish closing the circuit to ground or, seen from otherwise, the BJT remain open because its base intensity is zero.