[:de]Projekt Lavalampe, Teil 1 – Hardware[:en]Lava lamp project, part 1 – hardware[:]
[:de]
Ich wollte mal wieder etwas mit Elektronik basteln und überlegte, eine Lampe zu bauen, die in verschiedenen Farben leuchtet und die von einem Computer programmiert werden kann. Meine Idee ist, das Ding an den Computer anzuschliessen und den Computer dann verschiedene Zustände durch unterschiedliche Farben anzeigen zu lassen. Beispielsweise soll ein laufender Programmbuild während des Compilierens und Testens blau blinken, und nach Abschluss des Buildvorganges soll die Lampe grün leuchten, wenn alles funktioniert hat, und rot leuchten, wenn es Probleme gab.
Ich habe die nebenstehende Lavalampe gefunden, die mit einer farbigen LED ausgerüstet ist, die von sich aus andauernd die Farbe ändert, und die mit einem USB-Anschlusskabel versehen ist, über das sie Strom von einem Computer erhält.
Die eingebaute Farbwechsel-LED ist ein Sondermodell. Sie sieht aus wie eine normale einfarbige LED, hat aber drei LEDs für rot, grün und blau sowie einen Chip, der bei angelegter Speisung automatisch die drei Farben der LED durch alle Regenbogefarben hindurchsteuert in einer zeitlichen Abfolge. Einzelne Farben lassen sich damit nicht gezielt ansteuern. Einzig die Grundfarbe rot lässt sich durch getaktete Speisung erzielen, mehr nicht. Diese LED erfüllt also den von mir gewünschten Zweck nicht.
Stattdessen benötige ich eine mehrfarbige LED, deren Grundfarben alle einzeln angesteuert werden können. Solche LEDs kann man kaufen, beispielsweise diese hier mit gemeinsamer Kathode.
Jetzt brauche ich eine Steuerelektronik, die USB-Signale entgegennimmt und somit von einem Computer bedient werden kann, und aufgrund dieser Signale die Farben einer solchen LED steuert. Ein Kumpel wies mich auf den Picaxe Mikrocontroller hin, der einen seriellen Eingang hat und ein paar digitale Ausgänge, mit denen die verschiedenen Farben einer LED gesteuert werden können. Ich kam zu diesem Schaltschema:

J1 ist der Hauptanschlussstecker mit folgenden Pins:
- +5V
- Serieller Augang
- Serieller Eingang
- 0V
Um den nicht benötigten Eingang C3 doch noch sinnvoll einzusetzen, entschied ich mich, einen Taster vorzusehen, der im Picaxe eine Funktion auslösen kann. Etwa könnte ein festes Farbwechselprogramm ausgelöst werden, oder die LED könnte ein- und ausgeschaltet werden. Der Taster kann an J2 angeschlossen werden.
R6 ist ein Heizwiderstand, der die Lavalampe erwärmen soll, damit das im Wasser befindliche Glitter sich zu bewegen beginnt.
Jetzt brauche ich noch einen USB-zu-Seriell-Adapter.
Solche gibt es zu kaufen. Ich habe den hier gekauft, die Kunststoffhülle des dicken Stecker abgezwickt, die darin befindliche Elektronik direkt mit meiner obigen Schaltung verlötet, und das ganze Konstrukt in den Fuss der Lavalampe eingebaut.
Mit diesem Konstrukt hat man ein USB-Gerät, an dem sich am PC ein serieller COM-Port meldet, an den wiederum der Picaxe angeschlossen ist. Dieser kann über die reguläre Picaxe-IDE „Picaxe Editor 6“ programmiert werden. Auf die notwendige Programmierung des Picaxe komme ich in einem späteren Artikel zu sprechen.
Zusammengefasst kann man sagen, dass für meine Projektidee drei Herausforderungen zu meistern sind:
- Die Hardware muss gebaut werden. Diesen Vorgang habe ich hier grob beschrieben und dokumentiert.
- Die Firmware für den Picaxe muss geschrieben werden. Hier handelt es sich um ein Stück Software, das Farbstärken über den USB-Port entgegennimmt und die Dreifarb-LED entsprechend leuchten lässt. Eine solche Firmware habe ich bereits geschrieben.
- Die Software, die aufgrund verschiedener Ereignisse im Computer die gewünschte Leuchtfarbe an den USB-Port ausgibt, steht erst in den Anfängen. Hier befürchte ich auch die grösste Komplexität, bzw. hier kann beliebig viel Aufwand hineingesteckt werden für mehr oder weniger luxuriöse Dinge. Dieser Teil ist womöglich immer irgendwie unfertig. 🙂
Teil 2 dieser Artikelreihe ist hier.[:en]
I wanted to build a device that can light in different colors, and where the colors can be controlled from a computer. My idea was to hook it up with a computer, who then should signal some state by lighting the appropriate color. For example, while building and compiling a program, the lamp should blink in blue color. When the build is finished, the lamp should light either in green (when the build ran fine) or red (when something went wrong).
I found the lava lamp shown to the right, which is equipped with a color-changing LED and is powered from USB. I bought one and intended to modify the controlling electronics to my purposes.
The lava lamp has a built in color LED with a controller chip, that goes through all the rainbow colors in a preset timing. Individual colors can not be displayed as need with this kind of LED. Only the color red can be achieved by pulsing the input voltage. This LED, therefore, does not fulfill the intended purpose.
Instead I need a RGB-LED, whose colors can be controlled individually. That kind of LED can be bought in your favorite electronics market, for example this one with common cathode.
What I needed now is some control electronics, that can interface to USB, can be programmed from the computer, and control the color of a colored LED. A friend of mine told me about the Picaxe microcontroller as an easy way to receive serial signals and which also has digital or analog outputs to control an LED. Therefore, this is what I came up with:

J1 is the main connector with these pins:
- VDD, 5V
- Serial out
- Serial in
- VSS, or Ground, or 0V
J2 corresponds to SW1 and it can be used for doing whatever the Picaxe can be programmed to do with it. Maybe it can start a fixed color-changing program, or it can turn the LED on or off.
R6 is a power resistor supposed to warm the lava lamp water a little, so that the glitter in the water gets moving.
Now I need a USB-to-serial adapter. I bought this one, whose fat plug I removed and soldered the
relevant pins directly to J1 of my circuit above. Now I only need to attach the whole thing in the foot of the lava lamp
With this construction, I end up with a USB device that announces itself to the computer as a serial COM port, which is attached to the Picaxe microcontroller. The Picaxe can be programmed with the help of the normal „Picaxe Editor 6“ IDE. I will talk about the necessary firmware programming in another article.
As a conclusion, one can say that my project idea requires mastery of the following three challenges:
- The Hardware must be built. I described this process here roughly.
- The Firmware for the Picaxe must be written. This is a piece of software, that reads the desired color combinations from the USB port and lights up the three colors of the LED accordingly. I wrote this firmware already.
- The Software, that sends the necessary color codes to the USB port as a result of more or less complex events in the computer has only just begun its development phase. I am afraid that this part has the greatest complexity. In other words, it is possible to invest a huge amount of effort in order to create a more or less luxurious thing. This part may never really be finished. 🙂
