RGB LED mixer circuit - possibly using PWM?

Discussion in 'The Projects Forum' started by garethc, Nov 1, 2011.

  1. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    Background: I am building a ‘busybox’ for my 2-year old nephew as a way for me and my partner to get back into electronics and also to keep his busy fingers busy.

    I have planned and partly built most of the box and now I just need help with the last part, an RGB LED dimmer circuit. We plan to have 3 slide pots (say 100k each), one for each of the Red, Green and Blue LED's. The idea is that each pot will vary the brightness of one LED from 0 to 100% and he can discover colour mixing and have some fun as well.

    I have already purchased the RGB LED's in the form of 3 separate LEDs on a little breakout board from SparkFun http://www.sparkfun.com/products/10111 and it also includes driver transistors (2N3904's).

    I am considering the 555 based PWM circuit by Bill_Marsden but I just need to check a couple of aspects and also ask about linear vs log pots. My feeling is that linear pots are required to make the duty cycle vary linearly from 5-95% as Bill states that ‘LEDs are not linear to current, but this PWM circuit will make them appear so, which is one of the reasons PWM is so popular controlling LEDs’, but I'd appreciate confirmation in my scenario.

    The PWM circuit only gives 5-95% duty cycle, whilst I can live with the 95% limit I would like to be able to turn the LED's off (perceptibly, not absolutely, so if you could see a dim light in darkness that would be acceptable). Another concern is that I'll need three schmitt triggers/555's and so I was wondering if a different chip could be substituted that could service all three LED's in one package, rather than having to use a 556 and a 555. Additionally, the box is going to run off 6xAA batteries (using a SG3525AN to supply the 5v) so I would like to minimise the current consumption and from what I've read the 555's are fairly power hungry compared to more modern devices.

    I'm wondering if perhaps I've missed another type of circuit that would be more suitable? I believe that all I need some sort of variable current driver to vary the brightness, so I was wondering if a simpler transistor-based circuit would work? Or perhaps there is a fancy IC that’s designed for exactly this sort of circuit? BTW I am aware I could use a micro controller for this, and I do want to start using micro controllers fairly soon but not for this project.

    Cost isn't a particular issue for this one-off project but complexity is, as I am planning to construct the circuit 'dead-bug' style, so low component count is important.

    Any advice gratefully received and thanks to the forum members who have posted all these fantastic circuits and advice over the years, apologies if my searches have missed somewhere that this or an equivalent question has already been answered.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I notice on the SparkFun page that the LEDs are "painfully bright" when on.

    Perhaps you don't know this, but staring directly at super-bright LEDs for a long period of time will basically "burn holes" in your retinas, permanently damaging your vision, rather like staring at the sun - however, with LEDs, there is no pain associated with the damage.

    Super-bright LEDs like these have the beam narrowly focused so that the manufacturer can claim higher peak intensities. However, a 2-year-old will figure out where the light is the brightest, crank it all the way up, and stare at it for a long time.

    I cannot advise you as far as how bright the LEDs will actually be, and what level of light would be absolutely safe - as I'm not an eye doctor (nor any other kind of Dr. for that matter).

    However, it would improve the safety of the lighting a great deal if it were enclosed in a translucent housing that was "two-year-old-proofed". Youngsters can be particularly brutal on toys, smashing them repeatedly against the floor, smashing them with other toys, etc... so designing such an enclosure would be challenging, to say the least.

    There are other problems, such as the potential to have a choke hazard, and "sharp object" hazard.

    If the slide pots have knobs, the knobs may come off. The first thing a two-year-old will do is put the small part in their mouth. If they can get at the small parts on the circuit board, they will break them off and eat them.

    If the sliding pots do not have knobs, the levers for the pots are frequently stamped sheet metal, and the edges are sharp indeed. If the youngster should happen to fall on the controls, they could easily puncture their skin.

    I may sound like a real "wet blanket", but I have to put "safety first". I am afraid that this project would result in a toy that is potentially quite hazardous for the child.

    I suggest that you re-consider the project.
     
  3. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    Many thanks for considering my project, and yes, as a father myself I'm all too aware of the dangers that the little darlings can experience.

    I considered the general 'bashability' of this project compared to the plastic toys available in the shops, and convinced myself that there was no feasible way to make anything remotely as tough as that. So I have already resigned myself to requiring adult supervision whilst he was using the box.

    I am also planning on epoxying the pot knobs as well as a couple of other switch knobs onto the shafts for exactly the reasons you gave. It will make any repairs nightmarish but that's better than a stint in A&E.

    I have already sanded the LED's to increase their dispersal, and also am planning to use the semi-translucent top of a deodorant roller on top of the LED's as well. Apart from any brightness concerns this will help mix the separate LED's into a single colour dome.

    Perhaps even despite these precautions it might be wise to investigate a circuit that only covers duty cycles up to 50%, or perhaps adding a trim pot internally so I can set the maximum brightness?

    Thanks again, and I hope you are re-assured that I won't end up making a baby blinding & chocking machine!

    Edit 1st post - Instead of SG3525AN for the 5v supply I should have said R-785.0-0.5
     
    Last edited: Nov 1, 2011
  4. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    I've had similar ideas with some of my diagrams. The From 4 Twenty seems like it would be good for a munchkin. Using variable pots with the LEDs could create some odd effects.

    Wookie is right, there is real danger in modern LEDs. Throttle them way back current wise. It will also have the benefit of allowing the batteries last longer.

    If you have any ideas you would like turned into schematics feel free to ask. I'm an adult (supposedly), and I still like da blinky lights.

    You can also make a really simple keyboard and sound organ with 555's if you like.

    http://www.bgmicro.com/14incherwith18incherredpusher100900.aspx
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I'm glad you have considered the safety aspects. Sounds like you have a reasonable plan.

    I drew the attached schematic for someone a year ago; it will provide 0%-100% PWM for three channels using a single quad comparator.

    IC1d is the oscillator/triangle wave generator that runs at ~210Hz.

    VR1 through VR3 set the reference levels for where the other three comparators trip.

    I've only shown how VR1 connects for simplicity.
     
  6. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    OK, so here are the spec sheets http://www.sparkfun.com/datasheets/Components/LED/Blue-10mm.pdf http://www.sparkfun.com/datasheets/Components/LED/Red-10mm.pdf http://www.sparkfun.com/datasheets/Components/LED/Green-10mm.pdf

    and they give between 8000 and 20000 MCD at 80mA, but no idea what intensity they give at lower currents. I guess that perhaps reducing the duty cycle alone might not help, since you would still get the full intensity, just for a shorter time.

    I'll replace the supplied resistors (schematic here: http://www.sparkfun.com/datasheets/Kits/Tri-color LED Breakout-v12.pdf) with higher values to reduce the intensity; and given that the calculations to go from the output of the LEDs into MPE (maximum permitted exposure) are beyond me, I'll just adjust them down until they seem perfectly safe.

    Thanks Bill_Marsden for your reply but I'm confused by your reference to From 4 Twenty.

    I think I've convinced myself that I need to use linear pots.

    SgtWookie - pure gold! Can't believe it! looks almost exactly what I need, but I wonder if I can omit some or all of R4-9 because I plan on driving the transistors, not the LEDs directly? I am guessing that the transistors present a high input impedance so we don't have to worry about overloading the outputs of the LM339N? Also I can't quite understand how the IC1D oscillator output goes anywhere, sorry if that's dense. Also very minor point, I am assuming that the reference to IC2D on the diagram text is a typo.
     
    Last edited: Nov 1, 2011
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You can't omit R4-R6, as the LM339 has open-collector outputs. This means that the outputs can sink current, but they cannot source it. Without R4-R6 providing a source of current, the outputs would remain at ~0v.

    You could eliminate R7-R9 though.

    The output of IC1D is only used to set the reference level on pin 11 (in conjunction with R12 & R13), and to control when C3 is charging or discharging via R1. IC1D's only function is to provide a triangle wave that goes from approximately 1/3 Vcc to 2/3 Vcc. It is this triangle wave that causes the individual comparators' outputs to turn on and off depending on the positions of the VRx's.

    Note that if you increase the value of R2, the maximum PWM % will be decreased.

    Yes, the IC2D is a typo.
     
  8. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    Many thanks SgtWookie, I think I understand how IC1D oscillates now, and I suppose that the output goes through R1 to control the inverting inputs of the rest of the comparators.

    I didn't appreciate the open-collector nature of the LM339, that makes sense now, and I'm glad that I can reduce the components by three at least.

    Do you (or anyone else) have a view about whether I should reduce the current as well as the duty cycle? I suspect that eye damage is related to intensity times exposure, so therefore reducing either would reduces the damage. Does anyone feel (or know) differently?

    Can I use a trimmer pot for R2? say a 270K? Is it the case that the duty cycle is the ratio of R2 to R3, so then I can adjust it to give a duty cycle of as low as 10% if that is needed to safely limit the brightness?
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I can't tell you for certain on what level of light would be dangerous, as I have no formal training in that area.

    However, reducing the maximum current allowed would reduce the maximum possible brightness. You would need to increase the value of the resistors that are in series with the LEDs. The LEDs will not get much current from the 3.3k pull-up resistors R4-R6.

    270k is not a standard value. 100k is a standard value; you could use that.
    If R2 were roughly 66k, it would limit the maximum possible PWM to around 50% duty cycle.

    It will be easier to simply increase the current limiting resistors for the LEDs.
     
  10. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    http://forum.allaboutcircuits.com/blog.php?bt=681

    Figure 8.1

    If you make R1-4 variable (but be sure to have a minimum resistance) where the tyke can vary speeds all over the board it should be interesting. You will get a lot of different effects too, such as beat patterns and what not.
     
  11. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    that's a great idea, and now I understand your from 4 twenty reference, clever!

    I'll try making the circuit with a 100k pot for R2, and also see what happens when I vary R3.

    Many thanks to you both, and if anyone else has any suggestions then please chip in. I'll post back in a week or so once the components arrive and the circuit is made.
     
  12. sheldons

    Active Member

    Oct 26, 2011
    616
    101
    try this to fade your leds.......
     
  13. garethc

    Thread Starter New Member

    Nov 1, 2011
    6
    0
    Thanks for the circuit suggestion sheldons but I'm afraid my limited knowledge means I can't quite understand how it works.

    I think I can see the 555 is used to generate a clock signal, varied by VR1, which is passed to the 4029. From some quick research this IC is a counter chip and in this configuration counts up in BCD and the outputs Q1-3 trigger the LED's via the driving transistors Q1-3.

    How would this circuit (with only 1 pot) satisfy my design requirements of having three independent controls, one for the brightness of each LED?

    Even if this suggestion turns out not to be suitable for my immediate needs I would find it instructive to understand the way it works.

    And if it does answer my needs then it's obvious that I really don't understand this circuit at all and therefore I can learn even more!

    Many thanks
     
Loading...