Breathing LED

Discussion in 'The Projects Forum' started by captainlol, Jul 7, 2014.

  1. captainlol

    Thread Starter New Member

    Jan 13, 2014
    3
    0
    Hi, I am trying to make a project that involves an LED "breathing", something similar to this: http://thecustomgeek.com/2011/06/17/breathing-sleep-led/

    Except, instead of turning off at the end of the cycle, the light will stay on at around 61% brightness, then fade back to 100%, and so on. Is there a way to do this? Would I need a 555 timer instead?
     
  2. inwo

    Well-Known Member

    Nov 7, 2013
    2,435
    315
  3. DickCappels

    Moderator

    Aug 21, 2008
    2,664
    634
    You can see the author's code here. It is merely a loop that ramps up the value to the PWM (my assumption), waits varying amounts of time depending upon the value sent to the PWM, and after running through the loop, repeats. You can change the maximum and minimum apparent brightnesses by changing the value of the first argument in the FOR statement in both places it appears in the code.

    ORIGINAL:
    for(i = 15 ; i <= 255; i+=1)

    MODIFIED SO IT WON'T GET AS DIM:
    for(i = 60 ; i <= 255; i+=1)

    Keep in mind the fact that to a human eye apparent brightness is a logarithmic function of optical power and is highly affected by the degree of light/dark adaptation of the visual system.

    The original Arduino sketch:
    http://www.thecustomgeek.com/files/Sleep_LED.pde
     
  4. wayneh

    Expert

    Sep 9, 2010
    12,157
    3,064
    I think I'd send a slow cosine wave through the PWM, but "clip" all values that fall below the minimum threshold, holding them at the minimum instead of allowing them to fall. That will give that slight hold time at the minimum value before it throbs again.

    Note that "throbbing" is a good search term for this sort of thing.
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,652
    2,348
  6. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,176
    397
    Or look at, forum.allaboutcircuits.com/showthread.php?t=98511 , xkillowatts, 6-10-2014
    Vary R3 to change minimum brightness.
     
  7. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    5,005
    745
    Here is a circuit using a 555 timer , speed is centered around 3 seconds on/off.
     
    Last edited: Jul 9, 2014
  8. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,176
    397
    Dodgydave, I assume the line cross at pin 2 & 6 is a connection?
     
  9. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    5,005
    745
    yes, pins 2,6 together to make an astable.
     
    Bernard likes this.
Loading...