Mood Light
History
This project began when I was surfing the web looking for any cool electronic projects. I found the mood lamp made by Toon Beerten "http://tobe.nimio.info/led_mood_lamp.php". I was really impressed by the 3 watt RGB LED. I bought some of those on ebay and made some tests with an AVR with PWM to control each color intensity. At this point I found those LEDs very interesting and powerful, so then I needed a project.
One week later a crazy idea came to my mind. I would light my entire kitchen with LEDs so I will be able to light it with up to 16 million colors. With software I would also be able automatically make the light change colors randomly but with smooth fading effects. As you know with programming you can make any pattern, with only your imagination as the limit. I made a controller with a LCD, keypad, and 4 slide pots, 3 for manual led color intensity, and the other to control the speed of the color patterns changing. This master module communicates in RS485 to all slave devices, each of which drives 2 LEDs. Each of the slaves has their own address so the master control can address the LEDs individually.
I also made group of LEDs. If you want you can specify different patterns to each group. The communication protocol I used is the standard for the lighting control industry, DMX512. It's a very old and simple protocol. Each slave module is given an 8-bit address (the protocol actually supports up to 512 devices), and each 8-bit byte in the 512-byte data packet is the lighting data for the corresponding module. The start bit is done by a framing error.
Finally I had another idea. With 3 colors I can make a music color organ!!! I worked hard on this because I wanted a color organ that would be independent of the sound level and the sound quality. It must work with Elvis to Pink Floyd or to any others. I built an AGC that outputs the same level from 1mV to 10V. Next, 3 filters give you the low, middle and high frequency bands. The last stage is a rectifier that gives a DC voltage level equal to the level of the frequency. This DC is connected to the A/D of the MCU and all of the comparator triggering is done by the software, that like I said, makes any type of song work perfectly. One very important thing is the powering of all the slaves with their 3W LEDs. Each color sinks 350ma, so you must calculate 1 amp per LED. I have 16 of those so it uses 16 amps!!! At 5V, I had to use a PC power supply that can handle up to 25 amps. At this point the rest is not too difficult, but you must think about the resistance of your conductor. At 16 amps it's very easy to lose 1 volt. I used #8 wire, which is the minimum you can use.
Features
- 1024 3W RGB LEDs can be controlled
- Over 16 million colors can be generated
- Very powerful, can be used as your primary lighting
- Many patterns are pre-programmed
- Can be connected to any audio RCA jack and the system will became a Music color organ!!! (It's crazy)
- Firmware upgradeable via RS232
Pictures
Download
37 Comments to “Mood Light”
Post comment
Please note
Categories
- All projects
- Audio
- Clock
- Electric Train
- Gadjet
- General Posting
- Laser
- Lastes News
- LED
- Library
- Sensor
- Software
- Work Bench Tools

admin

All my source codes were taken from my personal projects.
Your website served as a huge inspiration for me in creating my lighting system with an atmega168 and 3w led's. I am very curious to see what effects your color organ had during music playback, a video would make my week! Thanks for inspiration
- Brian Schimke
Hi Brian,
Thanks for your good comment, I don’t have a video camera so I can’t make a small movie, but I can told you that the color organ with 3Wled is just crazy, Normal light take time to lights up but not led, it’s like if you have xenon flash lamp of 3 color that follow the sound of music. And my color orgran with is AGC is very good, you don’t have anything tune up and it’s work with any song at almost any output level
Sylvain
great post as usual!
Nice information,thanks for sharing,,great pictures to
Very good
Thank you very much for this useful information
I love this it is truly awesome. i saw the vid. i woke up this morning and i just wanted to flash the lights in my room to the beat of some music. now i want to create this. i am wondering how you got your pcbs made, if you have any left over, or can send along the pcb design files let me know.
it would be really great if you could send along the full parts list
Mike
also im used to the arduino language but i learn quickly, what language did you use? (looks like c)
Hi,
Thanks for the comments, There is nothing more available than what is on my blog
Sylvain
awe man share the love
just some quick questions,
i love your schematics, can you explain what the 2 5×2 headers are for ans well as how you connected the main board to serial
please email me
mikehosmar@gmail.com
JP1 is for ISP programming
J1 is connected to the color organ board
thank you,
again i have more questions,
in your description you said you could update the program via rs232 but there is no documentation for the atmel suggesting you can, unless you burned a boot loader, is this the case, or is there something in the code i missed.
and again if you have any sort of file you can send me of your pcb design i would really appreciate it, i want this to be a permanent thing in my basement. so it cant stay on my breadboard. and ive never used eagle before so im not the best at it.
any help is really appreciated
Yes you need a bootloader, check in my megaload section, Everything I give is on my blog I don't give anything else
Sylvain
allright megaload U looks great

one problem trying to compile your code, i dont have <shortnametype.h> and i cant seem to find it if you could email it tyo me i would apreciate it.
Mike
Hi Mike,
Replace the shortnametype by
#define ushort unsigned char
#define uint unsigned int
I think with that you will be Ok, I will make the modification for my next release
Sylvain
By the way mike you need the bootloader that fit with MegaLoad U if you take my old project you need my old Megaload, the U version is not compatible with the old bootloader files
Sylvain
ok, i did that, but it still wont compile,
i getan error like this
MoodLightContDMX.c|637| type error in argument 2 to `csprintf'; found `pointer to char' expected `pointer to __flash char'|
i tried to switch it to a csprint and it doesnt error there anymore
but i get tons and i mean alot of errors like this (in the assembler file)
!E MoodLightContDMX.s(104): branch target too far for relative jump/call
it's a change in iccavr from a version to another, Now you must declare string in flash as static flash char and in the option project setup the option string in flash only
Sylvain
I have had some problems with your boot loader, but i have gotten the code onto the avr via isp, but all it does is show the startup screen and then it has a stack crash, do you knw what this could be?
ive narowed it down to something in the DisplayRGB function im not sure what to do about it tho
i dont know what it is any more,but im still getting stack crashes
ive narroed it down to this line
Led = (LedStruct*) &DMXBuffer[0];
without this line there is no stack crash but it also doesnt do much.
please help, ive spent a few hours learning about structures and i still have no idea why this doesnt work
This was a really informative post, Ive been searching for the last frew pieces for a report. The search is over!
Hi,
This is really cool.
I would like to know, how do you connect between one lamp to another?
Is it every single lamp has their own DMX address or you just loop it together?
Can you send me the circuit on how you daisy chain all these things? As I'm actually searching for this, and i'm stuck with how to connect and program/read the DMX address. Do we need to build one circuit for every RGB LED or how?
Hope that you could help.
My email is: lilzbit at yahoo.com
Regards,
Aminuddin
Hi,
In my project all the led are connecter to is MCU and each led had is own DMX address, so if I have 10 led I have 10 MCU controlling is led and all the MCU are wire with a dmx dasy chain. if you need more info on dmx search the web there is a lot of protocol information.
Good Luck
Sylvain
hello
I will make it for my thesis.
But is it possible that the AT90S8535 nowhere is to find?
DigiKey
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=ATMEGA8515L-8PU-ND
thanks
Do you know where can find the software for the program AT90S8535 and AT90S2313?
- AVRStudio
Hi,
Your project is very interesting. I am unable to find the AT90s8535 & AT90s2313 so i am using ATMEGA8535 & ATtiny2313. So do i need to make any changes to the firmware.
Yes you need to change code and recompile, (I can’t help you for that)
Thanks mate. Just wanted to confirm. Will do it myself.
thanks
bonjour,
Un copié coller de Word vers votre éditeur de texte a dénaturé mon texte, voici le texte original.
désolé.
J'ai réalisé votre Mood Light uniquement l'esclave puisque je souhaite le commander avec l'interface USB to DMX de Enttec, mais j'ai un problème je ne trouve pas sur votre site internet la valeur du Fuse LO et HI à mettre dans l'ATtiny2313, j'ai probablement raté quelque chose. Doit-on aussi utiliser le bootloader pour l'ATtiny2313 ?
Merci
Bien à vous
Francis
Pour le code copy le dans le notepad et recopie le dans le compilateur qui en passent doit absolument etre ICCAVR puis tu doit mettre ton tini2313 en mode at90s2313, pour le reste tout deverais etre Ok
Sylvain
I'm from Holland so i'd really like to know how much all this costs…
Hmmmm the original lamp, 50$, 3led at 10$, CPU, PCB, Driver 30$ something like that