Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RGB LED controller/dimmer

Status
Not open for further replies.

sigedal

New Member
I´m a guy from Sweden right now designing my new bathroom. I have a LED-problem I would like to solve, and I´ll try to explain it as clear as possible. I would like to use RGB-LEDs instead of spotlights for lighting, but I don´t really now how to control them. This is what I want:

Two touch dimmers. When you touch the first one, the room lights up in bright white, and you can dim the white light by touching, just as an ordinary touch dimmer. When you touch the second dimmer, you activate the colour channels. You can change colours by keep touching this second dimmer, and when you stop, the colour freezes, and stays that way till you touch it again. You can also dim the intensity of the whole thing by using the first touch dimmer now. When you shut the second dimmer off, the lights go back to bright white.

Is this possible to build? What do I need to do it? I would be ever-thankful for your replies! Thank you!
 
Hey there,

Cool idea, gotta love RGB led's :D

I'm sure it is possible, I'm not sure what level of knowledge you have for electronics, I can think of of several ways, varying in complexity and cost.

First, the best way to control the brightness of an led (each individual LED in RGB led's...ie: the colour) would be to use PWM (Pulse width modulation). There is a wealth of info on google about this. Now, for 3 PWM channels for R,G and B, you can control the colour of the LED. However, for the 'brightness' of the whole RGB without changing its colour, that would mean you'd have to change each channel proportionally...which many seem to think is an easy task, it isn't. Because as you reduce the values of all 3 PWM, you must do it by a percentage, otherwise the colour would change slightly as you dim, so your 'white' LED would change to an off-white colour when its dimmed.

Anyway, back to your solution. If you break it down into parts and design each part idividually, you could concentrate on one bit at a time.

LED array (parallel? series?),
LED driver - MOSFETS/Transistors,
PWM generator (for colour/brightness),
Intelligence (for a colour sequence), micro OR logic OR analogue.
and your 'touch plates', which would probably require a small analogue circuit.

Now, as I said a microcontroller can generate the 3 PWM channels for R,G and B...depending on the resolution, that means you'll have 3 bytes, each byte value gives the brightness of each LED. That said, I recently prototyped an alternative way of generating PWM, using a sawtooth generator and comparators, which converts a fixed voltage to a PWM duty cycle. Basically, for each channel 0V is 'off', 1v is 20% and 5v is 100%. Its a nice cheap solution, and means theoretically, you could build this without using a microcontroller. As for 'going through colours' it gets a bit complicated doing that without some form of inteliigence (your micro), but it CAN be done using a 3-phase AC generator running at a really low frequency its just not practical.

I mentioned 'dimming' of all 3 led's (keeping the same colour, but changing the brightness of the whole LED). The way I did this was using a second PWM channel at the cathode of all 3 led's, running at a much higher frequency than the PWM's for 'colour' (2-5Khz). I will explain with diagrams if you wish, I've never been good at explaining things.

I know this is a long post, but its an interesting project, and I'm currently messing with RGB led's, trying to find good solutions to controlling them in the cheapest/easiest possible way. And as always, when I read your post, I got loads of idea's that I couldn't possible post them all. Please tell us if you have experience (and equipment/software) for microcontrollers, I do'nt want to patronise you by telling you things you already know. If the propect of learning micro's, assembly language/C and buying a programmer doesn't appeal (or if time is limited) there are certainly other ways to achieve what you want, it just involves a bigger circuit.

Good luck, look forward to hearing more :D

Blueteeth
 
Hey Blueteeth!

Thank you very much for your reply! I can't say I'm familiar with microprocessors, I have only worked with more simple electrical installations. However, I would really like to achieve this, and I'm ready to learn! Let me describe it a little more in detail:

The leds would be installed in the ceiling, like small spotlights. Maybe I would need a hundred of them to achieve good lighting? Then there are the two touch dimmers. I have plenty of room above the ceiling (which will be lowered anyway) for circuits, so room wouldn't be a problem. However, of course, I look for the most simple and cheap solution. Do you have any idea which price-range we are talking for the whole thing?

As I said, I have little knowledge about microprocessors, and maybe it's not worth the investment in time and money for just this project. But again, I'm ready to learn this if it would be worth it! If it however is possible to construct a more uncomplicated, maybe bigger device, I would be glad to hear about it. I think the total price will decide for me.

What do you think? Is it worth learning about microprocessors?
Thank you very much once again for your informative answer, now I know its possible without consulting a lighting firm, but I have things to learn!
 
For a bathroom, you need to make sure the leds are not exposed to moisture - the leads can corrode and eventually fail.
You could have a look at fitting them into sealed shower spotlight fittings.
The touch switch would also need careful design to be reliable and safe even if it only uses a low voltage. (even then it may not meet bathroom safety regulations.)

It would be cheaper to combine individual colour leds - but this may not provide very pure colours in a spotlight.
I found a few sites that show lighting examples.
**broken link removed**
**broken link removed**
http://tobe.nimio.info/rgb_mood_light.php

I am also trying to make a simple rgb light using three leds and so far, I get the most even colour by combining the beams down onto a white reflector.
Also experimenting with various ideas for a simple,compact diffuser.

I haven't even started on the programming for it yet!
 
Blueteeth said:
I mentioned 'dimming' of all 3 led's (keeping the same colour, but changing the brightness of the whole LED). The way I did this was using a second PWM channel at the cathode of all 3 led's, running at a much higher frequency than the PWM's for 'colour' (2-5Khz).

Would it be possible to use a simple variable current source on the cathode to vary the brightness of the array, or would it be affected by each PWM input?




Verry Interesting project by the way sigedal !!
 
Thank you guys for your interest in this project! The spotlight idea is interesting, but I would prefer the look of many small light dots all over the ceiling. And the moisture is of course a problem, getting it all approved by the insurance company...

We'll see. Right now I'm looking for the most simple and cheap idea, then I have to learn the technology and put it all together.

I have another cool project for the bathrrom mirror, which is not that complicated. I need a two-way mirror or what you call it, you know some kind of surveillance mirror. Then i place white leds on the backside, really tight and isolated, so the white light passes through. Then you will see like white dots around your reflection in the mirror on the other side, which lights up your face. Just an idea, however. The real challenge will still be the rgb-ceiling.

Thanks for your support
 
Hi,

About the 'physical/optical' part... Thre RGB's I have (5mm, 4 pin) have quite a narrow emmission angle...around 20 degree. so they are pretty much spot lights..also, because it uses the lens of the LED package to determine the angle, it sends the three colours in different directions...ergo..it doesn't mix well at all. You could always just add a diffuser...about 3 inches from the LED's, that frosted acrylic works a treat.

Also..edge lighting a frosted acrylic panel looks beautiful! Although its really just a pretty display rather than actual 'lighting', but hey, what can I say, it brightens up my room :D That can be done by gluing LED's into the plastic.

There are also SMT rgb led's. The ones I use have 6 pins, giving you access to each LED's anode and cathode, 120 degree angle, and are BRIGHT. They aren't Luxeons, they're fairly cheap in large quantaties and mix the colours very well indeed (because of the flat lens).

I'm sorry to say I wouldn't have a clue about 'corrosion' of LED's, wise words from picasm though, copied/pasted into notepad :D thanks man.

Synapse:
In answer to your question, yes, yes it would. Its another simple way of doing it, providing you can regulate current, then I see no reason why it won't be just as good as using a modulating PWM. I wouldn't know how to make a programmable current source :( In fact, I believe this is how those RGB driver IC's work in new cell phones, I only chose a second PWM because I thought, well, we're using 3 already, why not add another. I can't see the PWM affecting it, unless the current sources 'reaction time' wasn't good enough to cope with the sudden rush of current when all LED's suddenly go on...using a smoothing cap would just shunt the PWM signal to ground...I'll look into it.

sigedal:
I know starting micro's is daunting, and can take a while, getting the compiler/software..programmer...playing about etc.. I think you should do it, it opens up a new world of possibilities (theres a reason why these things have such a big following). But as you quite rightly said,

'maybe it's not worth the investment in time and money for just this project.'

For one project, I'm not sure if it really justifies putting the time into starting micro's. If you/I can't come up with an alternative, then worst case scenario, I'll write up a little test program and compile it for a processor, then you'll just have to knock up a little programmer. Can't promise anything though, my software is a bit iffy.

That said, I'm sure there is an alternative...the only part that has me stumped still is the 'touch dimmers' functions. Making them increase/descrease brightness...(or colour for the second one) wouldn't be difficult...(logic counters, clocks) .but making the light turn ON/OFF just by single touch confuses me. I'm probably over complicating it though.

Sorry for such a long post, but this is a great project, and its good to follow these things, incase I decide to build one meself :D plus...its nice to see someone explain their idea/problem concisely and accurately, I knew pretty much exactly what you wanted from your first post..tis rare.

Blueteeth.
 
Well its prety much posible to do it whith logic gates. The binary up/down counter ICs should work good.What you bacily do is have a oscilator make the clock so it incseses the counter IC.Then you need a AND gate to detect when the counter reaches max.Then have it switch a flip flop to make it count down and do the same thing at the bottom.This should generate a nice ramp up and down wich you can then use to drive a resistor network to get analog and then drive a PWM controler IC or a voltage regulator.

To make themy mix difrent colors you just divide the clocks freqecny down for the next driver.To make it apera more random you can also have 3 oscilators runing at sligtly difrent freqencys.

If you cant a nice bright lighting use the 5W Luxeon LEDs they are very powerful and they seam to recently droped there price.

As for estetics i would use those fixtures for halogen lamps and modefy them to stick a LED in.
 
Blueteeth:

Thank you for your continued support, i don't know how I would have made it without this help! I like design and good-looking solutions in the first place, but now I'm getting more interested in the inside and the technology behind.

I can imagine the world that opens up if you learn micro, and maybe it would be worth a try. It could be good to know some about it, so i know what to ask for and can understand a little more about the descriptions. How much time are we talking and where to start? How much would it cost for the equipment needed? Maybe I just should read a little about it, and leave the rest to people who knows a bit more.

So you really help me out here, finally I know this ceiling will be a reality! Great. About the touch dimmer. I have an ordinary touch dimmer in my kitchen, which you shut off by touching it fast. So the point was that I would like them to shut the power off or on when you touch them fast, and dim through the brightness/colour when you keep touching them.

How will the circuit look like with a microprocessor? Will the dimmer control the microprocessor, which does PWM. I'm thinking of how I will prepare, my walls are going down soon! But rather make it good than make it fast, so I am most thankful and curious of your new solutions and ideas!

When I get started I will create a blog where you can see the progress!

Thank you!
 
Well this thing can be prety diretcly done by a micro.So you need 3 pins of the micro outputing PWM that drives a mosfet transistor that then drives the LEDs.Then you need 1 toch switch circuit that will spit out a 0 or 1 depeding when its toched and then you just need a powersuply and a 5V regulator chip to run the "brains".

This makes the hardware part easyer but now you have a software part to do.This is probobly gona be the hardest part of it.Cause most MCUs only have 1 hardware PWM.So you will need to use the CPU to generate the PWM signal.wich may get complicated when you are generating more then 1 PWM.

If you realy want a cool efect you could make grups of LEDs have a difernt PWM.So you can imulatinate each corner of the batchroom ina difrent color.This will take then even more PWM chanels.
 
Learning about uC is quite useful. I managed to understand&modify pograms made for them in a couple of months. I don't have a electrical/computer science background at all (chem eng) and not a lot of spare time.
I know isn't ex what are u looking for, but is a start:
**broken link removed**
Here is the programer I used:
**broken link removed**
 
picasm said:
For a bathroom, you need to make sure the leds are not exposed to moisture - the leads can corrode and eventually fail.
You could have a look at fitting them into sealed shower spotlight fittings.
The touch switch would also need careful design to be reliable and safe even if it only uses a low voltage. (even then it may not meet bathroom safety regulations.)

It would be cheaper to combine individual colour leds - but this may not provide very pure colours in a spotlight.
I found a few sites that show lighting examples.
**broken link removed**
**broken link removed**
http://tobe.nimio.info/rgb_mood_light.php

I am also trying to make a simple rgb light using three leds and so far, I get the most even colour by combining the beams down onto a white reflector.
Also experimenting with various ideas for a simple,compact diffuser.

I haven't even started on the programming for it yet!
This link is useful for a mood lamp:
**broken link removed**
U got the source&HEX and it uses a small (and cheap) beast like 12F683;)
 
Last edited:
Hi again,

Making a microcontroller generate 3 or more channels or PWM, as far as I'm concerned, is the easy part. We need TWO touch switches/plates, one for ON/OF/intensity and one for White/Colour cycle. Thinking about it, getting the micro to distinquish from a 'touch' and a 'hold' would be straight forward using the micro's timer.
I've been tihnking about it, and for a true 'one-chip' soluiton, I think the difficult part now would be controlling the brightness. Of course, adding a small external circuit for this shouldn't be too difficult, as the 'brightness' part, would be a single channel PWM, almost identical to the ones available on the market today, with the exception that it should run at a higher frequency than the 'colour' PWM.

In a few tests, I *could* see some flickering at frequencies below 300Hz, but only when I turned my head/eyes quickly. I don't know how some websites
suggest 'anything below 200'. But an MCU could do PWM up into the high Khz.

Now, all the above is assuming we go down the MCU route, which, as has been discussed, isn't always preferable. As for the 'non MCU' design, I believe the 'brightness' control would be exactly the same as above, we just have to worry about generating PWM for each LED die, AND cycling through colours.
A digital 'counter and compare' would require quite a few IC's, but all would be pretty damn cheap since they'd just be logic CMOS/TTL, 3 IC's per PWM (for 8-bit, 6 IC's for 8+ bits resolution). Thats 9 IC's already.

And then theres the colour cycle to think about....the obvious way would be (using the above 'logic method') to have each 8-bit PWM for each LED's start at zero....and then increment all 8-bit numbers as if it was one large 24-bit number. This is impractical...as it would include all the 'brightness levels' (0,0,0 would be a number, which is 'off' and 0,12,40 would be a faint blue), and also, the user would have to stand there for hours whilst is cycles through every available colour. Thinking about it, 32 levels of PWM (5-bit resolution) or even 16 levels (4-bit) would still provide many useful colours, again, because we have a seperate brightness control....every colour we use should have one of the LED's at its maximum (if you need a better explaination of this, I'll try). 10 bit+ in my opinion, would be over kill, this is lighting, not a high res LED TV.

I did say I'd draw up a schem at some point, but ...work as always, still, theres the weekend. I think I could cover the 'brightness dimmer touch switch', the 'LED power driver', as for the colour sequences, I have a couple of idea's, but it looks like using a micro for that part would be the quickest, simplest, and cheapest route (NOT including time/money to learn micro's!!).

The link 'Tarsil' provided was very useful indeed. the code will need slight modification, to add the 'touch switch/dimmer' for colour (and use up a timer for that matter) but it sohuldn't be too difficult. I will write up my own code based on a different PWM algorithm at some point, and test it. If it'll work for one RGB led, it'll work for thousands :D

sigedal,
I realise you wanted to design this yourself, but I am starting to think adding a MCU would be alot easier. It would only have to be a small 8-pin thing, I am more than willing (as are many others here :D ) to help you with the code, and it will just control the colour sequence, when the 'colour touch plate' is held. The dimmer part would be seperate.

I've also got a few idea's for mounting. And then theres diffusion...and how to 'drive' the LED's (series/parallel?). But, I really >DONT< want to seem like i'm taking over. Its just I spent a while messing with these great LED's a while back, but I never got the chance to share my idea's/circuits. If it seems like I'm 'going too far' just say lol:D

Blueteeth.
 
BTW...why not using 3 leds of diferent colors (R,G,B) with a diffusion net (some scratched....err...engraved:D glass). Those LEDs are cheaper, more reliable (so u can buy the "made in China " types:D ) and punch a lot of power (50-75mA drawn in pulses by a 10mm). The Luxeon and esp Lamina LEDs (are a bit flater) are a solution if are driven in pulses.
I realy like this touch switch: https://www.aaroncake.net/circuits/touch.htm
 
This is a resistive type.Its the most reliable but also clumsy.Cause to thurn it on you gota toch bouth at the same time.Better solution is a capacitive one.

Well id recomend Luxeon LEDs.Since you aculy want to iluminate the bathroom.You will need a lot of 5mm LEDs to get it to a respectable brighthes.LEDs never burn out so you dont have to pln on cost for replacements.
 
Someone Electro said:
This is a resistive type.Its the most reliable but also clumsy.Cause to thurn it on you gota toch bouth at the same time.Better solution is a capacitive one.

Well id recomend Luxeon LEDs.Since you aculy want to iluminate the bathroom.You will need a lot of 5mm LEDs to get it to a respectable brighthes.LEDs never burn out so you dont have to pln on cost for replacements.
Isn't the best switch...but is so simple to make and I used it with no problem. About Luxeon's ...OK are v bright but have some problems with heat even when are pulse driven. I was thinking about 10mm Leds (maybe a bit hard to find the coloured ones).
http://www.discovercircuits.com/DJ-Circuits/5vtchremom2.htm
http://www.discovercircuits.com/DJ-Circuits/dooralm2.htm
http://www.discovercircuits.com/DJ-Circuits/5vmom1.htm
 
Any high power LED needs a heatsink.It dosetn just apply for Luxeons.You need painfuly a lot of normal high brighnes LEDs to get a room iluminated properly like a normal lightbulb would.So to get the same brighnes it might end up even more expensive then geting a Luxeon.
 
I'm driving 10mm white leds at 4KHz/50mA and a duty cicle of 40% whitout problems about heating (just a bit warm). I'm not against the Luxeons, just pointing some other ideas.
 
Yes but compare the light output of a luxeon and a 10mm.Luxeons are very eficent LEDs but becuse they are driven at such high powers to produce so much light there is also a lot more heat.
 
Someone Electro said:
Yes but compare the light output of a luxeon and a 10mm.Luxeons are very eficent LEDs but becuse they are driven at such high powers to produce so much light there is also a lot more heat.
You're right but I was thinking/talking about using several 10mm Leds together. Those will require less cooling riging then just one luxeon ( smaller heat/volume ratio)..actualy ..none. It's just an idea. Try driving a luxeon at MAX current with >40% duty cicle whitout heat sinking (maybe i got a faulty one:confused: ). I'd realy be interested in the result.
U can drive some 10mm LEDs at 55mA/4.2V with 50-60% duty cicle whitout burning them for...whatever (just a bit warm). Put like 4-5 together.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top