LED Cube 8x8x8

72 Schritt:Schritt 1: Erforderliche Fähigkeiten Schritt 2: Komponentenliste Schritt 3: Bestellung von Komponenten Schritt 4: Was ist eine LED-Würfel Schritt 5: Wie funktioniert eine LED Würfel Arbeit Schritt 6: Die Anatomie eines LED Würfel Schritt 7: Cube Größe und IO-Port Anforderungen Schritt 8: IO-Port Expansion, mehr Multiplexing Schritt 9: IO-Port-Erweiterung, alternative Lösung Schritt 10: Stromversorgung Überlegungen Schritt 11: Kaufen Sie ein Netzteil Schritt 12: Erstellen Sie eine Stromversorgung Schritt 13: Wählen Sie Ihre LEDs Schritt 14: Wählen Sie Ihre Widerstände Schritt 15: Wählen Sie die Größe Ihrer cube Schritt 16: Wie man gerade Draht machen Schritt 17: Praxis im kleinen Maßstab Schritt 18: Erstellen Sie den Cube: Erstellen Sie eine Spannvorrichtung Schritt 19: Erstellen Sie den Cube: Löten Beratung Schritt 20: Erstellen Sie den Cube: Testen der LEDs Schritt 21: Erstellen Sie den Cube: löten eine Schicht Schritt 22: Erstellen Sie den Cube: testen Sie die Schicht Schritt 23: Erstellen Sie den Cube: straigthen die Stifte Schritt 24: Erstellen Sie den Cube: biegen Sie die Stifte Schritt 25: Erstellen Sie den Cube: löten die Schichten miteinander Schritt 26: Erstellen Sie den Cube: schaffen die Basis Schritt 27: Erstellen Sie den Cube: montieren Sie die Würfel Schritt 28: Erstellen Sie den Cube: Kathode Tragegurte Schritt 29: Erstellen Sie den Cube: Anschließen von Kabeln Schritt 30: Erstellen Sie die Controller: layout Schritt 31: Erstellen Sie die Controller: Taktfrequenz Schritt 32: Erstellen Sie die Controller: Lochrasterplatinen Löten Beratung Schritt 33: Erstellen Sie den Regler: Stromanschluss und Filterkondensatoren Schritt 34: Erstellen Sie die Controller: IC-Fassungen, Widerstände und Anschlüsse Schritt 35: Erstellen Sie den Regler: Stromschienen und IC Strom Schritt 36: Erstellen Sie die Controller: Verbinden Sie die ICs, 8bit-Bus + OE Schritt 37: Erstellen Sie die Controller: Adresswahl Schritt 38: Erstellen Sie die Controller: AVR Board Schritt 39: Erstellen Sie die Controller: Transistor-Array Schritt 40: Erstellen Sie die Controller: Buttons und Status-LEDs Schritt 41: Erstellen Sie die Controller: RS-232 Schritt 42: Erstellen Sie die Controller: Stellen Sie eine RS-232-Kabel Schritt 43: Erstellen Sie die Controller: Verbinden Sie die Bretter Schritt 44: Erstellen Sie die Controller: Verbinden Sie die Würfel Schritt 45: Programmieren Sie die AVR: Stellen Sie die Sicherung Bits Schritt 46: Programmieren Sie die AVR mit Testcode Schritt 47: Testen Sie den Würfel Schritt 48: Programmieren Sie die AVR mit echten Code Schritt 49: Software: Einleitung Schritt 50: Software: So funktioniert es Schritt 51: Software: IO-Initialisierung Schritt 52: Software: Modusauswahl und Zufallsstart Schritt 53: Software: Interrupt-Routine Schritt 54: Software: Low-Level-Funktionen Schritt 55: Software: Cube virtuellen Raum Schritt 56: Software: Effect launcher Schritt 57: Software: Effect 1, regen Schritt 58: Software: Effect 2, Ebene boing Schritt 59: Software: Effect 3, sendvoxels Zufalls Z Schritt 60: Software: Effect 4, Box shrinkgrow und woopwoop Schritt 61: Software: Effect 5, Achse updown randsuspend Schritt 62: Software: Effect 6, stringfly Schritt 63: Software: RS-232-Eingang Schritt 64: PC Software: Einleitung Schritt 65: PC Software: Cube Updater Gewinde Schritt 66: PC Software: Effect 1, Wellen Schritt 67: PC Software: Effect 2, sidewaves Schritt 68: PC Software: Effect 3, Feuerwerk Schritt 69: PC Software: Effect 4, Conways Spiel des Lebens 3D Schritt 70: Führen Sie den Würfel auf einem Arduino Schritt 71: Hardware-Debugging: Unterbrochene LEDs Schritt 72: Feedback

LED Cube 8x8x8
Erstellen Sie Ihre eigenen 8x8x8 LED Cube 3-dimensionale Darstellung!

Wir glauben, dies Instructable ist die umfassendste Schritt-für-Schritt-Anleitung, um einen 8x8x8 Cube LED immer auf den intertubes veröffentlicht bauen. Es wird euch alles lehren von Betriebstheorie, wie man den Würfel zu bauen, um das Innenleben der Software. Wir werden Sie über die Software Schritt für Schritt zu nehmen, sowohl die Niedrigniveau-Treiber / Routinen und wie genial Animationen zu erstellen. Die Software Aspekt der LED Würfel wird oft übersehen, aber ein LED-Würfel ist nur so genial wie die Software läuft.

Etwa in der Mitte der Instructable, werden Sie tatsächlich eine voll funktionsfähige LED-Würfel. Die verbleibenden Schritte zeigen, wie Sie die Software zu erstellen.

Ein Video sagt mehr als tausend Worte. Ich werde einfach lassen Sie es bis zu diesem Video, Sie zu überzeugen, dass dies das nächste Projekt werden Sie Gebäude sein:


Ich habe diese LED Cube zusammen mit meinem Freund Kühler. Der Build dauerte etwa 4 Tagen kleinen Prototypen abgeschlossen Würfel. Dann noch ein paar Stunden, einige fehlerhafte Transistoren zu debuggen.

Die Software ist wahrscheinlich noch 4-5 Tage der Arbeit kombiniert.

Schritt 1: Erforderliche Fähigkeiten

  1. LED Cube 8x8x8
    Auf den ersten Blick vielleicht wie ein Projekt zu komplex und gewaltige Aufgabe. Wir sind jedoch mit digitaler Elektronik hier zu tun haben, so ist alles entweder an oder aus!

    Ich mache Elektronik für eine lange Zeit, und für die Jahre, die ich mit analogen Schaltungen kämpfte. Die analogen Schaltungen ausgefallen mehr als die Hälfte der Zeit, auch wenn ich folgte den Anweisungen. Ein Widerstand oder Kondensator mit einer etwas falschen Wert, und die Schaltung funktioniert nicht.

    Vor ca. 4 Jahren, beschloss ich, Mikrocontroller versuchen. Diese meine Beziehung mit Elektronik völlig verändert. Ich ging von nur in der Lage, einfache analoge Schaltungen zu bauen, um in der Lage, fast alles zu bauen!

    Eine digitale Schaltung sich nicht, wenn ein Widerstand 1 kOhm oder 2k Ohm, so lange sie können Hoch von niedrigen zu unterscheiden. Und glauben Sie mir, das macht es viel einfacher, um Elektronik zu tun!

    Mit dieser sagte, gibt es noch einige Dinge, die Sie wissen sollten, bevor Sie sich und den Aufbau dieser ziemlich großen Projekt.

    Sie sollten ein Verständnis haben:
    Grundlagen der Elektronik. (Wir würden gegen den Bau dieses als Ihre erste Elektronik-Projekt empfehlen. Aber lesen Sie bitte die Instructable. Sie werden noch viel lernen!) So löten. Wie man ein Multimeter, etc. Schreiben von Code in C (optional. Wir bieten Ihnen eine voll funktionsfähige Programm, bereit zu gehen) Sie sollten auch Geduld und eine großzügige Menge Freizeit.

Schritt 2: Komponentenliste

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 12 Artikel anzeigen
    Hier ist, was Sie brauchen, um eine LED-Würfel zu machen:
    512x LEDs (plus ein paar Pfunde zu, Fehler zu machen!) 64x Widerstände. (Siehe separaten Schritt für Ohm-Wert) 1x oder 2x große Leiterplatten-Prototypen. Der Typ mit Kupfer "Augen", siehe Abbildung. 1x ATmega32 Mikrocontroller 3x Status-LEDs (Sie können auch die Pin-kompatibel ATmega16 verwenden). Sie wählen Farbe und Größe. 3x Widerstände für die Status-LEDs. 8x 74HC574 ICs 16x PN2222 Transistoren 16x 1k Widerstände 1x 74HC138 IC 1x Maxim MAX232 IC 1x 14,7456 MHz Krusten 2x 22pF Keramik-Kondensatoren 16x 0,1 uF Keramik-Kondensatoren Elektrolyt-Kondensator 1000uF 3x 3x 10uF Elektrolytkondensator 1x Elektrolytkondensatoren 100uF 8x 20-poliger IC-Sockel 1x 40-Pin-IC Buchse 2x 16 pin IC-Sockel 1x 2-polige Schraubklemme 1x 2-Draht-Kabel mit Steckern 9x 8-Pin-Anschlussstifte 1x 4-poliger Anschlussstifte, rechtwinklig 2 x 16-poligen Flachbandkabel-Stecker 1x 10-Pin Flachbandkabel Flachbandkabel 2x Drucktasten 2x Flachbandkabel-Stecker 9x 8-Pin-Buchsenleiste Stecker Serielles Kabel und 4pin Buchsenleiste Stück Holz für Vorlage und Basis 8x optional Pull-up-Widerstände für Schichten 5V Versorgungsspannung (siehe separaten Schritt für die Stromversorgung) Geschätzte Gesamt Baukosten: 67 USD. Siehe beiliegenden Preisliste.

Schritt 3: Bestellung von Komponenten

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Wir sehen eine Menge Leute fragen, Teilenummern für DigiKey, Mouser oder anderen großen Elektronik-Läden.

    Wenn Sie mit Hobby Elektronik arbeiten, die Sie nicht unbedingt benötigen, die teuersten Komponenten mit der besten Qualität.

    Die meiste Zeit ist es wichtiger, tatsächlich die Komponentenwert bei der Hand, wenn Sie es brauchen.

    Wir sind große Fans der Kauf wirklich billig Komponente viel auf eBay. Sie können Zusammenstellungen von Widerstand, Kondensatoren, Transistoren und alles dazwischen zu bekommen. Wenn Sie diese Art von Sortimenten kaufen, werden Sie fast immer die Teile, die Sie in Ihrem Teil Sammlung benötigen.

    Für 17 USD können Sie 2000-Widerstände von 50 verschiedenen Werten zu erhalten. Großen Wert, und sehr bequem.

    Versuchen Sie som eBay Suchen und kaufen einige Komponenten für zukünftige Projekte!

    Ein weiteres einer unserer Lieblings-Shops ist Futurlec ( http://www.futurlec.com/ ). Sie haben alles, was Sie brauchen. Das, was sie nicht haben 1000 verschiedene Versionen von diesem, was Sie brauchen, damit die gerade ihr Inventar ist viel weniger verwirrend als der Kauf von den größeren Unternehmen.

Schritt 4: Was ist eine LED-Würfel

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    Eine LED-Würfel ist wie ein LED-Bildschirm, aber es ist etwas Besonderes, dass sie eine dritte Dimension hat, so dass es 3D. Betrachten Sie es als viele transparent niedriger Auflösung angezeigt. In normalen Displays ist es normal, um zu versuchen, um die Pixel so nahe wie möglich, um es besser aussehen zu stapeln, aber in einem Würfel muss man in der Lage, um zu sehen Trog es sein, mehr Abstand zwischen den Pixeln (eigentlich ist es Voxel, da es in 3d) ist erforderlich. Der Abstand ist ein Kompromiss zwischen wie einfach die Schichten dahinter zu sehen ist, und Voxel Treue.

    Da es viel mehr Arbeit, einen LED-Würfel als eine LED-Anzeige, sind sie in der Regel niedriger Auflösung. Eine LED-Anzeige der 8x8 Pixel ist nur 64 LEDs, aber ein LED-Würfel in 8x8x8 ist 512 LEDs, um eine Größenordnung schwieriger zu machen! Dies ist der Grund LED-Würfel werden nur in niedriger Auflösung hergestellt.

    Eine LED-Würfel nicht symmetrisch zu sein, ist es möglich, einen 7x8x9 oder sogar seltsam geformte diejenigen zu machen.

Schritt 5: Wie funktioniert eine LED Würfel Arbeit

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Diese LED-Würfel hat 512 LEDs. Offensichtlich mit einem dedizierten IO-Port für jede LED wäre sehr unpraktisch. Sie möchten gerne ein Mikro-Controller mit 512 IO-Ports benötigen, und führen 512 Adern durch die Würfel.

    Stattdessen verlassen LED-Würfel auf ein optisches Phänomen, das als Fortsetzung der Vision (POV).

    Wenn Sie blinkt eine LED sehr schnell, wird das Bild auf der Netzhaut für eine kleine Weile bleiben, nachdem die LED erlischt.

    Durch Blinken jede Schicht des Würfels einer nach dem anderen wirklich sehr schnell, es gibt die Illusion eines 3D-Bild, wenn int Tatsache, Sie sind auf einer Reihe von 2D-Bildern ontop oneanother gestapelt suchen. Dies wird auch als Multiplexing.

    Mit diesem Setup, brauchen wir nur 64 (für die Anoden) + 8 (für jede Schicht) IO-Ports, um die LED Würfel steuern.

    In dem Video wird der Prozess sich ausreichend verlangsamt, damit Sie es sehen, dann läuft er schneller und schneller, bis die Aktualisierungsrate ist schnell genug für die Kamera, die POV-Effekt zu fangen.

Schritt 6: Die Anatomie eines LED Würfel

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Wir werden über die Anoden, Kathoden, Spalten und Schichten zu sprechen, so lassen Sie uns einen Moment Zeit, um sich mit der Anatomie eines LED Cube vertraut.

    Eine LED hat zwei Beine. Eine positive (Anode) und eine negative (Kathode). Um leuchtet eine LED, müssen Sie auf die negative Bein laufen Strom von der positiven. (Wenn ich mich richtig erinnere die tatsächliche Elektronenfluss ist umgekehrt. Aber lassen Sie uns auf den Stromfluss, der von positiv zu negativ ist für jetzt bleiben).

    Die LED-Würfel besteht aus Spalten und Schichten. Die Kathoden Stränge jeder LED in einer Schicht miteinander verlötet. Alle Anoden Beine in einer Spalte sind miteinander verlötet.

    Jede der 64 Säulen werden auf dem Controller Board mit einer separaten Leitung verbunden. Jede Spalte kann individuell gesteuert werden. Jedes der 8 Lagen auch einen separaten Draht gehen, um die Controller-Platine.

    Jede der Schichten mit einem Transistor, der die Würfel ermöglicht das Ein- und Ausschalten des Stromflusses durch jede Schicht wiederum mit.

    Nur durch Einschalten des Transistors zu einer Schicht, von der Anode Spalten nur durch diese Schicht zu strömen. Die Transistoren für die anderen Schichten aus sind, und die auf den Anodendrähten 64 ausgegebenen Bildes werden nur auf der gewählten Ebene dargestellt.

    Um die nächste Ebene angezeigt werden, schalten Sie einfach den Transistor für die aktuelle Schicht, ändern Sie das Bild auf der 64 Anodendrähte zu dem Bild für die nächste Schicht. Schalten Sie dann den Transistor für die nächste Schicht. Spülen und wiederholen sehr sehr schnell.

    Die Schichten werden als Schichten, Kathodenschichten und Bodenschichten genannt.
    Die Spalten werden als Spalten, die Anode oder Anoden-Spalten bezeichnet.

Schritt 7: Cube Größe und IO-Port Anforderungen

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    Um eine LED-Würfel zu fahren, müssen Sie zwei Sätze von IO-Ports. One, alle LED-Anode Spalten beziehen, und man alle Kathodenschichten sinken.

    Für die Anodenseite des Würfels, werden Sie x ^ 2 IO-Ports, wobei x ^ 3 ist die Größe der LED Würfel müssen. Für einen 8x8x8 (x = 8), müssen Sie 64 IO-Ports, um die LED-Anoden zu fahren. (8x8). Sie müssen auch 8 IO-Ports, um die Kathoden zu fahren.

    Beachten Sie, dass die Anzahl der IO-Ports wird exponentiell erhöhen. So wird die Anzahl der LEDs. Sie können eine Liste der IO Pin Voraussetzung für verschiedene Würfelgrößen in Tabelle 1 zu sehen.

    Für eine kleine LED-Würfel, 3x3x3 oder 4x4x4, könnten Sie weg mit Verbinden der Kathodenschichten direkt an einen Mikrocontroller IO Pin zu erhalten. Für eine größere Würfel jedoch der Strom, der durch diesen Stift zu hoch sein wird. Für einen 8x8x8 LED Würfel mit nur 10mA pro LED, müssen Sie 0,64 Ampere schalten. Siehe Tabelle 2 für einen Überblick über Leistungsanforderungen für eine LED-Schicht in verschiedenen Größen. Diese Tabelle zeigt die Stromaufnahme mit allen LEDs auf.

    Wenn Sie planen, eine größere als Würfel 8x8x8 bauen oder zu laufen jede LED bei mehr als 10-ish mA, denken Sie daran, zu berücksichtigen, dass Ihre Schicht-Transistoren müssen in der Lage, diese Last zu bewältigen sein zu nehmen.

Schritt 8: IO-Port Expansion, mehr Multiplexing

  1. LED Cube 8x8x8

    Wir versammelten uns aus dem letzten Schritt, dass ein 8x8x8 LED Würfel benötigt 64 + 8 IO Linien zu bedienen. Kein AVR Microcontroller mit einem DIP-Gehäuse (die Art der Durchgangsbohrung Chip können Sie ganz einfach zu löten oder Verwendung in einem Steckbrett, Dual Inline Package) haben, dass viele IO-Leitungen zur Verfügung.

    Um die erforderlichen 64 Ausgangsleitungen für die LED-Anoden erforderlich, werden wir einen einfachen Multiplexer-Schaltung zu schaffen. Dieser Kreislauf wird 11 IO Leitungen in 64 Ausgangsleitungen zu multiplexen.

    Der Multiplexer wird durch die Verwendung einer Komponente genannt Klinke oder ein Flip-Flop aufgebaut. Wir nennen sie einrastet von hier an.

    Dieser Multiplexer verwendet ein 8 Bit-Zwischenspeicher IC 74HC574 genannt. Dieser Chip hat die folgenden Stifte:
    8 Eingänge (D0-7) 8 Ausgänge (Q0-7) 1 "einrasten" pin (CP) 1 Ausgangsfreigabestift (OE)
    Der Job des Latch ist als eine Art einfache Speicher dienen. Der Riegel 8 Bit Information halten, und diese 8 Bits werden auf die Ausgangsstifte dargestellt. Betrachten Sie einen Riegel mit einer LED zur Ausgabe Q0 verbunden. Um dies zu LED einzuschalten, gelten V + (1) zur Eingabe D0, ziehen Sie dann den CP Pin low (GND), dann hoch (V +).

    Wenn der CP-Pin von niedrig bis hoch, wird der Zustand des Eingangs D0 "verriegelt" auf den Ausgang Q0, und dieses Ausgangs Aufenthalte in diesem Zustand unabhängig von künftigen Änderungen des Status der Eingangs D0, bis neue Daten durch Ziehen geladen der CP pin niedrigen und hohen erneut.
    Um eine Verriegelung Array, das die Ein- / Aus-Zustand der 64 LEDs erinnern kann machen brauchen wir 8 dieser Verriegelungen. Die Eingänge D0-7 aller Verriegelungen werden in einem 8-Bit-Bus verbunden.

    Um den Ein- / Aus-Zustände aller 64 LEDs wir einfach tun dies zu laden: Laden Sie die Daten des ersten Latch auf den Bus. ziehen Sie den CP Stift des ersten Latch Low dann hoch. Laden der Daten des zweiten Latch auf den Bus. ziehen Sie den CP Stift des zweiten Latch Low dann hoch. Laden die Daten des dritten Latch auf den Bus. ziehen Sie den CP-Pin des dritten Latch Low dann hoch. Spülen und wiederholen.

    Das einzige Problem mit diesem Setup ist, dass wir 8 IO-Leitungen, um den CP Zeile für jeden Riegel zu steuern. Die Lösung besteht darin, einen 74HC138 verwenden. Das IC verfügt über 3 Eingangsleitungen und 8 Ausgänge. Die Eingangsleitungen werden verwendet, um zu steuern, welche der 8 Ausgangsleitungen, die zu jedem Zeitpunkt einen niedrigen Pegel gezogen wird. Der Rest wird hoch sein. Jeder aus der Ausgänge auf der 74HC138 ist mit dem CP Stift an einem der Zwischenspeicher verbunden ist.

    Der folgende Pseudocode wird der Inhalt einer Puffer-Array auf den Latch-Array zu laden:

    // PORT A = Datenbus
    // PORT B ​​= Adreßbus (74HC138)
    // Char buffer [8] enthält 64 Datenbits für die Verriegelungsanordnung

    PORTB = 0x00; // Dies zieht CP auf Falle 1 gering.
    for (i = 0; i <8; i ++)
    {

    PORTA = Puffer [i];
    PORTB = i + 1;

    }

    Die Ausgänge des 74HC138 aktiv LOW. Das bedeutet, dass der Ausgang, der aktiv ist niedrig gezogen. Der Verriegelungsstift (CP) auf der Klinke einen Flankentrigger, was bedeutet, dass die Daten zwischengespeichert, wenn sie von LOW zu HIGH wechselt. Um die richtige Verriegelung auszulösen, muss der 74HC138 einen Schritt voraus des Zählers i bleiben. Wenn es einen aktiven hohen Chip gewesen, könnten wir PORTB schreiben = i; Sind Sie wahrscheinlich denken, was passiert, wenn der Zähler 7, das würde bedeuten, dass der Ausgang auf PORTB ist 8 (1000 binär) auf der letzten Iteration der for () -Schleife. Nur die ersten 8 Bits des Anschlusses B sind an die 74HC138 verbunden. Also, wenn Port B Ausgänge 8 oder 1000 in binären, die 74HC138 liest 000 in binäre, womit seine Zyklus. (Es begann bei 0). Die 74HC138 gibt nun die folgende Sequenz: 1 2 3 4 5 6 7 0, wodurch ein Wechsel von LOW nach HIGH für die aktuelle Zwischenspeicher nach Zähler i.

Schritt 9: IO-Port-Erweiterung, alternative Lösung

  1. LED Cube 8x8x8
    Es ist eine weitere Lösung für die Bereitstellung von mehreren Ausgangsleitungen. Wir gingen mit dem Riegel basiert Multiplexer, weil wir beim Bau der LED Würfel hatte 8 Verriegelungen erhältlich.

    Sie können auch eine Seriell-in-Parallel-Schieberegister auf 64 Ausgangsleitungen zu erhalten. 74HC164 ist ein 8-Bit-Schieberegister. Dieser Chip verfügt über zwei Eingänge (kann auch ein Ausgangsfreigabestift, aber wir werden dies in diesem Beispiel zu ignorieren).
    Datentakt Jedesmal, wenn der Takteingang wechselt von niedrig bis hoch, werden die Daten in Q6 in Q7, Q5 in Q6, Q4 in Q5 und so weiter bewegt. Alles wird um eine Position nach rechts verschoben werden (unter der Annahme, daß Q0 ist auf der linken Seite). Der Zustand des Dateneingangsleitung in Q0 verschoben.

    Die Art, wie Sie normalerweise Daten in einem Chip so zu laden, ist es, ein Byte und Bit-Shift es in den Chip ein Bit zu einer Zeit in Anspruch nehmen. Dieses verwendet viele CPU-Zyklen. Allerdings haben wir bis 8 Verwendung dieser Chips, unsere gewünschten 64 Ausgangsleitungen zu erhalten. Wir einfach den Dateneingang jedes Schieberegisters zu jedem der 8 Bit für einen Port auf dem Mikro-Controller. Alle Takteingänge sind miteinander verbunden und an einem anderen IO-Port einen Stift verbunden ist.

    Dieses Setup wird 9 IO Linien auf der Mikro-Controller zu verwenden.

    In der bisherigen Lösung wurde jedes Byte im Puffer-Array in einem eigenen Zwischenspeicher IC gelegt. In dieser Konfiguration wird jedes Byte über alle 8 Schieberegister verteilt werden, wobei ein Bit in jedem.

    Der folgende Pseudocode wird der Inhalt eines 64-Bit-Puffer-Array in die Schieberegister zu übertragen.

    // PORT A: Bit 0 mit dem Schieberegister 0 Die Dateneingabe, Bit 1 an das Schieberegister 1 und so weiter.
    // PORT B: Bit 0 an alle Takteingänge angeschlossen
    // Char buffer [8] enthält 64 Datenbits

    for (i = 0; i <8; i ++)
    {

    PORTB = 0x00; // Ziehen Sie die Taktleitung niedrig, so dass wir es schaffen können hohe später um das Schieberegister auslösen
    PORTA = Puffer [i]; // Lade ein Datenbyte an Port A
    PORTB = 0x01; // Ziehen Sie die Taktleitung hoch ist, um Daten in die Schieberegister zu verschieben.
    }

    Dies ist vielleicht eine bessere Lösung, aber wir hatten zu bedienen, was wir beim Bau des Würfels zur Verfügung hatte. Für die Zwecke dieser instructable, werden wir mit einem Latch basierte Multiplexer für IO-Port-Erweiterung. Fühlen Sie sich frei, um diese Lösung zu verwenden, statt, wenn Sie verstehen, wie sie arbeiten beide.

    Mit diesem Aufbau werden die Inhalte des Puffers gegenüber dem Latch-Multiplexer bezogen als "gedreht" 90 Grad. Verkabeln Sie Ihre Würfel entsprechend oder einfach nur um 90 Grad drehen, um zu kompensieren;)

Schritt 10: Stromversorgung Überlegungen

  1. LED Cube 8x8x8
    Dieser Schritt ist leicht zu übersehen, wie LEDs selbst nicht allzu viel Strom ziehen. Aber denken Sie daran, dass dieser Kreislauf wird 64-mal die mA Ihrer LEDs zeichnen, wenn sie alle auf sind. Darüber hinaus verweist der AVR und die Verriegelung ICs auch aktuelle.

    Um den Stromverbrauch Ihres LEDs berechnen, schließen Sie ein zu einer 5V Versorgungsspannung mit dem Widerstand, die Sie verwenden, und messen den Strom in mA. Multiplizieren Sie diese Zahl durch 64, und Sie die Leistungsanforderungen für den Cube selbst haben. Hinzu kommt, dass 15 bis 20 mA für den AVR und ein paar mA für jeden Zwischenspeicher IC.

    Unserem ersten Versuch auf einem Leistungsversorgungs war es, ein Abwärts-Spannungsregler LM7805 bedienen, mit einer 12 V Wandwarze. An über 500 mA und 12 V-Eingang, wurde dieser Chip sehr heiß, und war nicht in der Lage, den gewünschten Strom zu versorgen.

    Wir später entfernt diesen Chip und verlötet die Leitung von dem Eingang zu dem Ausgangsstift in dem der Chip verwendet wird.

    Wir verwenden jetzt eine geregelte Computer-Netzteil, um eine stabile Hochstrom 5V-Versorgung zu bekommen.

Schritt 11: Kaufen Sie ein Netzteil

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    Wenn Sie nicht über die notwendigen, eine 5V-Netzteil bauen Teile haben, können Sie einen zu kaufen.

    eBay ist ein großartiger Ort, um diese Dinge zu kaufen.

    Suche nach "5V Netzteil" und die Suche nach "Business & Industrie" zu begrenzen, und Sie werden eine Menge von geeigneten Netzteile zu bekommen. Über 15 Dollar bekommen Sie einen schönen PSU.

Schritt 12: Erstellen Sie eine Stromversorgung

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Ein paar Jahre, bevor wir die LED Würfel gebaut, machten wir uns selbst einen netten kleinen Labornetzteil aus einem alten externe SCSI-Laufwerk. Dies ist, was wir haben, um die Verwendung von LED-Würfel anzutreiben.

    PC-Netzteile sind schön, weil sie 12V und 5V Schienen mit hoher Ampere geregelt.

    Sie können entweder einen regelmäßigen AT oder ATX-Netzteil oder alt und externe Festplattengehäuse verwendet werden.

    Falls Sie ein ATX-Netzteil verwenden möchten, müssen Sie den grünen Draht an den Motherboardanschluss mit Masse (schwarz) zu verbinden. Dies wird es hochgefahren.

    Externe Laufwerksgehäuse sind besonders schön, wie Netzteile verwenden. Sie haben schon eine bequeme Gehäuse. Das einzige, was Sie tun müssen, ist an eine externe Stromanschlüsse hinzuzufügen.

    Netzteile haben eine Menge Drähte, aber der einfachste Ort, um die Leistung, die Sie brauchen, ist durch einen Molex-Stecker. Das ist die Art von Stecker Sie auf Festplatten (vor dem Alter von S-ATA) zu finden.

    Schwarz ist GND Gelb ist + 12V Rot ist + 5V

    Hier ist ein Bild von unserem Labor-Netzteil. Wir haben 12V-Ausgang, 5V-Ausgang mit einem Amperemeter und 5V Ausgang ohne Amperemeter. Wir verwenden die zweite 5V Ausgang, um einen PC 80mm Lüfter Leistungs weg zu saugen oder blasen Rauch, wenn wir zu löten.

    Wir werden nicht in irgendwelche weitere Informationen, wie man ein Netzteil hier machen zu bekommen. Ich bin sicher, dass Sie eine andere instructable auf wie das zu tun finden.

Schritt 13: Wählen Sie Ihre LEDs

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Es gibt viele Dinge zu beachten bei der Auswahl LEDs.

    1)
    Sie wollen, dass die LED Würfel gleichmäßig von allen Seiten sichtbar zu sein. Wir empfehlen daher dringend, diffuse LEDs. Eine klare LED wird die Mehrheit der zu schießen, es ist Licht aus der Spitze der LED. Eine diffuse LED mehr oder weniger gleich hell von allen Seiten sein. Klar LEDs auch ein anderes Problem zu schaffen. Wenn Ihr Würfel besteht aus klaren LEDs. Die LEDs werden auch teilweise die LEDs leuchten, über ihnen, da das meiste Licht nach oben gerichtet ist. Das schafft einige unerwünschte Ghosting-Effekte.

    Wir haben tatsächlich bestellt diffuses LEDs von eBay, bekam aber 1000 deutlich LEDs statt. Verschiffen sie nach China zurück, um einen Ersatz zu erhalten würde zu viel Zeit in Anspruch genommen, so dass wir beschlossen, die klare LEDs stattdessen verwendet. Es funktioniert gut, aber die Würfel ist viel heller, als von der Spitze im Gegensatz zu den Seiten betrachtet.

    Die LEDs wir von eBay bestellt wurden tatsächlich als "entschärft LEDs" beschrieben. Vielleicht sollten wir den Hinweis gefunden haben;) entschärfen ist etwas, das Sie auf eine Bombe zu tun, wenn Sie es aus Sprengung verhindern wollen, hehe.

    2)
    Größere LEDs gibt Ihnen eine nähere Pixel, aber da seit der Würfel 8 Ebenen tief, sollten Sie genug Platz, um den ganzen Weg bis zur am weitesten Ebene sehen. Wir gingen mit 3mm LEDs, denn wir wollten den Würfel als "transparent" wie möglich sein. Unsere Empfehlung ist, 3mm diffus LEDs zu verwenden.

    3)
    Sie können sehr billig Lose von 1000 LEDs auf eBay zu kaufen. Aber bedenken Sie, dass die Qualität des Produktes kann in es den Preis niederschlagen. Wir denken, dass es nur wenig Möglichkeiten der LED-Fehlfunktion, wenn Sie bessere Qualität / teurer LEDs zu kaufen.

    4)
    Platz LEDs würde wahrscheinlich cool aussehen, aber dann müssen Sie eine Vorlage, die Löten quadratischen LEDs aufnehmen kann zu machen. Mit 3mm runden LEDs, ist alles was Sie brauchen ein 3mm Bohrer.

    5)
    Da die Würfel beruht auf Multiplexen und Trägheit des Auges, um Bilder zu erzeugen, wird jede Schicht nur für 1/8 der Zeit eingeschaltet. Dies nennt man einen 1/8 Tastgrad. Um dies auszugleichen, müssen die LEDs hell genug, um die gewünschte Helligkeit zu 1/8 Arbeitszyklus zu produzieren sein.

    6)
    Beinlänge. Cubeentwurfs in diesem instructable verwendet die Beine der LED selbst als Gerüst für den Würfel. Die Schenkellänge der LEDs muss gleich oder größer als der Abstand zwischen jeder LED Sie wollen.

Schritt 14: Wählen Sie Ihre Widerstände

  1. LED Cube 8x8x8
    Es gibt drei Dinge, die bei der Auswahl der Wert Ihres Widerstände, die LEDs, die 74HC574, der die LEDs treiben, und die verwendet werden, um die Schichten ein- und ausschalten Transistoren.

    1)
    Wenn Ihr LEDs kam mit einer Datenblatt, sollte es einige Ampere drin sein. Üblicherweise gibt es zwei Bewertungen, einer mA für Dauerbelastung und mA für Burst Lasten. Die LEDs werden auf 1/8 Arbeitszyklus ausgeführt werden, so dass Sie sich an die Burst-Bewertung beziehen.

    2)
    Die 74HC574 hat auch einige Grenzwerte. Wenn alle LEDs auf einer Anode Spalte eingeschaltet sind, wird dieser Chip Strom 8/8 der Zeit zu liefern. Sie müssen innerhalb des angegebenen maximalen mA Bewertung für die Ausgangspins zu halten. Wenn Sie im Datenblatt ansehen, werden Sie diese Zeile zu finden: DC-Ausgang Quelle oder Senke Strom je Ausgang Pin, IO: 25 mA. Auch sich a VCC bzw. GND aktuelle Maximalbewertung von 50mA. Um dies nicht zu überschreiten, können Sie Ihre LEDs nur bei 50/8 mA führen, da der 74HC574 verfügt über 8 Ausgänge. Dies gibt Ihnen 6,25 mA, mit zu arbeiten.

    3)
    Die Transistoren müssen ein- und ausschalten 64 x Ihres LEDs schalten Sie den mA. Wenn Ihr LEDs zeichnen jeweils 20mA, würde das bedeuten, dass Sie ein- und ausschalten 1,28 Ampere haben.
    Die einzigen Transistoren die wir zur Verfügung hatten eine maximale Rating von 400mA.

    Wir landeten mit Widerständen von 100 Ohm.

    Http://www.instructables.com/id/Resistor-man/: Während Sie für Ihren LED-Würfelteile darauf warten, in der Post ankommen, können Sie den Kerl auf dem Bild unten zu bauen

Schritt 15: Wählen Sie die Größe Ihrer cube

  1. LED Cube 8x8x8
    Wir wollten die LED Würfel mit so wenig Komponenten wie möglich zu machen. Wir hatten ein paar Leute mit Metallstangen für ihre Entwürfe zu sehen, aber wir konnten keine Metallstäbe haben. Viele der Metallstange Designs sah auch ein wenig schief.

    Wir dachten, dass der einfachste Weg, um eine LED-Würfel zu bauen wäre, um die Beine der LEDs zu biegen, so dass die Beine werden die Gerüste, die die LEDs in Position hält.

    Wir gebogen der Kathodenschenkel an einer der Leuchtdioden und maßen 26 mm von der Mitte des LED sein. Durch die Wahl einer LED-Abstand von 25 mm, gäbe es eine Überlappung von 1 mm zum Löten sein. (1 Zoll = 25,4 mm)

    Mit einem kleinen 3 mm LED 25 mm zwischen den einzelnen LED gab uns viel Freiraum im Inneren des Würfels. Sehen den ganzen Weg bis zum weitesten Schicht würde kein Problem sein. Wir könnten die Würfel kleiner gemacht haben, aber dann müssten wir jedes einzelne Bein geschnitten, und die Sichtbarkeit in den Würfel beeinträchtigen würde.

    Unsere Empfehlung ist, um den maximalen Abstand, dass Ihre LED kann damit zu verwenden. In 1mm-Marge für das Löten.

Schritt 16: Wie man gerade Draht machen

  1. LED Cube 8x8x8
    Um eine gut aussehende LED Cube zu machen, müssen Sie einige geraden Stahldraht. Der einzige Draht wir hatten, war auf Spulen, so musste es gerade gerichtet werden.

    Unser erster Versuch scheiterte schrecklich. Wir haben versucht, sie in eine gerade Draht biegen, aber egal, wie viel wir gebogen, es war einfach nicht gerade genug.

    Dann erinnerte wir eine Episode aus dem Discovery Channel "Wie werden sie hergestellt". Die Folge war, wie sie machen Stahldraht. Sie beginnen mit einer Spule der wirklich dicken Draht, dann ziehen sie es durch immer kleinere Löcher. Wir erinnerten uns, dass der Draht war völlig gerade und symmetrisch nach der so gezogen.

    Also dachten wir, wir sollten zieht einen Versuch geben, und es funktionierte! 100% geraden Metalldraht von einer Spule!

    Hier ist, wie Sie es tun.
    Schnitt der Länge des Drahtes von der Spule Sie brauchen, und ein oder zwei Zoll. Entfernen der Isolierung, falls vorhanden. Holen Sie sich einen festen Griff von jedem Ende des Drahtes mit zwei Zangen Ziehen hart! Sie fühlen sich der Draht strecken ein wenig. Sie brauchen nur zu strecken ein paar Millimeter es schön und gerade zu machen.

    Wenn Sie einen umge haben, können Sie ein Ende in den Schraubstock sichern und verwenden Sie eine Zange. Dies würde wahrscheinlich viel einfacher, aber wir wissen nicht besitzen eine umge.

Schritt 17: Praxis im kleinen Maßstab

  1. LED Cube 8x8x8
    Wann immer Myth Busters testen ein komplexer Mythos, beginnen sie von einigen kleinen Experimenten.

    Wir empfehlen Ihnen, dasselbe zu tun.

    Bevor wir die 8x8x8 LED Würfel gebaut, haben wir begonnen, indem Sie eine kleinere Version davon, 4x4x4. Indem die 4x4x4-Version zuerst, können Sie Ihre Würfel Löttechnik vor dem Start auf dem Big One zu perfektionieren.

    Besuche unsere 4x4x4 LED Würfel instructable Anleitungen zum Bau eines kleineren "Prototyp".

    http://www.instructables.com/id/LED-Cube-4x4x4/

Schritt 18: Erstellen Sie den Cube: Erstellen Sie eine Spannvorrichtung

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Um eine gut aussehende LED Würfel zu machen, ist es wichtig, dass es völlig symmetrisch ist, dass der Abstand zwischen den einzelnen LED sind identisch, und jeder LED-Punkte auf die gleiche Weise. Der einfachste Weg dies zu tun ist, um eine temporäre Lötform / Vorlage zu erstellen.

    1)
    Finden Sie ein Stück Holz oder Kunststoff, der größer ist als die Größe der Würfel ist.

    2)
    Finden Sie einen Bohrer, der ein Loch, das ein LED eng an Ort und Stelle passend macht. Sie wollen nicht, es zu eng sein, so dass es schwierig machen, den gelöteten Schicht von der Vorrichtung ohne ihn zu biegen entfernen würde. Wenn die Löcher zu groß sind, könnten einige der LEDs kommen krumm.

    3)
    Verwenden Sie ein Lineal und ein Winkeleisen, die von 8 Zeilen die sich unter 64 Punkten, mit der LED-Abstand in einem vorherigen Schritt bestimmt erstellen ein Raster von 8.

    4)
    Mit einem scharfen spitzen Gegenstand, um Vertiefungen an jeder Kreuzung zu machen. Diese Vertiefungen wird der Bohrer rutscht seitlich, wenn Sie Bohrungen beginnen zu verhindern.

    5)
    Bohren Sie alle Löcher.

    6)
    Nehmen Sie eine LED, und versuchen Sie jedes Loch für Größe. Wenn das Loch zu eng, sorgfältig bohren es wieder, bis die LED passt genau und können ohne großen Widerstand herausgezogen werden.

    7)
    Irgendwo in der Nähe der Mitte einer der Seiten, ziehen Sie eine kleine Markierung oder Pfeil. Ein Stahldraht wird hier in jeder Schicht gelötet, um den Würfel einige zusätzliche Versteifung zu geben.

Schritt 19: Erstellen Sie den Cube: Löten Beratung

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    Sie werden werden Löten sehr nah an der LED-Körper, und sind Sie wahrscheinlich zu sein mit wirklich billig LEDs von eBay. LEDs weiß nicht wie Hitze, billige LEDs wahrscheinlich mehr als andere. Das heißt, Sie müssen einige Vorkehrungen getroffen, um gebrochen LEDs zu vermeiden.

    Lötkolben Hygiene
    Zunächst einmal müssen Sie Ihren Lötkolben schön und sauber zu halten. Das bedeutet, wischte es auf dem Schwamm jedes Mal wenn Sie es verwenden. Die Spitze der Lötkolben sollte sauber und glänzend. Immer, wenn die Sie die Spitze Verschmutzung mit Flussmittel oder Oxidations, das heißt, es ist zu verlieren unglaublichen Glanz zu sehen, sollten Sie ihn reinigen. Auch wenn Sie in der Mitte des Lötens. Eine saubere Lötspitze macht es viel einfacher, Wärme an das Löten Ziel zu übertragen.

    Löten Geschwindigkeit
    Beim Löten so nah an der LED-Körper, müssen Sie in und out schnell. Wischen Sie Ihre Eisen sauber. Tragen Sie eine kleine Menge von Lot auf die Spitze. Berühren Sie den Part, den Sie mit der Seite des Eisen wo Sie legen sich lediglich ein wenig Lötzinn löten wollen. Lassen Sie die Ziel Wärme für 0,5-1 Sekunden, dann tippen Sie auf die andere Seite des Ziel Sie mit dem Lot Löten. Sie müssen nur ein wenig gelten. Nur das Lot, die das Metall der beiden Drähte berühren wird einen Unterschied machen. Ein großer Klecks Lötzinn wird nicht die Lötverbindung jede stärker. Entfernen Sie den Lötkolben sofort nach dem Auftragen des Lots.

    Irrtümer und abkühlen lassen
    Wenn Sie einen Fehler machen, beispielsweise wenn die Drähte zu bewegen, bevor das Lot erhärtet oder Sie nicht genügend Lot anzuwenden. Versuchen Sie nicht gleich wieder. An diesem Punkt der LED ist bereits sehr heiß, und die Anwendung mehr Wärme mit dem Lötkolben wird nur machen es heißer. Fahren Sie mit der nächsten LED und abkühlen lassen für eine Minute, oder blasen Sie darauf, um etwas Wärme zu entfernen.

    Lot
    Wir empfehlen die Verwendung eines dünnen Lot zum Löten der LEDs. This gives you a lot more control, and enable you to make nice looking solder joints without large blobs of solder. We used a 0.5 mm gauge solder. Don't use solder without flux. If your solder is very old and the flux isn't cleaning the target properly, get newer solder. We haven't experienced this, but we have heard that it can happen.

    Are we paranoid?
    When building the 8x8x8 LED Cube, we tested each and every LED before using it in the cube. We also tested every LED after we finished soldering a layer. Some of the LEDs didn't work after being soldered in place. We considered these things before making a single solder joint. Even with careful soldering, some LEDs were damaged.
    The last thing you want is a broken LED near the center of the cube when it is finished. The first and second layer from the outside can be fixed afterwards, but any further in than that, and you'll need endoscopic surgical tools ;)

Step 20: Build the cube: test the LEDs

  1. LED Cube 8x8x8
    We got our LEDs from eBay, really cheap!

    We tested some of the LED before we started soldering, and randomly stumbled on a LED that was a lot dimmer than the rest. So we decided to test every LED before using it. We found a couple of dead LEDs and some that were dimmer than the rest.

    It would be very bad to have a dim LED inside your finished LED cube, so spend the time to test the LEDs before soldering! This might be less of a problem if you are using LEDs that are more expensive, but we found it worth while to test our LEDs.

    Get out your breadboard, connect a power supply and a resistor, then pop the LEDs in one at a time. You might also want to have another LED with its own resistor permanently on the breadboard while testing. This makes it easier to spot differences in brightness.

Step 21: Build the cube: solder a layer

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Show All 13 Items
    Each layer is made up of 8 columns of LEDs held together by the legs of each LED. At the top of each layer each LED is rotated 90 degrees clockwise, so that the leg connects with the top LED of the next column. On the column to the right this leg will stick out of the side of the layer. We leave this in place and use it to connect ground when testing all the LEDs in a later step.

    1) Prepare 64 LEDs
    Bend the cathode leg of each LED 90 degrees. Make sure the legs are bent in the same direction on all the LEDs. Looking at the LED sitting in a hole in the template with the notch to the right, we bent the leg upwards.

    2) Start with the row at the top
    Start by placing the top right LED in the template. Then place the one to the left, positioning it so that it's cathode leg is touching the cathode leg of the previous LED. Rinse and repeat until you reach the left LED. Solder all the joints.

    3) Solder all 8 columns
    If you are right handed, we recommend you start with the column to the left. That way your hand can rest on the wooden template when you solder. You will need a steady hand when soldering freehand like this. Start by placing the LED second from the top, aligning it so it's leg touches the solder joint from the previous step. Then place the LED below that so that the cathode leg touches the LED above. Repeat until you reach the bottom. Solder all the joints.

    4) Add braces
    You now have a layer that looks like a comb. At this point the whole thing is very flimsy, and you will need to add some support. We used one bracing near the bottom and one near the middle. Take a straight peace of wire, roughly align it where you want it and solder one end to the layer. Fine tune the alignment and solder the other end in place. Now, make solder joints to the remaining 6 columns. Do this for both braces.

    5) Test all the LEDs
    This is covered in the next step. Just mentioning here so you don't remove the layer just yet.

    6) Remove the layer
    The first layer of your LED cube is all done, now all you have to do is remove it from the template. Depending on the size of your holes, some LEDs might have more resistance when you try to pull it out. Simply grabbing both ends of the layer and pulling would probably break the whole thing if a couple of the LEDs are stuck.

    Start by lifting every single LED a couple of millimeters. Just enough to feel that there isn't any resistance. When all the LEDs are freed from their holes, try lifting it carefully. If it is still stuck, stop and pull the stuck LEDs out.

    Repeat 8 times!

    Note on images:
    If you are having trouble seeing the detail in any of our pictures, you can views the full resolution by clicking on the little i icon in the top left corner of every image. All our close up pictures are taken with a mini tripod and should have excellent macro focus. On the image page, choose the original size from the "Available sizes" menu on the left hand side.

Step 22: Build the cube: test the layer

  1. LED Cube 8x8x8
    Soldering that close to the body of the LED can damage the electronics inside. We strongly recommend that you test all LEDs before proceeding.

    Connect ground to the tab you left sticking out at the upper right corner. Connect a wire to 5V through a resistor. Use any resistor that lights the LED up and doesn't exceed its max mA rating at 5V. 470 Ohm would probably work just fine.

    Take the wire and tap it against all 64 anode legs that are sticking up from your template. If a LED doesn't flash when you tap it, that means that something is wrong.

    1) Your soldering isn't conducting current.
    2) The LED was overheated and is broken.
    3) You didn't make a proper connection between the test wire and the led. (try again).

    If everything checks out, pull the layer from the cube and start soldering the next one.

Step 23: Build the cube: straigthen the pins

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    In our opinion, a LED cube is a piece of art and should be perfectly symmetrical and straight. If you look at the LEDs in your template from the side, they are probably bent in some direction.

    You want all the legs to point straight up, at a 90 degree angle from the template.

    While looking at the template from the side, straighten all the legs. Then rotate the template 90 degrees, to view it from the other side, then do the same process.

    You now have a perfect layer that is ready to be removed from the template.

Step 24: Build the cube: bend the pins

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    In the LED cube columns, we want each LED to sit centered precisely above the LEDs below. The legs on the LEDs come out from the LED body half a millimeter or so from the edge. To make a solder joint, we have to bend the anode leg so that it touches the anode leg on the LED below.

    Make a bend in the anode leg towards the cathode leg approximately 3mm from the end of the leg. This is enough for the leg to bend around the LED below and make contact with it's anode leg.

Step 25: Build the cube: solder the layers together

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 10 Artikel anzeigen
    Now comes the tricky part, soldering it all together!

    The first two layers can be quite flimsy before they are soldered together. You may want to put the first layer back in the template to give it some stability.

    In order to avoid total disaster, you will need something to hold the layer in place before it is soldered in place. Luckily, the width of a 9V battery is pretty close to 25 mm. Probably closer to 25.5-26mm, but that's OK.

    Warning: The 9 volts from a 9V battery can easily overload the LEDs if the contacts on the battery comes in contact with the legs of the LEDs. We taped over the battery poles to avoid accidentally ruining the LEDs we were soldering.

    We had plenty of 9V batteries lying around, so we used them as temporary supports.
    Start by placing a 9V battery in each corner. Make sure everything is aligned perfectly, then solder the corner LEDs.

    Now solder all the LEDs around the edge of the cube, moving the 9V batteries along as you go around. This will ensure that the layers are soldered perfectly parallel to each other.
    Now move a 9V battery to the middle of the cube. Just slide it in from one of the sides. Solder a couple of the LEDs in the middle.

    The whole thing should be pretty stable at this point, and you can continue soldering the rest of the LEDs without using the 9V batteries for support.

    However, if it looks like some of the LEDs are sagging a little bit, slide in a 9V battery to lift them up!

    When you have soldered all the columns, it is time to test the LEDs again. Remember that tab sticking out from the upper right corner of the layer, that we told you not to remove yet? Now it's time to use it. Take a piece of wire and solder the tab of the bottom layer to the tab of the layer you just soldered in place.

    Connect ground to the the ground tab.

    Test each led using the same setup as you used when testing the individual layers. Since the ground layers have been connected by the test tabs, and all the anodes in each columns are connected together, all LEDs in a column should light up when you apply voltage to the top one. If the LEDs below it does not light up, it probably means that you forgot a solder joint! It is A LOT better to figure this out at this point, rather than when all the layers are soldered together. The center of the cube is virtually impossible to get to with a soldering iron.

    You now have 2/8 of your LED cube soldered together! Yay!

    For the next 6 layers, use the exact same process, but spend even more time aligning the corner LEDs before soldering them. Look at the cube from above, and make sure that all the corner LEDs are on a straight line when looking at them from above.

    Rinse and repeat!

Step 26: Build the cube: create the base

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    We didn't have any fancy tools at our disposal to create a fancy stand or box for our LED cube. Instead, we modified the template to work as a base for the cube.

    We encourage you to make something cooler than we did for your LED cube!

    For the template, we only drilled a couple of mm into the wood. To transform the template into a base, we just drilled all the holes through the board. Then we drilled 8 smaller holes for the 8 cathode wires running up to the 8 cathode layers.

    Of course, you don't want to have your LED cube on a wood colored base. We didn't have any black paint lying around, but we did find a giant black magic marker! Staining the wood black with a magic marker worked surprisingly well! I think the one we used had a 10mm point.

Step 27: Build the cube: mount the cube

  1. LED Cube 8x8x8
    Mount the cube. That sounds very easy, but it's not. You have to align 64 LED legs to slide through 64 holes at the same time. It's like threading a needle, times 64.

    We found it easiest to start with one end, then gradually popping the legs into place. Use a pen or something to poke at the LED legs that miss their holes.

    Once all 64 LED legs are poking through the base, carefully turn it on it's side. Then bend all 64 legs 90 degrees. This is enough to hold the cube firmly mounted to the base. No need for glue or anything else.

Step 28: Build the cube: cathode risers

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    You now have a LED cube with 64 anode connections on the underside of the base. But you need to connect the ground layers too.

    Remember those 8 small holes you drilled in a previous step? We are going to use them now.

    Make some straight wire using the method explained in a previous step.

    We start with ground for layer 0. Take a short piece of straight wire, Make a bend approximately 10mm from the end. Poke it through the hole for ground layer 0. Leave 10mm poking through the underside of the base. Position it so that the bend you made rests on the back wire of ground layer 0. Now solder it in place.
    Layer 1 through 7 are a little trickier. We used a helping hand to hold the wire in place while soldering.

    Take a straight piece of wire and bend it 90 degrees 10mm from the end. Then cut it to length so that 10mm of wire will poke out through the underside of the base.
    Poke the wire through the hole and let the wire rest on the back wire of the layer you are connecting. Clamp the helping hand onto the wire, then solder it in place.

    Rinse and repeat 7 more times.

    Carefully turn the cube on it's side and bend the 8 ground wires 90 degrees.

Step 29: Build the cube: attach cables

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 10 Artikel anzeigen
    64+8 wires have to go from the controller to the LED cube. We used ribbon cable to make things a little easier.

    The ground layers use an 8-wire ribbon cable.

    The cathodes are connected with 4 16-wire ribbon cables. Each of these ribbon cables are split in two at either end, to get two 8-wire cables.

    At the controller side, we attached 0.1" female header connectors. These plug into standard 0.1" single row PCB header pins.

    The header connector is a modular connector that comes in two parts, metal inserts and a plastic body.

    The metal inserts are supposed to be crimped on with a tool. We didn't have the appropriate tool on hand, so we used pliers. We also added a little solder to make sure the wires didn't fall of with use.

    1) Prepare one 8-wire ribbon cable and 4 16-wire ribbon cables of the desired length
    2) Crimp or solder on the metal inserts.
    3) Insert the metal insert into the plastic connector housing.
    4) Solder the 8-wire ribbon cable to the cathode risers. Pre-tin the cables before soldering!
    5) Solder in the rest of the cables. The red stripe on the first wire indicates that this is bit 0.
    6) Tighten the screws on the strain relief to make sure everything stays in place.
    7) Connect all the ribbon cables to the PCBs in the correct order. See pictures below. Our 8 wire ribbon cable didn't have a red wire. Just flip the connector 180 degrees if your cube is upside-down.

Step 30: Build the controller: layout

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    We took out the biggest type of PCB we had available (9x15cm) and started experimenting with different board layouts. It soon became clear that cramming all the components onto one board wasn't a good solution. Instead we decided to separate the latch array and power supply part of the circuit and place it on a separate board. A ribbon cable transfers data lines between the two boards.

    Choosing two separate boards was a good decision. The latch array took up almost all the space of the circuit board. There wouldn't have been much space for the micro controller and other parts.

    You may not have the exact same circuit boards as we do, or may want to arrange your components in a different way. Try to place all the components on your circuit board to see which layout best fits your circuit board.

Step 31: Build the controller: clock frequency

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    We use an external crystal of 14.7456 MHz to drive the ATmega system clock.

    You may be thinking that this is an odd number to use, and why we didn't run the ATmega at the 16MHz it is rated for.

    We want to be able to control the LED cube from a computer, using RS232. Serial communication requires precise timing. If the timing is off, only by a little bit, some bits are going to be missed or counted double from time to time. We won't be running any error correcting algorithms on the serial communications, so any error over the line would be represented in the LED cube as a voxel being on or off in the wrong place.

    To get flawless serial communication, you have to use a clock frequency that can be divided by the serial frequency you want to use.

    14.7456 MHz is dividable by all the popular RS232 baud rates. (14.7456MHz*1000*1000) / 9600 baud = 1536.0 (14.7456MHz*1000*1000) / 19200 baud = 768.0 (14.7456MHz*1000*1000) / 38400 baud = 384.0 (14.7456MHz*1000*1000) / 115200 baud = 128.0 The formula inside the parentheses converts from MHz to Hz. First *1000 gives you KHz, the next Hz.

    As you can see all of these RS232 baud rates can be cleanly divided by our clock rate. Serial communication will be error free!

Step 32: Build the controller: protoboard soldering advice

  1. LED Cube 8x8x8
    We see people do a lot of weird stuff when they solder on prototype PCBs. Before you continue, we just want to share with you the process we use to create tracks on prototype PCBs with solder eyes. Once you master this technique, you will probably start using it a lot.

    1) Fill each point of the track you want to make with solder.
    2) Connect every other points by heating them and adding a little solder.
    3) Connect the 2-hole long pieces you now have spanning the desired track.
    4) Look how beautiful the result is.

    You can see in the video how we do it. We had to touch some of the points twice to join them. It was a bit hard to have the camera in the way when we were soldering ;)


Step 33: Build the controller: Power terminal and filtering capacitors

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    The cube is complete, now all that remains is a monster circuit to control the thing.

    Let's start with the easiest part, the "power supply".

    The power supply consists of a screw terminal where you connect the GND and VCC wires, some filtering capacitors, a switch and a an LED to indicate power on.

    Initially, we had designed an on-board power supply using an LM7805 step down voltage regulator. However, this turned out to be a big fail.

    We used this with a 12V wall wart. But as you may already know, most wall warts output higher voltages than the ones specified on the label. Ours outputted something like 14 volts. The LM7805 isn't a very sophisticated voltage regulator, it just uses resistance to step down the voltage. To get 5 volts output from 14 volts input means that the LM7805 has to drop 9 volts. The excess energy is dispersed as heat. Even with the heat sink that you see in the picture, it became very very hot. Way to hot to touch! In addition to that, the performance wasn't great either. It wasn't able to supply the necessary current to run the cube at full brightness.

    The LM7805 was later removed, and a wire was soldered between the input and output pins. Instead we used an external 5V power source, as covered in a previous step.

    Why so many capacitors?

    The LED cube is going to be switching about 500mA on and off several hundred times per second. The moment the 500mA load is switched on, the voltage is going to drop across the entire circuit. Many things contribute to this. Resistance in the wires leading to the power supply, slowness in the power supply to compensate for the increase in load, and probably some other things that we didn't know about ;)

    By adding capacitors, you create a buffer between the circuit and the power supply. When the 500mA load is switched on, the required current can be drawn from the capacitors during the time it takes the power supply to compensate for the increase in load.

    Large capacitors can supply larger currents for longer periods of time, whereas smaller capacitors can supply small but quick bursts of energy.

    We placed a 1000uF capacitor just after the main power switch. This works as our main power buffer. After that, there is a 100uF capacitor. It is common practice to have a large capacitor at the input pin of an LM7805 and a smaller capacitor at it's output pin. The 100uF capacitor probably isn't necessary, but we think capacitors make your circuit look cooler!

    The LED is connected to VCC just after the main power switch, via a resistor.

Step 34: Build the controller: IC sockets, resistors and connectors

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    In this step you will be soldering in the main components of the multiplexer array.

    Our main design consideration here was to minimize soldering and wiring. We opted to place the connectors as close to the ICs as possible. On the output-side, there is only two solder joints per LED cube column. IC-resistor, resistor-connector. The outputs of the latches are arranged in order 0-7, so this works out great. If we remember correctly, the latch we are using is available in two versions, one with the inputs and outputs in sequential order, and one with the in- and outputs in seemingly random order. Do not get that one! ;) Don't worry, it has a different 74HC-xxx name, so you'll be good if you stick to our component list.

    In the first picture, you can see that we have placed all the IC sockets, resistors and connectors. We squeezed it as tight as possible, to leave room for unforeseen stuff in the future, like buttons or status LEDs.

    In the second picture, you can see the solder joints between the resistors and the IC sockets and connectors. Note that the input side of the latch IC sockets haven't been soldered yet in this picture.

Step 35: Build the controller: Power rails and IC power

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    Remember that protoboard soldering trick we showed you in a previous step? We told you it would come in handy, and here is where you use it.

    Large circuit boards like this one, with lots of wires, can become quite confusing. We always try to avoid lifting the GND and VCC lines off the board. We solder them as continuous solder lines. This makes it very easy to identify what is GND/VCC and what is signal lines.

    If the VCC and GND lines needs to cross paths, simply route one of them over the other using a piece of wire on the top side of the PCB.

    In the first picture you can see some solder traces in place.

    The two horizontal traces is the "main power bus". The lowest one is VCC and the top one is GND. For every row of ICs a GND and VCC line is forked off the main power bus. The GND line runs under the ICs, and the VCC line runs under the resistors.

    We went a little overboard when making straight wire for the cube, and had some pieces left over. We used that for the VCC line that runs under the resistors.

    In the bottom right corner, you can see that we have started soldering the 8+1bit bus connecting all the latch ICs. Look how easy it is to see what is signal wires and what is power distribution!

    In the second picture, you can see the board right-side-up, with some additional components soldered in, just ignore them for the moment.

    For every latch IC (74HC574), there is a 100nF (0.1uF) ceramic capacitor. These are noise reduction capacitors. When the current on the output pins are switched on and off, this can cause the voltage to drop enough to mess with the internal workings of the ICs, for a split second. This is unlikely, but it's better to be safe than sorry. Debugging a circuit with noise issues can be very frustrating. Besides, capacitors make the circuit look that much cooler and professional! The 100nF capacitors make sure that there is some current available right next to the IC in case there is a sudden drop in voltage. We read somewhere that it is common engineering practice to place a 100nF capacitor next to every IC, "Use them like candy". We tend to follow that principle.

    Below each row of resistors, you can see a tiny piece of wire. This is the VCC line making a little jump to the top side of the board to cross the main GND line.

    We also added a capacitor on the far end of the main power bus, for good measure.

Step 36: Build the controller: Connect the ICs, 8bit bus + OE

  1. LED Cube 8x8x8
    In the picture, you'll notice a lot of wires have come into place.

    All the tiny blue wires make up the 8+1bit bus that connects all the latch ICs. 8 bits are for data, and the +1 bit is the output enable line.

    At the top of the board, we have added a 16 pin connector. This connects the latch board to the micro controller board. Next to that, you see the 74HC138.

    The tiny blue wires are Kynar wire. This is a 30 or 32 AWG (american wire gauge) wire. Very tiny. We love working with this type of wire. Because it is so thin, it doesn't take up that much space on the circuit board. If we had used thicker wire, you wouldn't be able to see the board through all the wires. Kynar wire is coated with tin, so you can solder directly after stripping it. No need for pre-tinning. The tiny blue wires are connected to the same pin on every latch IC.

    From the connector at the top, you can see 8 green wires connected to the bus. This is the 8 bit data bus. We used different colors for different functions to better visualize how the circuit is built.

    The orange wire connected to the bus is the output enable (OE) line.

    On the right hand side of the connector, the first pin is connected to ground.

Step 37: Build the controller: Address selector

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    The 74HC138 is responsible for toggling the clock pin on the 74HC574 latch ICs. We call this an address selector because it selects which one of the 8 bytes in the latch array we want to write data to. The three blue wires running from the connector to the 74HC138 is the 3 bit binary input used to select which of the 8 outputs is pulled low. From each of the outputs on the 74HC138, there is a wire (white) running to the clock pin on the corresponding 74HC574 latch IC.

    Start by soldering the GND and VCC connections. If you use the solder trace method to run GND/VCC lines you want to do this before you solder any other wires in place. A 100nF ceramic filtering capacitor is placed close to the VCC and GND pins of the 74HC138.

    Then connect the address lines and the 8 clock lines.

    If you look carefully at the connector, you can see two pins that are not used. These will be used for a button and debug LED later.

Step 38: Build the controller: AVR board

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Braaaaainzz!!!

    This board is the brain of the LED cube. The main component is an Atmel AVR ATmega32.

    This is an 8 bit microcontroller with 32 KB of program memory and 2 KB RAM. The ATmega32 has 32 GPIO (General Purpose IO) pins. Two of these will be used for serial communication (TX+RX). Three IO pins are used for ISP (In-circuit Serial Programming). This leaves us with 27 GPIO to drive the LED cube, buttons and status LEDs.

    A group of 8 GPIO (8 bits, one byte) is called a port. The ATmega32 has 4 ports. PORTA, PORTB, PORTC and PORTD. On PORTC and PORTD some of the pins are used for TX/RX and ISP. On PORTA and PORTB, all the pins are available. We use these ports to drive the data bus of the latch array and layer select transistor array.

    PORTA is connected to the data bus on the latch array.

    Each pin on PORTC is connected to a pair of transistors that drive a ground layer.

    The address selector on the latch array (74HC138) is connected to bit 0-2 on PORTB. Output enable (OE) is connected to PORTB bit 3.

    In the first image, you see the AVR board right-side-up.

    The large 40 pin PDIP (Plastic Dual Inline Package) chip in the center of the board is the ATmega32, the brainz! Just to the left of the ATmega, you see the crystal oscillator and it's two capacitors. On either side of the ATmega there is a 100nF filtering capacitor. One for GND/VCC and one for AVCC/GND.

    In the top left corner, there is a two pin connectors and two filtering capacitors. One 10uF and one 100nF. The LED is just connected to VCC via a resistor, and indicates power on.

    The large 16 pin connector directly above the ATmega connects to the latch array board via a ribbon cable. The pinout on this corresponds to the pinout on the other board.

    The smaller 10 pin connector to the left, is a standard AVR ISP programming header. It has GND, VCC, RESET, SCK, MISO and MOSI, which are used for programming. Next to it, there is a jumper. When this is in place, the board can be powered from the programmer.

    Caution: DO NOT power the board from the programmer when the actual LED cube is connected to the controller. This could possibly blow the programmer and even the USB port the programmer is connected to!

    The second image shows the underside. Again all GND and VCC lines are soldered as traces on the protoboard or bare wire. We had some more left over straight metal wire, so we used this.

    The orange wires connect the ATmega's RESET, SCK, MOSI and MISO pins to the ISP programming header.

    The Green wires connect PORTA to the data bus.

    The blue wires are the address select lines for the 74HC138 and output enable (OE) for the latch array.

    1) Start by placing the 40 pin IC socket, the 10 pin ISP connector with a jumper next to it and the 16 pin data bus connector.
    2) Solder in place the power connector, capacitors and power indicator LED.
    3) Connect all the GND and VCC lines using solder traces or wire. Place a 100nF capacitor between each pair of GND/VCC pins on the ATmega.
    4) Solder in the crystal and the two 22pF capacitors. Each capacitor is connected to a pin on the crystal and GND.
    5) Run all the data bus, address select and OE wires, and the ISP wires.
    Transistors, buttons and RS232 will be added in later steps.
    At this time, the AVR board can be connected to an ISP programmer and the ATmega should be recognized.

Step 39: Build the controller: Transistor array

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    The transistor array is responsible for switching on and off GND for each layer in the LED cube.

    Our first attempt at this was an epic fail. We bought some transistors rated for over 500mA, thinking that would be plenty of juice. We don't remember the model number.

    The LED cube worked, but it wasn't very bright, and the brightness was inversely proportional to the number of LEDs switched on in any given layer. In addition to that, there was some ghosting. Layers didn't switch completely off when they were supposed to be off.

    Needless to say, we were kind of disappointed, and started debugging. The first thing we did was to add pull-up resistors to try to combat the ghosting. This removed almost all the ghosting, yay! But the cube was still very dim, bah!

    We didn't have any powerful transistors or MOSFETs lying around, so we had to come up with another solution.

    We posted a thread in the electronics section of the AVRFreaks.net forum, asking if it was possible to use two smaller transistors in parallel. This is the only option available to us using the parts we had on hand. The general response was, this will never work so don't even bother trying. They even had valid theories and stuff, but that didn't deter us from trying. It was our only solution that didn't involve waiting for new parts to arrive in the mail.

    We ended up trying PN2222A, NPN general purpose amplifier. Ideally, you'd want a switching transistor for this kind of application, but we needed 16 transistors of the same type. This transistor was rated at 1000mA current, so we decided to give it a try.

    For each layer, we used two PN2222As in parallel. The collectors connected together to GND. The emitters connected together, then connected to a ground layer. The base of each transistors was connected to it's own resistor, and the two resistors connected to an output pin on the ATmega.

    We soldered in all the transistors and turned the thing on again, and it worked, perfectly!

    If you know what you are doing, you should probably do some research and find a more suitable transistor or MOSFET. But our solution is tried and tested and also does the trick!

    1) Start by placing all 8 all transistors on the PBC and soldering each of their pins.

    2) Run a solder trace between the the emitters of all 16 transistors. Connect this solder trace to GND.

    3) Solder in a resistor for each transistor, the solder the resistors together in pairs of two.

    4) Run kynar wire from the output pins on the ATmega to each of the 8 resistor pairs.

    5) Solder together the collectors of the transistors in pairs of two and run solder trace or wire from the collector pairs to an 8 pin header.

Step 40: Build the controller: Buttons and status LEDs

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    You can make a LED cube without any buttons at all, but it's nice to have at least one button and some status LEDs for debugging.

    We added one awesome looking button with two built in LEDs, and one regular button with an LED.

    The first button is mounted on the latch array PCB, since this will sit on top of the AVR board, and we want the button easily accessible. The wires are routed through the ribbon cable. The second button and LED sits on the AVR board and was mostly used for debugging during construction.

    The buttons are connected between GND and the IO pin on the ATmega. An internal pull-up resistor inside the ATmega is used to pull the pin high when the button is not pressed. When the button is pressed, the IO pin is pulled low. A logic 0 indicates that a button has been pressed.

    The LEDs are also connected between GND and the IO pin via a resistor of appropriate size. Don't connect an LED to a micro controller IO pin without having a resistor connected in series. The resistor is there to limit the current, and skipping it can blow the IO port on your micro controller.

    To find the appropriate resistor, just plug the led into a breadboard and test different resistors with a 5v power supply. Choose the resistors that make the LED light up with the brightness you want. If you use LEDs with different colors, you should test them side by side. Different color LEDs usually require different resistors to reach the same level of brightness.

    We will leave it up to you to decide the placement of your status LEDs, but you can see in the pictures below how we did it:

Step 41: Build the controller: RS-232

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    To get the truly amazing animations, we need to connect the LED cube to a PC. The PC can do floating point calculations that would have the AVR working in slow motion.

    The ATmega has a built in serial interface called USART (Universal Synchronous and Asynchronous serial Receiver and Transmitter).

    The USART communicates using TTL levels (0/5 volts). The computer talks serial using RS232. The signal levels for RS232 are anywhere from +/- 5 volts to +/- 15 volts.

    To convert the serial signals from the micro controller to something the RS232 port on a PC can understand, and vice versa, we use the Maxim MAX232 IC. Actually, the chip we are using isn't from Maxim, but it is a pin-compatible clone.

    There are some 100nF ceramic capacitors surrounding the MAX232. The MAX232 uses internal charge-pumps and the external capacitors to step up the voltage to appropriate RS232 levels. One of the 100nF capacitors is a filter capacitor.

    The RS232 connector is at a 90 degree angle for easy access when the latch array board is mounted on top of the AVR board. We used a 4 pin connector and cut one of the pins out to make a polarized connector. This removes any confusion as to which way to plug in the RS232 cable.

    In the second picture you can see two yellow wires running from the ATmega to the MAX232. These are the TTL level TX and RX lines.

    1) Connect the GND and VCC pins using solder trace or wire. Place a 100nF capacitor close to the GND and VCC pins.

    2) Solder in place the rest of the 100nF capacitors. You can solder these with solder traces, so its best to do this before you connect the tx/rx wires.

    3) Solder in place a 4 pin 0.1" header with one pin removed. Connect the pin next to the one that was removed to GND.

    4) Connect the tx/rx input lines to the micro controller, and the tx/rx output lines to the 4 pin header.

    The wires going to the 4 pin header are crossed because the first serial cable we used had this pinout.

Step 42: Build the controller: Make an RS-232 cable

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 10 Artikel anzeigen
    To connect the LED cube to a serial port on your computer, you need to make a serial cable with a female D-Sub 9 pin connector.

    Our employer deployed 70 Ethernet switches with management last year. With each switch comes an RS232 cable that is never used. We literally had a big pile of RS232 cable, so we decided to modify one of those.

    On the LED cube, a 0.1" pin header is used, so the RS232 cable needs a new connector on the cube side.

    We didn't have a 4 pin female 0.1" connector, so we used a 4 pin female PCB header instead.

    The connector on the LED cube PCB has one pin removed, to visualize the directionality of the connector. The pin numbers goes from right to left.

    Pinout of the RS232 connector:

    1) GND (DSub9 pin 5)
    2) Not connected
    3) RX (DSub9 pin 3)
    4) TX (DSub9 pin 2)

    Follow these steps to make your own RS232 cable:

    1) Cut of the connector at one end of the cable. If your cable has a female and a male connector, make sure to remove the male connector!

    2) Strip away the outer sheath on the end where you removed the connector.

    3) Strip all the wires inside.

    4) Set your multimeter to continuity test mode. This makes the multimeter beep when the probes are connected. If your multimeter doesn't have this option, use the resistance mode. It should get close to 0 ohm when you connect the probes.

    5) Connect one multimeter probe to the DSub9's pin 5, then probe all the wires until you the multimeter beeps. You have now identified the color of GND in your cable. Repeat for pin 2 and 3 (TX and RX).

    6) Write down the colors you identified, then cut off the other wires.

    7) Cut the three wires down to size, 30mm should do.

    8) Pre-tin the wires to make soldering easier. Just apply heat and solder to the stripped wires.

    9) Slide a shrink tube over the cable. Slide three smaller shrink tubes over the individual wires.

    10) Solder the wires to the connector.

    11) Shrink the smaller tubes first, then the large one. If you use a lighter, don't hold the shrink tube above the flame, just hold it close to the side of the flame.

    Don't make your cable based on the colors we used. Test the cable to find the correct colors.

Step 43: Build the controller: Connect the boards

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    The two boards are connected by two cables:
    A ribbon cable for the DATA and Address BUS. A 2 wire cable for GND and VCC. After connecting these two cables, your board is complete.

Step 44: Build the controller: Connect the cube

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Connect the ribbon cables according to the pin-outs shown in picture 2 and 3.
    The ground layer ribbon cable connects to the pin header near the transistor array. If the cube is upside-down, just plug it in the other way.

Step 45: Program the AVR: Set the fuse bits

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    The ATmega32 has two fuse bytes. These contain settings that have to be loaded before the CPU can start, like clock source and other stuff. You have to program your ATmega to use an external high speed crystal oscillator and disable JTAG.

    We set the lower fuse byte (lfuse) to 0b11101111, and the high fuse byte to 0b11001001. (0b means that everything after the b is in binary).

    We used avrdude and USBtinyISP (http://www.ladyada.net/make/usbtinyisp/) to program our ATmega.

    In all the following examples, we will be using an Ubuntu Linux computer. The commands should be identical if you run avrdude on Windows.
    avrdude -c usbtiny -p m32 -U lfuse:w:0b11101111:m avrdude -c usbtiny -p m32 -U hfuse:w:0b11001001:m
    Warning: If you get this wrong, you could easily brick your ATmega! If you for example disable the reset button, you won't be able to re-program it. If you select the wrong clock source, it might not boot at all.

Step 46: Program the AVR with test code

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Time to test if your brand new LED cube actually works!

    We have prepared a simple test program to check if all the LEDs work and if they are wired correctly.

    You can download the firmware test.hex in this step, or download the source code and compile it yourself.

    As in the previous step, we use avrdude for programming:
    avrdude -c usbtiny -p m32 -B 1 -U flash:w:test.hex
    -c usbtiny specifies that we are using the USBtinyISP from Ladyada -p m32 specifies that the device is an ATmega32 -B 1 tells avrdude to work at a higher than default speed. -U flash:w:test.hex specifies that we are working on flash memory, in write mode, with the file test.hex.

Step 47: Test the cube

  1. LED Cube 8x8x8
    The test code you programmed in the previous step will let you confirm that everything is wired up correctly.

    It will start by drawing a plane along one axis, then moving it along all 8 positions of that axis. (by plane we mean a flat surface, not an airplane :p) The test code will traverse a plane through all three axis.

    After that, it will light the LEDs in a layer one by one, starting at the bottom layer.

    If any of the layers or columns seem to light up in the wrong order, you have probably soldered the wrong wire to the wrong layer or column. We had one mistake in our cube ;)

    If you find anything that is out of order, just de-solder the wires and solder them back in the right order. You could of course make a workaround in software, but that would eat CPU cycles every time the interrupt routine runs.

    You can compare your cube to the test video below:


Step 48: Program the AVR with real code

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    So everything checked out in the test. It's time to program the ATmega with the real firmware!

    For the most part, the process is the same as in the previous programming step. But in addition you have to program the EEPROM memory. The LED cube has a basic bitmap font stored in EEPROM, along with some other data.

    Firmware is programmed using the same procedure as with the test code.

    Firmware:
    avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
    EEPROM: avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep
    -U eeprom:w:main.eep specifies that we are accessing EEPROM memory, in write mode. Avr-gcc puts all the EEPROM data in main.eep.

    If you don't want to play around with the code, your LED cube is finished at this point. But we recommend that you spend some time on the software side of things as well. That's at least as much fun as the hardware!

    If you download the binary files, you have to change the filenames in the commands to the name of the files you downloaded. If you compile from source the name is main.hex and main.eep.

Step 49: Software: Introduction

  1. LED Cube 8x8x8
    The software is written in C and compiled with the open source compiler avr-gcc. This is the main reason we use Atmel AVR micro controllers. The PIC series from Microchip is also a nice choice, but most of the C compilers cost money, and the free versions have limitations on code size.

    The AVR route is much more hassle free. Just apt-get install the avr-gcc compiler, and you're in business.

    The software on the AVR consists of two main components, the cube interrupt routine and effect code for making fancy animations.

    When we finally finished soldering, we thought this would be the easy part. But it turns out that making animations in monochrome at low resolutions is harder than it sounds.

    If the display had a higher resolution and more colors, we could have used sin() and cos() functions and all that to make fancy eye candy. With two colors (on and off) and low resolution, we have to use a lot of if() and for() to make anything meaningful.

    In the next few steps, we will take you on a tour of some of the animations we made and how they work. Our goal is to give you an understanding of how you can make animations, and inspire you to create your own! If you do, please post a video in the comments!

Step 50: Software: How it works

  1. LED Cube 8x8x8
    As mentioned in the previous step, the software consists of two pars. The interrupt routine and the effect code.

    Communication between these two happens via a voxel array. This array has a bit for every LED in the LED cube. We will refer to this as the cube array or cube buffer from now on.

    The cube array is made of 8x8 bytes. Since each byte is 8 bits, this gives us a buffer that is 8 voxels wide, 8 woxels high and 8 voxels deep (1 byte deep).

    volatile unsigned char cube[8][8];

    The interrupt routine reads from the cube array at given intervals and displays the information on the LED cube.

    The effect functions writes the desired LED statuses to this array.

    We did not use any synchronization or double buffering, since there is only one producer (either the effects currently running, or input from RS232) and one consumer (the interrupt-code that updates the cube). This means that some voxels could be from the next or previous "frame", but this is not a problem, since the frame rate is so high.

    When working with micro controllers, code size is critical. To save code size and programming work, and to make the code easier to read, we have tried to write re-usable code as often as possible.

    The LED cube code has a base of low level drawing functions that are used by the higher level effect functions. The draw functions can be found in draw.c. Draw functions include everything from setting or clearing a single voxel to drawing lines and wireframe boxes.

Step 51: Software: IO initialization

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    The first thing the ATmega does after boot, is to call the ioinit() function.

    This function sets up IO ports, timers, interrupts and serial communications.
    All IO ports on the ATmega are bi-directional. They can be used either as an input or an output. We configure everything as outputs, except the IO pins where the two buttons are connected. The RX pin for the serial line automatically becomes an input when USART RX is enabled.

    1) DDRx sets the data direction of the IO pins. (Data Direction Register). 1 means output, 0 means input.

    2) After directionality has been configured, we set all outputs to 0 to avid any blinking LEDs etc before the interrupt has started.

    3) For pins configured as inputs, the PORTx bit changes its function. Setting a 1 in the PORTx register bit enables an internal pull up resistor. The port is pulled up to VCC. The buttons are connected between the port and GND. When a button is pressed the corresponding PINx bit reads a logic 0.

    4) Timer 2 is configured and a timer interrupt enabled. This is covered in a separate step.

    5) Serial communications is configured and enabled. This is also covered in a separate step.

Step 52: Software: Mode selection and random seed

  1. LED Cube 8x8x8

    When we first started writing effects and debugging them, we noticed that the functions using random numbers displayed the exact same animations every time. It was random alright, but the same random sequence every time. Turns out the random number generator in the ATmega needs to be seeded with a random number to create true random numbers.

    We wrote a small function called bootwait(). This function serves two purposes.

    1) Create a random seed. 2) Listen for button presses to select mode of operation.

    It does the following:

    1) Set counter x to 0.

    2) Start an infinite loop, while(1).

    3) Increment counter x by one.

    4) Use x as a random seed.

    5) Delay for a while and set red status led on.

    6) Check for button presses. If the main button is pressed, the function returns 1. If the PGM button is pressed it returnes 2. The return statements exits the function thus ending the infinite loop.

    7) Delay again and set green led on.

    8) Check for button presses again.

    9) Loop forever until a button is pressed.

    The loop loops very fast, so the probability that you will stop it at the same value of x two times in a row is very remote. This is a very simple but effective way to get a good random seed.

    Bootwait() is called from the main() function and its return value assigned to the variable i.

    If i == 1, the main loop starts a loop that displays effects generated by the ATmega. If i == 2, it enters into RS232 mode and waits for data from a computer.

Step 53: Software: Interrupt routine

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 7 Artikel anzeigen

    The heart of the LED cube code is the interrupt routine.

    Every time this interrupt runs, the cube is cleared, data for the new layer is loaded onto the latch array, and the new layer is switched on. This remains on until the next time the interrupt runs, where the cube is cleared again, data for the next layer is loaded onto the latch array, and the next layer is switched on.

    The ATmega32 has 3 timer/counters. These can be set to count continuously and trigger an interrupt routine every time they reach a certain number. The counter is reset when the interrupt routine is called.

    We use Timer2 with a prescaler of 128 and an Output Compare value of 10. This means that the counter is incremented by 1 for every 128th cpu cycle. When Timer2 reaches 10, it is reset to 0 and the interrupt routine is called. With a cpu frequency of 14745600 Hz, 128 prescaler and output compare of 10, the interrupt routine is called every 1408th CPU cycle (128*11) or 10472.7 times per second. It displays one layer at a time, so it takes 8 runs of the interrupt to draw the entire cube once. This gives us a refresh rate of 1309 FPS (10472.7/8). At this refresh rate, the LED cube is 100% flicker free. Some might say that 1300 FPS is overkill, but the interrupt routine is quite efficient. At this high refresh rate, it only uses about 21% of the CPU time. We can measure this by attaching an oscilloscope to the output enable line (OE). This is pulled high at the start of each interrupt and low at the end, so it gives a pretty good indication of the time spent inside the interrupt routine.

    Before any timed interrupts can start, we have to set up the Timer 2. This is done in the ioinit() function.

    TCCR2 (Timer Counter Control Register 2) is an 8 bit register that contains settings for the timer clock source and mode of operation. We select a clock source with a 1/128 prescaler. This means that Timer/counter 2 is incrementet by 1 every 128th CPU cycle.

    We set it to CTC mode. (Clear on Timer Compare). In this mode, the counter value TCNT2 is continuously compared to OCR2 (Output Compare Register 2). Every time TCNT2 reaches the value stored in OCR2, it is reset to 0 and starts counting from from 0. At the same time, an interrupt is triggered and the interrupt routine is called.

    For every run of the interrupt, the following takes place:

    1) All the layer transistors are switched off.

    2) Output enable (OE) is pulled high to disable output from the latch array.

    3) A loop runs through i = 0-7. For every pass a byte is outputed on the DATA bus and the i+1 is outputed on the address bus. We add the +1 because the 74HC138 has active low outputs and the 74HC574 clock line is triggered on the rising edge (transition from low to high).

    4) Output enable is pulled low to enable output fro the latch array again.

    5) The transistor for the current layer is switched on.

    6) current_layer is incremented or reset to 0 if it moves beyond 7.

    Das ist es. The interrupt routine is quite simple. I'm sure there are some optimizations we could have used, but not without compromising human readability of the code. For the purpose of this instructable, we think readability is a reasonable trade-off for a slight increase in performance.

Step 54: Software: Low level functions

  1. LED Cube 8x8x8
    We have made a small library of low level graphic functions.
    There are three main reasons for doing this.

    Memory footprint

    The easiest way to address each voxel would be through a three dimensional buffer array. Wie das:

    unsigned char cube[x][y][z]; (char means an 8 bit number, unsigned means that it's range is from 0 to 255. signed is -128 to +127)

    Within this array each voxel would be represented by an integer, where 0 is off and 1 is on. In fact, you could use the entire integer and have 256 different brightness levels. We actually tried this first, but it turned out that our eBay LEDs had very little change in brightness in relation to duty cycle. The effect wasn't noticeable enough to be worth the trouble. We went for a monochrome solution. On and off.

    With a monochrome cube and a three dimensional buffer, we would be wasting 7/8 of the memory used. The smallest amount of memory you can allocate is one byte (8 bits), and you only need 1 bit to represent on and off. 7 bits for each voxel would be wasted. 512*(7/8) = 448 bytes of wasted memory. Memory is scarce on micro controllers, so this is a sub-optimal solution.

    Instead, we created a buffer that looks like this:

    unsigned char cube[z][y];

    In this buffer the X axis is represented within each of the bytes in the buffer array. This can be quite confusing to work with, which brings us to the second reason for making a library of low level drawing functions:

    Code readability

    Setting a voxel with the coordinates x=4, y=3, z=5 will require the following code:

    cube[5][3] |= (0x01 << 4);

    You can see how this could lead to some serious head scratching when trying to debug your effect code ;)

    In draw.c we have made a bunch of functions that takes x,y,z as arguments and does this magic for you.

    Setting the same voxel as in the example above is done with setvoxel(4,3,5), which is _a lot_ easier to read!

    draw.c contains many more functions like this. Line drawing, plane drawing, box drawing, filling etc. Have a look in draw.c and familiarize yourself with the different functions.

    Reusable code and code size

    As you can see in draw.c, some of the functions are quite large. Writing that code over and over again inside effect functions would take up a lot of program memory. We only have 32 KB to work with. Its also boring to write the same code over and over again ;)

Step 55: Software: Cube virtual space

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8


    Now that we have a cube buffer and a nice little collection of low level draw functions to populate it, we need to agree on which ways is what, and what is up and what is down ;)

    From now on, the native position of the LED cube will be with the cables coming out to the left.

    In this orientation, the Y axis goes from left to right. The X axis goes from front to back. The Z axis goes from bottom to top.

    Coordinates in this instructable is always represented as x,y,z.

    Position 0,0,0 is the bottom left front corner. Position 7,7,7 is the top right back corner.

    Why did we use the Y axis for left/right and X for back/front? Shouldn't it be the other way around? Yes, we think so too. We designed the the LED cube to be viewed from the "front" with the cables coming out the back. However, this was quite impractical when having the LED cube on the desk, it was more practical to have the cables coming out the side, and having cube and controller side by side. All the effect functions are designed to be viewed from this orientation.

Step 56: Software: Effect launcher

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    We wanted an easy way to run the effects in a fixed order or a random order. The solution was to create an effect launcher function.

    launch_effect.c contains the function launch_effect (int effect).

    Inside the function there is a switch() statement which calls the appropriate effect functions based on the number launch_effect() was called with.

    In launch_effect.h EFFECTS_TOTAL is defined. We set it one number higher than the highest number inside the switch() statement.

    Launching the effects one by one is now a simple matter of just looping through the numbers and calling launch_effect(), like this:

    while(1)

    for (i=0; i < EFFECTS_TOTAL; i++)
    {

    launch_effect(i);

    }
    }

    This code will loop through all the effects in incremental order forever.
    If you want the cube to display effects in a random order, just use the following code:

    while (1)
    {

    launch_effect(rand()%EFFECTS_TOTAL);
    }

    The %EFFECTS_TOTAL after rand() keeps the random value between 0 and EFFECTS_TOTAL-1.

Step 57: Software: Effect 1, rain

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Lets start with one of the simplest effects.

    In effect.c you will find the function effect_rain(int iterations).

    This effect adds raindrops to the top layer of the cube, then lets them fall down to the bottom layer.

    Most of the effects have a main for() loop that loops from i=0 to i < iterations.
    effect_rain(int iterations) only takes one argument, which is the number of iterations.

    Inside the iteration loop, the function does the following:

    1) Create a random number between 0 and 3, lets call it n here.

    2) Loop a for() loop n number of times.

    3) For each iteration of this loop, place a pixel on layer 7 (z=7) at random x and y coordinates.

    4) Delay for a while

    5) Shift the contents of the entire cube along the Z axis by -1 positions. This shifts everything down one level.

    This is a pretty simple effect, but it works!


Step 58: Software: Effect 2, plane boing

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Another simple effect, effect_planboing(int plane, int speed).

    This effect draws a plane along the specified axis then moves it from position 0 to 7 on the axis and back again. This is very simple, but it really brings out the depth of the 3d LED cube :)

    This function doesn't have an iteration loop. Instead it is called twice for each axis in launch_effect().

    Here is what it does:

    1) For()-loop i from 0 to 7.

    2) Clear the cube with fill(0x00);

    3) Call setplane() to draw a plane along the desired axis at position i. The plane isn't actually drawn on the axis specified, it is drawn on the other two axis. If you specify AXIS_Z, a plane is drawn on axis X and Y. It's just easier to think of it that way. Instead of having constants named PLANE_XY, PLANE_YZ etc.

    4) Delay for a while.

    5) Repeat the same loop with i going from 7 to 0.

    Very simple, but a very cool effect!

Step 59: Software: Effect 3, sendvoxels random Z

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    This effect sends voxels up and down the Z axis, as the implies.

    void sendvoxels_rand_z() takes three arguments. Iterations is the number of times a voxel is sent up or down. Delay is the speed of the movement (higher delay means lower speed). Wait is the delay between each voxel that is sent.

    This is how it works:

    1) The cube is cleared with fill(0x00);

    2) Loop through all 64 positions along X/Y and randomly set a voxel at either Z=0 or Z=7.

    3) Enter the main iteration loop

    4) Select random coordinates for X and Y between 0 and 7. If the X and Y coordinates are identical to the previous coordinates, this iteration is skipped.

    5) Check if the voxel at this X/Y coordinate is at Z=0 or Z=7, and send it to the opposite side using sendvoxel_z().

    6) Delay for a while and save the coordinates of this iteration so we can check them against the random coordinates in the next iteration. It looked weird to move the same voxel twice in a row.

    The actual movement of the voxels is done by another function, sendvoxel_z. The reason for this, is that a couple of other effects does the same thing only in different ways.

    The function sendvoxel_z() takes four argument. X and Y coordinates. Z coordinate, this is the destination and can either be 0 or 7. Delay which controls the speed.

    This is how it works:

    1) For()-loop i from 0 to 7.

    2) If the destination is 7, we set ii to 7-1, thus making ii the reverse of i. Clear the voxel at Z = ii+1. When moving down, ii+1 is the previous voxel.

    3) If the destination is 0, let ii be equal to i. Clear ii-1. When moving upwards, -1 is the previous voxel.

    4) Set the voxel at z=ii.

    5) Wait for a while.

Step 60: Software: Effect 4, box shrinkgrow and woopwoop

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    Alle 8 Artikel anzeigen
    A wireframe box is a good geometric shape to show in a monochrome 8x8x8 LED cube. It gives a very nice 3d effect.
    We made two box animation functions for the LED cube. Effect_box_shrink_grow() draws a wireframe box filling the entire cube, then shrinks it down to one voxel in one of 8 corners. We call this function one time for each of the 8 corners to create a nice effect. Effect_box_woopwoop() draws a box that starts as a 8x8x8 wireframe box filling the entire cube. It then shrinks down to a 2x2x2 box at the center of the cube. Or in reverse if grow is specified.

    Here is how effect_box_shrink_grow() works.

    It takes four arguments, number of iterations, rotation, flip and delay. Rotation specifies rotation around the Z axis at 90 degree intervals. Flip > 0 flips the cube upside-down.

    To make the function as simple as possible, it just draws a box from 0,0,0 to any point along the diagonal between 0,0,0 and 7,7,7 then uses axis mirror functions from draw.c to rotate it.

    1) Enter main iteration loop.

    2) Enter a for() loop going from 0 to 15.

    3) Set xyz to 7-i. This makes xyz the reverse of i. We want to shrink the box first, then grow. xyz is the point along the diagonal. We just used one variable since x, y and z are all equal along this diagonal.

    4) When i = 7, the box has shrunk to a 1x1x1 box, and we can't shrink it any more. If i is greater than 7, xyz is set to i-8, which makes xyz travel from 0 to 7 when i travels from 8 to 15. We did this trick to avoid having two for loops, whith one going from 7-0 and one from 0-7.

    5) Blank the cube and delay a little bit to make sure the blanking is rendered on the cube. Disable the interrupt routine. We do this because the mirror functions takes a little time. Without disabling interrupts, the wireframe box would flash briefly in the original rotation before being displayed rotated.

    6) Draw the wireframe box in its original rotation. side of the box is always at 0,0,0 while the other travels along the diagonal.

    7) Do the rotations. If flip is greather than 0, the cube is turned upside-down. rot takes a number from 0 to 3 where 0 is 0 degrees of rotation around Z and 3 is 270 degrees. To get 270 degrees we simply mirror around X and Y.

    8) Enable interrupts to display the now rotated cube.

    9) Delay for a while then clear the cube.

    The other function involved in the wireframe box effect is effect_box_woopwoop(). The name woopwoop just sounded natural when we first saw the effect rendered on the cube ;)

    The woopwoop function only does one iteration and takes two arguments, delay and grow. If grow is greater than 0, the box starts as a 2x2x2 box and grow to a 8x8x8 box.

    Here is how it works:

    1) Clear the cube by filling the buffer with 0x00;

    2) For()-loop from 0 to 3.

    4) Set ii to i. If grow is specified we set it to 3-i to reverse it.

    5) Draw a wireframe box centered along the diagonal between 0,0,0 and 7,7,7. One corner of the box uses the coordinates 4+ii on all axes, moving from 4-7. The other corner uses 3-ii on all axes, moving from 3-0.

    6) Delay for a while, then clear the cube.

    These two functions are used as one single effect in the effect launcher. First the shrink grow effect is called 8 times, one for each corner, then woopwoop is called four times, two shrink and grow cycles.

    To launch the shrink grow function, we used a for loop with some neat bit manipulation tricks inside to avoid writing 8 lines of code.

    The second argument of the shrink grow functions is the rotation, in 4 steps. We are counting from 0 to 7, so we can't simply feed i into the function. We use the modulo operator % to keep the number inside a range of 0-4. The modulo operator divides by the number specifies and returns the remainder.

    The third argument is the flip. When flip = 0, the cube is not flipped. > 0 flips. We use the bitwise AND operator to only read bit 3 of i.

    Bitwise operators are an absolute must to know about when working with micro controllers, but that is outside the scope of this instructable. The guys over at AVR Freaks have posted some great information about this topic. You can read more at http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=37871

Step 61: Software: Effect 5, axis updown randsuspend

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    This is one of our favorite effects. The voxels randomly suspended in the cube gives a nice 3d depth, especially if you move your head while viewing the effect.

    64 voxels start out on one of the side walls. Then they all get assigned a random midway destination between the side wall they started at and the wall on the opposite side.

    The function then loops 8 times moving each voxel closer to its midway destination. After 8 iterations, the voxels are suspended at different distances from where they started. The function then pauses for a while, thus the name axis_updown_randsuspend ;). It then loops 8 times again moving the voxels one step closer to their final destination on the opposite wall each time.

    The actual voxel drawing is done in a separate function, draw_positions_axis() so it can be used in different effects. For example, the voxels could be suspended midway in a non-random pattern. We will leave it up to you to create that effect function! : D

    You may have noticed that the description for this effect was less specific. We encourage you to download the source code and read through the functions yourself. Keep the text above in mind when reading the code, and try to figure out what everything does.

Step 62: Software: Effect 6, stringfly

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    8x8 is about the smallest size required to render a meaningful text font, so we just had to do just that!

    We loaded a 8x5 bitmap font that we had previously used with a graphical LCD display into EEPROM memory, and created some functions that took an ASCII char as an argument and returned a bitmap of the character.

    The function stringfly2 takes any ASCII string and displays it as characters flying through the cube.

    It starts by placing the character at the back of the cube, then uses the shift() function to shift the cube contents towards you, making the text fly.


Step 63: Software: RS-232 input

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    To generate the most awesome effects, we use a desktop computer. Computers can do floating point calculations and stuff like that much quicker than a micro controller. And you don't have to re-program the micro controller for every effect you make, or every time you want to test or debug something.

    The USART interface in the ATmega is configured to work at 38400 baud with one stop bit and no parity. Each byte that is sent down the line has a start bit and a stop bit, so 10 bits is sent to transmit 8 bits. This gives us a bandwidth of 3840 bytes per second. The cube buffer is 64 bytes. Syncing bytes make up 2 bytes per cube frame. At 38400 baud we are able to send about 58 frames per second. More than enough for smooth animations.

    0xff is used as an escape character, and puts the rs232 function into escape mode. If the next byte is 0x00, the coordinates for the buffer are restored to 0,0. If the next byte is 0xff, it is added to the buffer. To send 0xff, you simply send it twice.

    The rs232 function just loops forever. A reset is needed to enter the cube's autonomous mode again.

Step 64: PC Software: Introduction

  1. LED Cube 8x8x8

    The cube just receives binary data via RS232. This data could easily be generated by a number of different programming languages, like python, perl or even php.

    We chose to use C for the PC software, since the micro controller software is written in C. This way effects from the micro controller code can just be copy-pasted into the PC software.

    Just like in the micro controller code, this code also does two things. Where the micro controller has an interrupt routine that draws the contents of cube[][] onto the LED cube, the PC software has a thread that continually sends data to the LED cube.

Step 65: PC Software: Cube updater thread

  1. LED Cube 8x8x8

    In cube.c we have a function called cube_push(). This takes the 64 byte array and sends it down the serial line to the LED cube.

    It also handles the formatting, sending every 0xff byte twice because 0xff is our escape character. 0xff and 0x00 is sent first to reset the LED cubes internal x and y counters.

    In main.c we have the function cube_updater(). This function is launched as a separate thread using pthread_create(). The main thread and the cube updater thread shares the memory area rs232_cube[8][8]. The cube updater thread is just a while true loop that calls cube_push() over and over.

    The first attempt at an updater thread turned out to create some flickering in the animations. After some debugging, we found out that frames were being transmitted before they were fully drawn by the effect functions. We generally do a fill(0x00), then some code to draw new pixels. If a frame is transmitted right after a fill(0x00), the cube will flash an empty frame for 1/60th ish of a second.

    This wasn't a problem in the code running on the LED cube, since it has a refresh rate of over 1000 FPS, but at 60 FPS you can notice it.

    To overcome this we create a double buffer and sync the two buffers at a point in time where the effect function has finished drawing the frame. Luckily all the effect functions use the delay_ms() function to pause between finished frames. We just put a memcpy() inside there to copy the cube buffer to the rs232 buffer. This works beautifully. No more flickering!

Step 66: PC Software: Effect 1, ripples

  1. LED Cube 8x8x8

    This is the first effect we made for the PC software, and we think it turned out very nice.

    While this may seem like a complicated effect, it's really not!

    All the effect functions running on the micro controller mostly use if() statements to create effects. The effects on the PC software are built a little different. We use a lot of sin(), cos() and other math functions here. Most coordinates are calculated as floating point coordinates then typecast into integers before being drawn on the cube.

    The effect you see in the video is actually just a sine wave eminating from the center of the cube, x=3.5, y=3.5.

    Here is how it works:

    1) Loop through the iteration counter.

    2) Loop through all 64 x and y coordinates.

    3) Calculate the distance between the center of the cube and the x/y coordinate.

    4) The z coordinate is calculated with sin() based on the distance from the center + the iteration counter. The result is that the sine wave moves out from the center as the iteration counter increases.

    Look how easy that was!

Step 67: PC Software: Effect 2, sidewaves

  1. LED Cube 8x8x8

    This is basically the exact same function as the ripple function.

    The only difference is the coordinates of the point used to calculate the distance to each x/y coordinate. We call this point the origin, since the wave emanates from this point.

    The origin coordinate is calculated like this:

    x = sin(iteration counter) y = cos(iteration counter)

    The result is that these x and y coordinates moves around in a circle, resulting in a sin wave that comes in from the side.

    We just wanted to show you how easy it is to completely alter an effect by tweaking some variables when working with math based effects!

Step 68: PC Software: Effect 3, fireworks

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    This effect was quite fun to make.
    To make this effect, we really had to sit down and think about how fireworks work, and which forces influence the firework particles.

    We came up with a theoretical model of how fireworks work:

    1) A rocket is shot up to a random position, origin_x, origin_y, origin_z.

    2) The rocket explodes and throws burning particles out in random directions at random velocities.

    3) The particles are slowed down by air resistance and pulled towards the ground by gravity.

    With this model in mind we created a fireworks effect with a pretty convincing result. Here is how it works:

    1) A random origin position is chosen. (within certain limits, x and y between 2 and 5 to keep the fireworks more or less in the center of the cube. z between 5 and 6. Fireworks exploding near the ground can be dangerous! :p)

    2) The rocket, in this case a single voxel is moved up the Z axis at the x and y coordinates until it reaches origin_z.

    3) An array of n particles is created. Each particle has an x, y and z coordinate as well as a velocity for each axis, dx, dy and dz.

    4) We for() loop through 25 particle animation steps:

    5) A slowrate is calculated, this is the air resistance. The slowrate is calculated using tan() which will return an exponentially increasing number, slowing the particles faster and faster.

    6) A gravity variable is calculated. Also using tan(). The effect of gravity is also exponential. This probably isn't the mathematically correct way of calculating gravity's effect on an object, but it looks good.

    7) For each particle, the xy and z coordinates are incremented by their dx, dy and dz velocities divided by the slowrate. This will make the particles move slower and slower.

    8) The z coordinate is decreased by the gravity variable.

    9) The particle is drawn on the cube.

    10) Delay for a while, then do the next iteration of the explosion animation.

    We are quite pleased with the result.

Step 69: PC Software: Effect 4, Conway's Game of Life 3D

  1. LED Cube 8x8x8
    The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway. You can read more about this on Wikipedia , if you haven't heard about it before.

    By popular demand, we have implemented Game of Life in 3D on the LED cube.
    To make it work in 3d the rules have to be tweaked a little:

    A dead cell becomes alive if it has exactly 4 neighbors A live cell with 4 neighbors live A live cell with 3 or fewer neighbors die A live cell with 5 or more neighbors die The program starts by placing 10 random voxels in one corner of the cube, then the game of life rules are applied and the iterations started.

    In the second video, we run the animation faster and seed with 20 voxels.



Step 70: Run the cube on an Arduino

  1. LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8

    LED Cube 8x8x8


    Since we published our last LED Cube instructable, we have gotten a lot of questions from people wondering if they could use an Arduino to control the cube.

    This time, we are one step ahead of you on the "Can i use an arduino?" front :D

    The IO requirements for an 8x8x8 LED cube is:
    Layer select: 8 Data bus for latches: 8 Address bus for latches: 3 Output enable (OE) for latches: 1
    Total: 21

    The Arduino has 13 GPIO pins and 8 analog inputs, which can also be used as GPIO. This gives you a total of 21 IO lines, exactly the amount of IO needed to run the LED cube!

    But why write about it when we could just show you?

    We hooked the cube up to an Arduino and ported some of the software.

    Since the multiplexer array and AVR board are separated by a ribbon cable, connecting the IO lines to an Arduino is a simple matter of connecting some breadboard wires. Luckily, we soldered in a female 0.1" pin header for the transistor lines when we were debugging the first set of transistors. Just remove the ATmega and connect wires from the Arduino to these pin headers.

    We connected the cube like this: DATA bus: Digital pins 0-7. This corresponds to PORTD on the ATmega328 on the Arduino board, so we can use direct port access instead of Arduinos digitalWrite (which is slow). Address bus: Digital pins 8-10. This corresponds to PORTB bit 0-2. On this we HAVE to use direct port access. Arduinos digitalWrite wouldn't work with this, because you can't set multiple pins simultaneously. If the address pins are not set at the exact same time, the output of the 74HC138 would trigger the wrong latches. Output Enable: Digital pin 11. Layer transistors: Analog pins 0-5 and digital pins 12 and 13.

    We had to go a bit outside the scope of the Arduino platform. The intention of Arduino is to use digitalWrite() for IO port access, to make the code portable and some other reasons. We had to sidestep that and access the ports directly. In addition to that, we had to use one of the timers for the interrupt routine.

    The registers for the interrupt and timers are different on different AVR models, so the code may not be portable between different versions of the Arduino board.

    The code for our quick Arduino hack is attached.

Step 71: Hardware debugging: Broken LEDs

  1. LED Cube 8x8x8
    Disaster strikes. A LED inside the cube is broken!

    We had a couple of LEDs break actually. Luckily the hardest one to get to was only one layer inside the cube.

    To remove the LED, just take a small pair of needle nose pliers and put some pressure on the legs, then give it a light touch with the soldering iron. The leg should pop right out. Do this for both legs, and it's out.

    Inserting a new LED is the tricky part. It needs to be as symmetrical and nice as the rest of the LEDs. We used a helping hand to hold it in place while soldering. It went surprisingly well, and we can't even see which LEDs have been replaced.

Step 72: Feedback

  1. LED Cube 8x8x8

    We love getting feedback on our projects! The 4x4x4 LED cube has received a ton of feedback, and many users have posted pictures and videos of their LED cubes.

    If you follow this Instructable and make your own LED cube, please post pictures and video!

    Oh, and don't forget to rate this Instructable if you liked it :)

    As a token of gratitude for all the great feedback, here is a collage of some of the feedback on our 4x4x4 LED cube instructable: