Low/High setting on LED

Discussion in 'The Projects Forum' started by swany34, Aug 28, 2013.

  1. swany34

    Thread Starter New Member

    Aug 28, 2013
    7
    0
    I am working on a project in which I need an LED to turn on a low setting when a momentary switch is pressed once. I need the LED to turn on a high setting when the momentary switch is pressed twice in quick succession. The LED should be turned off by pressing the momentary switch again.

    I have seen this in high powered flashlights and am trying to replicate it.

    I believe this requires an IC chip, but I have spent hours online trying to find information on this with no luck.
     
  2. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    Could you live with a 3 position switch, off-low-high?
     
  3. swany34

    Thread Starter New Member

    Aug 28, 2013
    7
    0
    No, if I could I deal with that I wouldn't have spent this much time trying to find the answer.
     
  4. #12

    Expert

    Nov 30, 2010
    16,355
    6,852
    I accidentally bought one of those flashlights that require you to go through all the settings to turn it on or off. I took it back and got a refund.:mad:
     
  5. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    The only way I can think to do this is messy. The dimmed level can be achieved with PWM at a duty cycle of your choosing, and that could even be adjustable if you wanted to change it on the fly. The full level could be ~100% duty cycle or just simply bypass the PWM signal altogether and connect directly to the power supply.

    The 3 states could be accomplished with a counter IC (4017 for instance) set to count to 2 and reset on 3. The pushbutton provides the trigger pulse. Count "1" is dim, "2" is bright, "3" resets to zero, off. But the counter would need to be always on, waiting for a button press. Not so good in a flashlight but maybe OK in your application?

    There's probably a better way to do this but I can't think of it at the moment.
     
  6. swany34

    Thread Starter New Member

    Aug 28, 2013
    7
    0
    Basically what I'm trying to achieve is a circuit that will allow me to do the following:

    *Click* - output 1 closed
    (2 seconds)
    *Click* - all outputs open

    *Click click* - output 2 closed
    (2 seconds)
    *Click* - all outputs open

    *Click click click* - output 3 closed
    (2 seconds)
    *Click* - all outputs open

    The IC will look for the input signals to close the outputs for 2 seconds, after that the input signal will open the outputs.
     
    Last edited: Aug 30, 2013
  7. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Easiest way is a small microcontroller like a PIC. That's how the bicycle lights do it.
     
  8. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    I can't think how you would do that without a microprocessor.
     
  9. swany34

    Thread Starter New Member

    Aug 28, 2013
    7
    0
    Do you know what IC chip would work for this circuit? or know where I could look/ask someone what I need?
     
  10. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    This might help get you started.
     
  11. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Most any micro-controller would do what you want if it was correctly programmed. The μC itself will cost $1.50 or less, but there are peripherals that may be required depending on the answers to some questions.

    Are you willing to go to that trouble?

    What voltage are you working with and what is its source?

    How many LED's, what color, what is the Vf, what is the current draw?
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,858
    767
    This sounds like can be using CD4017 and some diode and NE555 to do the job, but it needs more clearly description.
     
  13. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    I don't think so anymore. Note how he wants the device to count clicks within the window and then move to the chosen state based on the click count. It is not simple toggling thru 3 states like I initially thought.
     
  14. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I counted 9 clicks in his sequence, it might be doable with a 4017 decade counter, where each button "click" moves to the next sequence.

    (4017, 10 states on its 10 output pins)
    0. all off
    1. out1 ON
    2. all off
    3.
    4. out2 ON
    5. all off
    6.
    7.
    8. out3 ON
    9. all off

    That almost satisfies the operation, provided the button is debounced only needs a single 4017 IC.

    Smart people may notice it works even better like this;

    0. all off
    1. out1 ON
    2. all off
    3. out2 ON
    4. all off
    5. out3 ON
    6. (restart)

    So the trick might be to change the operation to the second form, which is very easy to implement.
     
  15. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    But it's not a sequence, its random access, unless he changes his specs.

    Since he needs PWM dimming anyway, a µC would kill 2 birds.

    If we can use the 4017 approach, how would it be configured to choose to use the dimmed signal or the un-dimmed? That's the part I was missing in #5. I assumed it's easy but didn't actually work it out.
     
  16. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,073
    3,856
    OK, I mapped it out to get the first two stages of what the OP wanted if using available ICs (without microcontroller). Adding the last bit of turning off by itself turns into something like below... I suggest a microcontroller.
    [​IMG]
     
    #12 likes this.
  17. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    No I got that, which is why I said "ALMOST satisfies the operation". :)

    There's little to be gained from having that random access, and it's not a good user control because there's no feedback for double or triple button presses until the process is done and something finally lights up. That leaves the user guessing for things like button press timing etc.

    The second way I posted can be done reasonably easy with a 4017, AND mimics many commercial torch products. A bit advantage is that there is visual feedback (an instant visual result) for every user button press. Of course the disadvantage is that it can require up to 5 presses max to get to any state, compared to the max 3 presses of the original spec.

    Well if it's just driving "a LED" he could use 3 different resistor values on the 3 IC pions, for the 3 different LED currents?

    I agree totally that a micro would be smaller and simpler in hardware, and allow much better features and adjusting of features. But I wanted to show he could get very close with a "sequence" driven functionality from just one (non-micro) IC. :)
     
  18. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    Yeah, I like it better when there is a single press to advance through the sequence. My rear bike light has 3 different LED settings. Since I can't see it as I turn it on while riding, I appreciate the fact that I can hit the button 3 times and be certain that it is in the flashing mode I like.
     
  19. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Excellent point re the "press 3 times" to crank up the brightness!

    How about this, still using a 4017;
    0. all off
    1. out1 ON (dim)
    2. out2 ON (medium)
    3. out3 ON (bright)
    (restart)

    That only needs max 3 presses to get to any desired light level, AND gives a visual indication for every single press. I have a headband torch that works like that.
     
  20. wayneh

    Expert

    Sep 9, 2010
    12,156
    3,063
    Makes sense to me. I'm not sure the OP is still here.
     
Loading...