PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : RGB Ambient Light



robocat
09.01.2008, 19:50
zwar kein herausragendes projekt, aber vielleicht trotzdem für jemanden interessant: eine RGB led mit fliessenden farbübergängen und lichtorgel-funktion, per fernbedienung steuerbar.

http://katze.dead-men.de/upload/81_ambilight.jpg

die leds werden über transistoren durch die 3 PWM ausgänge des atmega8 angesteuert. die signale der fernbedienung werden über einen TSOP1733 empfangen und mit dem RC5-decoder von Peter Dannegger ausgewertet. ein audio-signal liegt (mit einem transistor verstärkt) an einem ADC-eingang an. mit der FFT von E.Chan werden die frequenzanteile bestimmt und damit die led als lichtorgel betrieben.

http://katze.dead-men.de/upload/82_ambilight_circuit.png
(mein erster eagle-schaltplan.. wenn etwas daran nicht passt, sagt es mir bitte)

die osram-led hat mir ein bekannter überlassen, ich musste sie halbieren, weil sie sonst nicht in den stein gepasst hätte:
http://katze.dead-men.de/upload/83_led.jpg
der 7805 wird durch die hohe betriebsspannung (die led will 24V) ordentlich heiss, das ist nicht optimal. die led war aber quasi vorgegeben, und bisher (einige tage dauerbetrieb) hat es der regler überstanden.

aufgebaut wurde die schaltung auf lochraster:
http://katze.dead-men.de/upload/84_platine.jpg

interessant am quellcode könnte (ausser der FFT und dem RC5-decoder) die HSL/RGB-funktion sein. damit sind stufenlose farbübergänge (keine "sprünge") und einstellung von sättigung und helligkeit möglich:

// set pwm according to HSL values
// hue (0-1535), saturation (0-255), brighness (0-255)
void HSLtoLED(unsigned int h,unsigned int s,unsigned int l)
{
unsigned int r,g,b;
unsigned int satr,satg,satb,ctmpr,ctmpg,ctmpb;

if (h < 512)
{
satr = (512 - h);
satg = h;
satb = 0;
}
else if (h < 1024)
{
satr = 0;
satg = (1024 - h);
satb = (h - 512);
}
else
{
satr = (h - 1024);
satg = 0;
satb = (1536 - h);
}
if(satr>255)satr=255;
if(satg>255)satg=255;
if(satb>255)satb=255;

ctmpr = satr * s / 256 + (255 - s);
ctmpg = satg * s / 256 + (255 - s);
ctmpb = satb * s / 256 + (255 - s);

if (l < 128)
{
r = l * ctmpr / 256;
g = l * ctmpg / 256;
b = l * ctmpb / 256;
}
else
{
r = (255 - l) * ctmpr / 256 + 2 * l - 255;
g = (255 - l) * ctmpg / 256 + 2 * l - 255;
b = (255 - l) * ctmpb / 256 + 2 * l - 255;
}

OCR1AL=r;
OCR1BL=g;
OCR2=b;
}

projektdatei, makefile und sourcecode als rar-archiv:
http://katze.dead-men.de/upload/85_ambilight.rar

ich hätte den code noch ein wenig aufräumen und ein paar bytes einsparen können, dazu war ich zu faul. die 4kB flash-rom des atmega8 sind nahezu vollständig belegt.

gruesse

Lunarman
09.01.2008, 20:13
24 Volt? Öhm... Kühlkörper? Soweit ich weiß muss dringend ein Kühlkörper an den Regler, sonst hält er nit lange... aber sonst netets Projekt :)

robocat
09.01.2008, 20:31
ja, da hast du recht. ich habe nur gerade (noch) keinen hier, und nachdem ich im datenblatt etwas von "Internal Thermal Overload Protection" gelesen hatte und "temperature range 0 to 150°C" habe ich es mal "auf gut glück" ohne kühlkörper versucht. man verbrennt sich bisschen die pfoten, aber über 100° sind es glaube ich nicht. ich mach bald einen dran, versprochen ;)

deSilva
09.01.2008, 23:39
Opps - sorry, Irrtum...

robocat
10.01.2008, 00:03
dein link geht nicht, aber ich glaube du meinst so einen integrated DC/DC wandler:
http://www.conrad.de/goto.php?artikel=154483
das sieht schon gut aus, aber (ich weiss das klingt geizig) 10 euro ist mir dafür zuviel. ich hätte es mit einem LM2576 (http://www.ortodoxism.ro/datasheets/BayLinear/mXuutyz.pdf) aufbauen können, aber das ist mir erst eingefallen, als ich die schaltung fertig hatte. trotzdem danke für den hinweis.

gruesse

Andree-HB
10.01.2008, 05:42
Oder der kleine Bausatz (< 4,-€) beim nächsten Polling-Ordering :
http://www.pollin.de/shop/shop.php?cf=detail.php&pg=OA==&a=NDc5OTgxOTk=&w=OTk4OTY4&ts=20

..läuft gut, habe ich auch mehrfach im Einsatz

Würdest Du bei Gelegenheit mal ein Video mit den verschiedenene Modi zeigen, würde mich sehr interessieren !

robocat
11.01.2008, 20:48
ich habe mal versucht ein video zu machen, ich hoffe dass es bei dir dargestellt werden kann (bin da nicht so der experte). die klangqualität ist sehr bescheiden, und es werden nur der farb-durchwechsel-modus und der lichtorgel-effekt gezeigt. vielleicht mach ich demnächst noch mal ein video.

http://katze.dead-men.de/upload/86_ambi.avi

der pollin bausatz sieht ganz interessant aus (ausser dass man dann immer eine kleine extraplatine wo unterbringen muss).

gruesse

Lunarman
11.01.2008, 20:59
hey das ist richtig GEIL. Das flackert nicht nur doof sondern ist wirklich im takt... Respekt *daumenhoch*

Andree-HB
11.01.2008, 21:21
...seeeeeehr coooool - gefällt mir supergut !

Und sogar die reale robocat ist kurzzeitig integriert ! ;-)

catchme
18.03.2008, 09:49
Sehr cool =D> Bin auch grad dabei so was ähnliches zu bauen!
Was mich noch interessieren würde - wie bekommt der µC das Audiosignal?
Über ein Kabel vom PC oder über ein Mikrofon?
grüße max

askazo
18.03.2008, 10:12
Im Schaltplan siehts eher so aus, als wenn das Audiosignal per Kabel eingespeist wird (Eingang "Signal")

Nettes Projekt, sowas in der Art habe ich auch in Planung, allerdings mit mehreren Modulen als Gartenbeleuchtung.
Zu dem LED-Modul: Was ist daran so besonders, dass das stolze ~130€ kostet (zumindest beim großen C)???

Gruß,
askazo

Hessibaby
18.03.2008, 11:25
Den 7805 würde ich etwas weiter vom Elko weg einlöten, da die keine hohen Temperaturen mögen.
Ansonsten, Hut ab, nettes Zwischendurchprojekt.
Gruß

robocat
19.03.2008, 16:08
hallo ihr,
danke für das lob *freu*

den 7805 ein stück weiter weg vom elko zu setzen ist eine gute idee. eigentlich naheliegend, dass der es so heiss nicht mag, aber daran habe ich gar nicht gedacht.

das "super-led-modul".. kA was das so kostbar macht (es ist aber nur ein segment, nomal verkauft werden 3 auf einmal). ich kam ausnahmsweise für umsonst dran, sonst hätte ich eine "normale" rgb-led verbaut. es ist allerdings schön hell - zum direkten reingucken nicht geeignet.

das audiosignal kommt vom nicht verwendeten tape-ausgang des verstärkers und nur eins davon (mono) wird für die lichtorgel hergenommen. ich wollte zuerst ein mikrofon verwenden (schönere lösung) aber dann erzeugt jedes rascheln am tisch mehr lichteffekt als die lauteste musi.

gruesse

LatvianMan
09.12.2008, 13:14
Hello,
i searched Net for some RGB PWM "Licht Orgel" and so I found Your project, and it looks just what I needed, with bonus features. I am not newbie in AVR in PICs, but I have a problem to get Your RGB schematics working. It reacts to remote, so I guess clock frequency is working, but all i can get is all LEDs On or Off. I am using ordinary, simple LEDs, connected with resistors to ATMega.
Please would you have any suggestions what i did wrong? Is it in programming fuses maybe? Or something else?
I would really appreciate Your help.
Sorry I write in english, my german is too weak.
Thanks!

HannoHupmann
09.12.2008, 13:31
Erinnert ein bischen an die guten alten StarTrek folgen mit Captain Kirk. Da kammen auch immer wieder Steine mich solchen Lichteffekten vor :-)

thewulf00
09.12.2008, 14:25
Hello,
i searched Net for some RGB PWM "Licht Orgel" and so I found Your project, and it looks just what I needed, with bonus features. I am not newbie in AVR in PICs, but I have a problem to get Your RGB schematics working. It reacts to remote, so I guess clock frequency is working, but all i can get is all LEDs On or Off. I am using ordinary, simple LEDs, connected with resistors to ATMega.
Please would you have any suggestions what i did wrong? Is it in programming fuses maybe? Or something else?
I would really appreciate Your help.
Sorry I write in english, my german is too weak.
Thanks!

Please post your code. There are dozents of possibilities.

LatvianMan
09.12.2008, 14:43
I just used ready .HEX file from Robocat's RAR file. Write ATMega8 with PonyProg, all configuration checkboxes unchecked.

elayne
09.12.2008, 19:48
Hey,
Gratulation zu diesem gelungenen Projekt, sieht wirklich kasse aus. Vorallem Danke für die Bereitstellung einer Doku und des Codes. Das ist äußerst interessant!

Gruß
elayne

thewulf00
10.12.2008, 07:10
I just used ready .HEX file from Robocat's RAR file. Write ATMega8 with PonyProg, all configuration checkboxes unchecked.

Then I think, perhaps that is used to be, i.e. this function is the one, which Robocat wanted to have...

LatvianMan
10.12.2008, 12:15
i am just saying that with provided schematics assembled and provided .HEX burned onto ATMega8 device is not working as it should. No PWM, no Lichtorgel, just chaotic LEDs response to commands from RC5 remote (On, Off, or in rhythm with remote signal).
Its sad, i was so excited when found this project.
I am just hoping author maybe has some hints and ideas what might be wrong.
Thanks.

robocat
10.12.2008, 15:09
hello LatvianMan,
the project is a bit overloaded with RC5 functions and therefor difficult to get up and running without knowing exactly what the different commands (RC5) are meant for. i confess: it is always a quest to set this thing up. without reading and understanding the (poorly documented) code it will take you some time but maybe i can help.

i will try to explain the basic concept and give you some hints, but if you use a different remote control with possibly some buttons not available, i suggest a different approach: dive into the code and create an eeprom file with the setup values manually. there are only a few, but hacking them into with the remote control is kinda difficult.

there are setup values stored in eeprom every time you hit the power button. these determine the brightness level of the R,G,B LEDs and (because there is no .eep file included) are initially set to full brightness, which results in white color(?). furthermore, the FFT "channels" that are used for the lichtorgel part are also stored in eeprom. these require some patience to get set up.

first try to get the static color mode running. this mode is activated with the "stop" button on my remote control (use the code table http://codefactory.dead-men.de/projects/AmbiLight/ to figure out, if the buttons on your remote control have equal codes). the brightness is set up with arrow-up and -down keys (code 20,21).

the cycle color mode is activated by the "play" button (code 53). it uses the same brightness value as the static mode. speed is controlled by some other arrow-left and -right buttons (code 50,52 - actually there are a lot of different arrow buttons on this remote control!) and ranges from veeeery fast cycling (means flickering) to very slow (1h per full cycle which means it can be mistaken as "static" too). if brightness is set too high, this mode will also result in white light).

now for the most difficult part, the lichtorgel:
on my remote control, there are RED GREEN YELLOW and BLUE color buttons (see the table mentioned above for the codes of these). these are important to set up the lichtorgel function. switch to lichtorgel mode with the "record" button (code 55). choose a color (R,G,B) with the color buttons and use the arrow-left and -right buttons (code 50,52) to change the brightness level. YELLOW sets the overall brightness.

to make it somehow more complex, the FFT channel (treble/middle/bass setting) of each color can (and, for the first setup, must be) chosen manually: use the RED button, then enter a number between 0-29 on the number table of your remote control. the lichtorgel should answer the first digit with 1 white flash and the second digit with a double flash which means it accepted the value.
the same procedure goes for the GREEN and BLUE channel.

as you can see, setting up this beast is kind of a mess. i was so happy to finish this project that i published it without thinking about poor people like you who would try to rebuild it. understanding or even better adapting the code would be much better than just using the HEXfile. i know about the insufficency of the implemented operation, especially the setup. sorry for that!

kind regards, die katze

LatvianMan
10.12.2008, 15:27
Wow, now thats what i call good answer !! :) Thanks, man, for all this writing, much appreciated. Still, you are right: now when i read all this, i agree with you, that this project is "a bit" a mess... :)
True, i dont have exactly that kind of remote. I have several universal remotes (well, two, one of them brand Sony), will look maybe there are simlilar to yours in their tables. Thats for a start. If I will be not too lazy and in proper mood, maybe i will dive into programs code :)
In other hand, i start to think that easier will be to program what I need by myself than search endlesly around the Web. I already stumbled to this some time ago when I wanted to make thermometer, with 3-digits 7-segment LED modules output, with common cathodes, and all this with changable alarm temperature. But I think I can manage to programm PWM, but FFT... I doubt.
Still, Big Thank You for your explanation!!!

Best Wishes,

Juris from Lettland.

thewulf00
10.12.2008, 16:12
@Robocat: Du hast meinen vollsten Respekt für Deine fundierte und sprachlich kreative Antwort verdient!

robocat
12.12.2008, 00:36
hello Juris, maybe you are still listening ;)
(1) if you can recompile the code (this should be easy with winAVR/programmers notepad and the included makefile):

the code is no magic. the fft fourier code is based on Elmar Chan´s code and can be used in other projects too. have a look at the code (main.c) and use the ffft.S as a black box for the FFT.

(2) i implemented a button (labeled "guide" on my remote control - code 27) which sets the eeprom values to something useful. it´s not perfect but it will work. if you can recompile, it would be easy to adapt these values and just use the "guide" button to get them set.

(3) i have the ambilight close to the PC and it was easy to read out the EEprom values. you can find them here: http://katze.dead-men.de/upload/88_ambilight.e2p
use ponyprog to write the e2p file and you will have some values to start with.

(4) since i can reprogram the ambilight easily, maybe i can adapt the code for whatever seems needful to you. just ask.


@Robocat: Du hast meinen vollsten Respekt für Deine fundierte und sprachlich kreative Antwort verdient!
danke - ich finde zwar nicht, dass ich da viel respekt verdient habe, aber freue mich trotzdem. das "sprachlich kreative" rührt eher daher, dass mein englisch sehr schlecht geworden ist im lauf der letzten jahre ;)

gruesse von der katz

LatvianMan
12.12.2008, 08:34
Yes, i am still around! :)
Honestly I am not much a programmer, never programmed beyond some kind of BASICs and JAL, but its never late to learn, right?
I believe you referring to this about useful eeprom values:
if(cmd==27) // guide button right?
And thanks for that file, i think i will do some experiments this weekend with all this. I understand, that Your whole idea was remote-centered, and i totally understand that, cause i have a lot things at home "remotized" - computer, lights, even christmas tree :) But, how about idea to make some button control in your device, and then I (and i believe others too) if needed/wanted can remotize buttons with specific schematics and solutions (i use several microcontroller based IR recieving circuits that can learn commands from remotes). I "dream" like this: one button to cycle main modes, one button to cycle item within current mode, and two buttons like "+" and "-". Yes I know, I am a big dreamer :D
Meanwhile, because like i said i was interested mostly in PWM-based Color Organ (Lichtorgel), I found and successfuly tested this:
http://airylight.nm.ru/cm8/shem.htm
http://airylight.nm.ru/cm8/cm8prog.rar
Warning: its all only in russian (wich I understand, ask me to explain if questions about that device), but schematics and code are kinda international I guess :) Just thought maybe anyone would have some interest in that too.

elayne
13.12.2008, 21:39
Hey,
Ich versucht auch grad was in Richtung RC5 - Dekodierung. Ich habe inzwischen duzende Versuche hinter mir und bekomme es einfach nicht hin, selbst mit kopierten Codes aus dem Internet die eigentlich getestet sein sollten. Ich bin jetzt soweit es auf die Fernbedinung zu schieben. Könnte mir einer von euch evt. eine Fernbedinung nennen (möglichst Universalfernbedinung die man bestellen kann) die sicher auf dem RC5 Code sendet?
Ich habe hier diese (http://www.vivanco.de/ic_web/catalogs/vivanco/images/products/EAN4008928/2/1/4008928219661_p01_b.jpg) hier.
Gruß
elayne

robocat
13.12.2008, 22:17
hallo elayne,
http://katze.dead-men.de/upload/87_rc5toCOM.rar
damit habe ich die codes meiner fernbedienung über COM am rechner ausgeben lassen. schaltung ist einfach ein TSOP an PD2 eines atmega8. vielleicht klappt es ja damit?

ansonsten *ratlos guck* meine Hauppauge A415-HPG (wird aber kaum zu bekommen sein ohne die dazugehörige TV-karte) kann definitiv RC5.

ich fürchte fast dafür wäre ein neuer thread besser gewesen, denn hier guckt doch kaum jemand rein, der dir weiterhelfen kann.

edit: dank für den obigen code gebührt peter dannegger! das habe ich mehr gecopypastet als selbst verbrochen ;)

gruesse

@Juris: interesting project! using an OP-amp bandpass filter stage before sampling the audio signal should give much better (accurate) results. i´m sorry i have to tell you that i will not include buttons in the ambilight project. the idea is really good, but i have the whole circuit built into a kind of "hollow stone thing" and couldn´t reach the buttons anyhow. besides i am to lazy to change anything of the hardware. hope you understand. greetings.

LatvianMan
06.02.2009, 15:16
Hello!
Anybody still here? :)
Just wanted to tell that i found (pretty logicaly staightforward) way to make a "clone" of this project that fits my needs. Or more precise: that fits RC5 standart remote(s) i actually have. So, I made "RC5/RC6 codes on a LCD" project from here:
http://www.picbasic.nl/indexes_uk.htm
So I wrote down all codes that all buttons of particular remote is sending.
Then, I edited source code of this RGB project in so called Programmers Notepad (WinAVR), then built HEX file, burned it into ATMega, and - TaDaa! It started to work. :) Sweet!
Guys, believe me its not that hard, well, maybe except that you need to get key codes of remote you have.
Will post later more, this is to be considered as a "First Excitement Message" :D
Good luck you all !

LatvianMan
12.02.2009, 10:19
Hello,
its me again. :)
As i said in previous post, after compiling code with appropriate RC5 codes that my remote is actually sending, all is working as supposed to. So, big Thanks to author!
I have a question to author or/and other Atmel C language pros and Atmega architecture gurus. Would it be possible to modify and port this project code for Atmega168, using all its 6 PWM outputs (for 6-channel color organ mode)? I mean would it possible at all from Atmega hardware limitations point of view maybe. Or maybe it is simpler just use two Atmega8 with common IR reciewer and different frequency bands settings... ? Any comments please? :)
Thank you!

W1cht3lm@nn
16.02.2009, 02:15
Hallo robocat, vielen Dank für dieses schöne Projekt!

Ich habe es vor kurzem nachgebaut (der Einfachheit halber mit einem uln2803 als Leistungstreiber, je 2 Aus- und Eingänge parallel, und ohne Quarz dafür ne Reihe Schraubklemmen), und es befeuert jetzt eine Packung "Dioder"-Lichtleisten von Ikea. Diese Leisten hatten schon einen RGB-Controller in der Zuleitung eingebaut welcher geradezu unterirdisch schlecht ist. Es musste ein Knopf gedrückt und gehalten werden, bis eine dem gewünschten Modus entsprechende Anzahl Piepser erklang. Der fernbedienbare Controller ist da eine echte Innovation, und auch noch so schön günstig.

Das einzige Problem hatte ich mit dem rc5toCOM-Code, da bin ich erst nach längerer Zeit auf den Bolzen gekommen dass ich die main.c aus der rc5toCOM-zip mit den restlichen Dateien des vorhandenen Projekts mischen muss.

Aber nun läuft auch dieses Projekt problemlos und die butterweichen und sehr angenehm langsam einstellbaren Farbübergänge haben mich sehr überzeugt. Als Testaufbau nahm ich nur 3 rote LEDs ;) da war die Überrachung mit den richtigen Leuchten schon stark.

thewulf00
24.02.2009, 11:53
hello Juris, if you are still listening...

Please look in your PN-box. I wrote you sth.

LatvianMan
24.02.2009, 12:59
ThankYou, thewulf! I wrote to you too :)

thewulf00
26.02.2009, 09:02
Hey Juris,

you should not wait for an email from this thread until you answer my PN :-)

LONy-TOOn
04.04.2009, 16:15
hi,
ich hab hier ein TSOP 1736 (also mit 26kHz) würde es damit auch gehn und was muss ich beachten? mein ATMEGA8 wird mit einem 8 MHz quarz betrieben... im "orginal" läuft er ja mit 16 MHz, mal schaun ob ich das im quellcode hin bekomm das alles läuft :-k