Connect with us

LED Push Button Dimmer

Discussion in 'LEDs and Optoelectronics' started by Angus, Jul 6, 2014.

Scroll to continue with content
  1. Angus

    Angus

    29
    0
    Jul 4, 2014
    Hello,

    I am trying to arrive at a circuit design that dims an LED string with each push of a button. The LED's string is about 1m long and powered by 12V (from the mains).

    One idea was to use a 555 timer to set the frequency for the LED's (as in Pulse Wave Modulation) - and using a 4017 counter chip - a different output pin would be selected (which would have a slightly different resistor - and so change the output frequency of the 555) - and the LED string would go dimmer with each button push.

    Or another chip that maybe able to be used is the LM3404.

    So - my questions are:

    1. Would the 4017/ 555 idea work - comments?
    2. Would the LM3404 work? If so what would the cicuit be? Also - would it be better than the 4017/555 idea?
    3. Does anyone have a circuit schematic for an LED dimmer, push button, powered by 12V

    Any help/ comments appreciated.

    Thanks - Angus
     
  2. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    Simplest way is to use a microcontroller.

    Bob
     
  3. Anon_LG

    Anon_LG

    453
    117
    Jun 24, 2014
    Yes I think the decade counter/ 555 timer idea would work, I could maybe draw a diagram out, however I am currently working on another circuit. As for the microcontroller I do not know, I have not used these yet.
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Yes, the 4017/555 idea should work for generating a PWM (pulse width modulation, not pulse wave modulation) signal. But not very well!

    The LM3404 would not replace the PWM generator; it has a different function. It would connect between the PWM signal and the LED string. But you say your LED string is powered from 12V so there is no need for the LM3404. Nice chip though.

    Your LED strip probably draws quite a bit of current at 12V. The 555 can only sink and source 200 mA maximum; you'll probably need an external transistor or MOSFET to boost that current. How much current does your LED strip draw?

    Are you concerned about interference? Connecting a PWM signal to an antenna like that could cause some. Small inductors in series with the wires to the LED strip would help.

    The 4017/555 circuit is not really ideal for generating PWM, because the frequency will vary, as well as the duty cycle. This is because of how the 555 oscillator works - the resistor between pin 7 and pins 6 and 2 (called "R2" in most data sheets) determines the duration of the low ouput pulse (this doesn't necessarily correspond to LEDs OFF though; you can invert the output) and the sum of the two resistors determines the output high pulse width. There are ways to make the two periods independent, but no clean way to make the total cycle time constant.

    This means that the frequency at the minimum duty cycle and the frequency at the maximum duty cycle will be quite different. The lowest frequency has to be high enough to avoid visible flicker; this means the highest frequency will be unnecessarily high and switching losses could start to become significant. Also, the actual duty cycle range is slightly limited at the extremes.

    The proper way to do PWM is to use an oscillator running at a fixed frequency with a triangle or sawtooth wave output, and feed the triangle or sawtooth into a comparator whose other input determines the duty cycle. You can actually generate a triangle or sawtooth with a 555, with some external components - see http://www.all-electric.com/schematic/eticircuits/555-triangle-with-independent-slopes.htm - but the pin 2/6 waveform in a standard 555 oscillator should be close enough.

    This might be a good opportunity for you to get into microcontroller programming though. As Bob says, it's the simplest and best way, by far, to generate the PWM signal. You'll still need a buffer of some kind, but compared to a discrete solution, you gain a huge amount of accuracy and versatility.
     
  5. dpk

    dpk

    2
    0
    Jul 6, 2014
    how exactly can you select the required output resistance using 4017 alone?? it will give you only digital output only..i think the one you were trying to use is a multiplexer...
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    You can do it using diodes between the 4017 outputs and the resistors. The 4017 outputs that are low will reverse-bias their diodes and will have no effect. Only the output that's high will source current through its diode, into the resistor, and into the 555.
     
  7. Angus

    Angus

    29
    0
    Jul 4, 2014
     
  8. Angus

    Angus

    29
    0
    Jul 4, 2014
    Thanks very much for the replies - very helpful.

    If I were to use the circuit attached - using the variable resistor split over PIN#7 - that splits its resistance proportionally between the charging and discharging cycles of the capacitor - it keeps the frequency roughly the same throughout - for about 8-95% of the pulse width range.

    So - if I were to use a 4017 - push a button - and it chooses a different resistance for R1 and R2 each time - can this be done? I've tried drawing the outputs of the 4017 to give different R1 and R2 values that feed into the 555 - with different combinations of diodes etc - and I cannot arrive at a solution that is OK.

    Also - if I were to go down the oscillator path - do you have a simple circuit you suggest.

    Once I have this design down pat - I will make 100 or so of these circuit boards.

    Thanks again.

    Angus
     

    Attached Files:

  9. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    In that case, you would save a lot of money by using a microcontroller. The entire circuit would be the micro (about $.50), the switch, one transistor, one resistor, and one capacitor. Smaller board area and less component cost. And far more flexible. Simple changes in programming could alter the behavior in ways only limited by imagination.

    Bob
     
  10. Angus

    Angus

    29
    0
    Jul 4, 2014
    Really - $0.50 - I had no idea - I will look into the microcontrollers more in depth then. Do you have one you would suggest - I've read about the BASIC stamp. Thanks Angus.
     
  11. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    The Microchiop PIC10F320 could easily do what you want and costs 42 cents qty 100. It comes in a SOT23 package, which is about as small as you could want. Or, if you don't want to deal with surface mount you can get it in a DIP-8 for 50 cents.

    There are even cheaper ones that would also work, but the programming would be more difficult, because they do not have a PWM peripheral. The PIC10f200 would be the cheapest at 35 cents qty 100.

    Edited: As far as I am concerned, the days of discrete logic are long gone.

    Bob
     
    KrisBlueNZ likes this.
  12. Anon_LG

    Anon_LG

    453
    117
    Jun 24, 2014
    NOOOO!!! *crying*
    You made my avatar scared
     
  13. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    Do not fear. We still need discrete transistors when currents of > 20mA are required. Until they come out with a uC with power MOSFET outputs...

    Bob
     
  14. Anon_LG

    Anon_LG

    453
    117
    Jun 24, 2014
    *SCREAMS*
     
  15. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    Sounds to me like you are bipolar. Perhaps some Lithium would help.

    Bob
     
    KrisBlueNZ and Arouse1973 like this.
  16. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    Made this little circuit for a bit of fun. I wanted it to look like a "chicken" but it didn't turn out that way :)

    The circuit is based around a Schmitt oscillator with a charge pump. The charge pump increases the charging voltage which has the effect of linearizing the ramp within the switching window of the Schmitt trigger. P1 sets the maximum duty cycle if desired and P2 adjust the pulse width. But you could do it the other way round if you wanted and set P2 to maximum and adjust the PWM with P1. So you could use your 4017 to switch in different resistors with say a few transistors. I haven't tried this but I can't see why it shouldn't work.

    Ramp.JPG
    Fig 1 Schematic Diagram

    CIMG8945.JPG
    Fig 2 Not so bright.

    CIMG8946.JPG
    Fig 3 A bit brighter

    CIMG8947.JPG
    Fig 4 Even brighter
    Sorry I didn't have a micro handy :)
    Adam
     
  17. Angus

    Angus

    29
    0
    Jul 4, 2014
    Thanks very much for that............maybe a silly question - but what would the transistor switching set-up look like when energised from each of the outputs of the 4017? Angus
     
  18. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    I'm with Bob on this one. If you're making 100 of them, you'd be crazy to do it with discrete circuitry. Unless you specifically want to make a "retro" product!

    Any microcontroller that runs at more than a few hundred kHz can do this. It doesn't need a PWM peripheral; it doesn't even really need a timer! Your requirements are very loose.
     
  19. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    Maybe something like this. Have a look at the data sheet and see if you can work out the rest of the connections.
    Adam
    4017.JPG
     
  20. Angus

    Angus

    29
    0
    Jul 4, 2014
    OK - thanks

    Where to start with micro-controllers? I know zero about micro-controllers?

    As recommended above the PIC10F320 would suit this PWM.

    I have dug around the net and this website - but a simple point to start and get a feel for micro-controllers would be great.

    Angus
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-