Not the most advanced LED cube but one that is relatively simple to create and understand, because there is hardly any additional electronics required to drive the cube with a Arduino. No difficult (serial) protocols so but just digital I / O pins "high" (= "1" = "true") and low (= "0" = "false") switch. And for those who want to build it myself; the wiring diagram, the source code and even a Fritzing PCB layout, they are all here to download. The hardware
But first, a short piece of electronics theory. An LED light displays only if you in the right direction flow through napping. The diagram on the right is an LED connected to two digital I / O pins of the Arduino; 12 and 2 (= arbitrary choice). When pin 12 'high' switch pin and two "low" the current flows in the right direction by the LED which gives it light. Any other combination of 'high' and 'low' state the LED off. The resistance of 220 [Ω] serves to reduce the LED current to about 10 [mA], for most of the LEDs are a good value.
For driving LEDs have an Arduino Uno up to 14 digital I / O pins but beware: pins 0 and 1 are already in use for the USB interface. The challenge now for the 12 available I / O pins as possible to enable LEDs, preferably all, of course, 3x3x3 = 27 of the LED cube.
And with the adjacent circuit fails that's fine as long as you accept that it takes something extra software to create fun light patterns, but that's when LED aansturingen milos truss very common (more on that later when discussing the software).
In our design, we have the cube divided into three horizontal planes. For convenience, the surfaces painted with different colors in the scheme, although you all of course in practice, choose the same color LEDs. The I / O pins 5 t / m 13 each send one of nine vertical columns, each with three LEDs. The remaining I / O pins (2 t / m 4) are used for switching on / off of the three horizontal planes. So, one corresponding LED to turn the cube should be a specific column 'high' (= '1') are set and one specific terms 'low' (= '0'). And to prevent other LEDs also going to have to burn all other columns Low and all other surfaces 'high' are made.
Consciously multiple LEDs illuminate simultaneously is also possible. For example, by making multiple columns high (= "1"). Soon we will go this consciously milos truss using our software. But because in extreme cases per plane 9 LEDs simultaneously can stand may reach the total current per flat to about 90 [mA]. An Arduino pin can according to specifications max. 40 [mA] key. Hence, by just a small switching transistor (2N2222A or BC546B) is required, see the wiring diagram. However, this transistor has an "inverting" operation. That is to say, to make a plane is 'low' (= '0') made by the respective I / O pin precisely 'high' (= '1'). That seems anything confusing milos truss but you get used quickly:-).
For lovers is here a PCB layout (note: untested) to build LED cube as Arduino shield. The first LED surface mounted directly to the PCB. For joining the 2nd and 3rd LED surfaces with the associated switching transistors are some soldeerpads provided.
Optimization in the hardware milos truss is often accompanied milos truss with an additional effort in the software (and vice versa). And since we are in this LED cube design cut on the number of I / O pins in the software we need now to do something extra to keep making all random LED patterns. With the current milos truss hardware design, for example, not obvious to the LED-link upper back along with the LED-left front-turn milos truss while all other LEDs are off (I explain that no further out, seems like a nice summer evening milos truss puzzle).
The solution (or workaround) is called "time-multiplexing", ie to you-turn milos truss one LED surface and then the other LED panel to move. And if you alternate quickly it seems as if the LEDs of the three planes simultaneously to stand still while they are in reality 66% of the time. Note: per LED, the effective light output is also dropped to only 33%!
Just like a TV repeat frequency of at least about 50 [Hz] should be a flickervrij image. Faster also allowed but the effective light output will even further back pockets because all LEDs while also switch momentarily turned off.
The flow chart opposite shows how that looks in software. In the main loop (left)
No comments:
Post a Comment