PWM filtering

Discussion in 'General Electronics Chat' started by gdallas, Oct 7, 2014.

  1. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
    Say I have a 12V pwm that provides two duty cycles to control the intensity of a lamp; bright and dim. But lets i want to change this behaviour but I am unable to affect the control system upstream of this.

    I want the bulb to be on only with the higher intensity but be off when the lower intensity duty. What would he best method for doing this? Could I use a basic high pas filter?

    Current conditions

    Large duty = bright

    Low duty = dim


    New conditions

    Large duty = bright

    Low duty = off
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    You need a combination of two circuits which are designed to provide two separate functions:

    (1) a circuit to discriminated between two duty cycles,

    (2) a switching function to turn on the lamp. This can be a transistor or mechanical relay.

    For (1), you can use a monostable multivibrator that is set to trigger halfway between the two pulse widths (digital solution).

    You can also use an analog solution by integrating (low pass filter) the PWM signal and use an analog comparator to detect when the average voltage exceeds a given threshold voltage.
     
  3. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
    My initial thoughts were basic pic measuring the duty., then enabling an output only when it detects the signal to be larger duty that. Something like below.


    Overkill?
     
  4. alfacliff

    Well-Known Member

    Dec 13, 2013
    2,449
    428
    no, a high pass filter isnt what you need. for one thing, it would probably change the pulse wave form.
     
  5. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
    Hi Mr Chips,
    Would you mind elaborating on this as i don’t have much experience with mulitibrators or could you point me in the direction of a decent example? how does it discriminate between the two pulse widths and wont its output change state only momentarily, therefore how do i use this output to control the base of my transistor if it doesn’t latch?
     
  6. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,789
    945
    how about just reading light intensity directly with a photocell? that could then be put in a small transistor circuit that drives a relay.
     
  7. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    Even simpler, you could perhaps just integrate the PWM and rely on the fairly sharp switching threshold of a FET :-
    PWM-switch.gif

    Edit: You may have to adjust the resistor values, depending on the FET used and the two PWM duty cycle values.
     
    Last edited: Oct 7, 2014
    gdallas likes this.
  8. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
    Thanks Alec_t,

    would you mind explaining this and advise calculations required to tune this to specific duty's and pulsewdiths
    many thanks
     
  9. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    R2 and C1 integrate the PWM signal to give an averaged voltage proportional to the pulse voltage (12V) and the duty cycle. For example, for 50% duty cycle the voltage would be (if we ignore R3) 50% of 12V = 6V. For a lower duty cycle the averaged voltage would be lower. Providing the averaged voltage exceeds the Vgs threshold for the particular FET it will conduct. The trick is to get an optimum voltage which for the 'high' duty cycle exceeds the threshold but for the 'dim' duty cycle does not. Hence the use of R3. R3 forms with R2 a potential divider and can be chosen to give that optimum voltage. The threshold varies from one FET to another (even for FETs of the same type number), so R3 would need to be tweaked accordingly. The values of R2 and C1 should be chosen to give an RC time constant about ten times the period of the PWM signal.
     
  10. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
    I see what you're saying. This is a fantastic solution. Thanks for sharing your thoughts. The dimmed voltage is 2.5v as measured tonight. 11.36 when bright

    I'll get about this now.

    Thanks
     
  11. gdallas

    Thread Starter Member

    Apr 25, 2012
    74
    0
  12. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    That should be fine. For starters I'd try R2 = R3 = 47k, C1 = 10uF 25V working electrolytic.
     
Loading...